Author: bleny Date: 2014-04-18 11:52:55 +0200 (Fri, 18 Apr 2014) New Revision: 1898 Url: http://forge.codelutin.com/projects/wao/repository/revisions/1898 Log: clean some js Added: trunk/wao-web/src/main/webapp/endpoints-js.jsp Removed: trunk/wao-web/src/main/webapp/enpoints-js.jsp Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout-login.jsp trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp trunk/wao-web/src/main/webapp/wao.js Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout-login.jsp =================================================================== --- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout-login.jsp 2014-04-18 09:46:34 UTC (rev 1897) +++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout-login.jsp 2014-04-18 09:52:55 UTC (rev 1898) @@ -31,7 +31,7 @@ <sj:head locale="fr" jqueryui="true" loadAtOnce="true" jquerytheme="start" /> <sb:head /> <script type="text/javascript" src="<s:url value='/wao.js'/>"></script> - <script type="text/javascript" src="<s:url value='/enpoints-js.jsp'/>"></script> + <script type="text/javascript" src="<s:url value='/endpoints-js.jsp'/>"></script> <link rel="stylesheet" type="text/css" href="<s:url value='/wao.css'/>" media="all" /> <link rel="stylesheet" type="text/css" href="<s:url value='/wao-screen.css'/>" media="screen"> <decorator:head /> Modified: trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp =================================================================== --- trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-04-18 09:46:34 UTC (rev 1897) +++ trunk/wao-web/src/main/webapp/WEB-INF/decorators/layout.jsp 2014-04-18 09:52:55 UTC (rev 1898) @@ -38,7 +38,7 @@ <script type="text/javascript" src="<s:url value="/spin.js-2.0.0/spin.js" />"></script> <script type="text/javascript" src="<s:url value="/spin.js-2.0.0/jquery.spin.js" />"></script> <script type="text/javascript" src="<s:url value="/wao.js" />"></script> - <script type="text/javascript" src="<s:url value='/enpoints-js.jsp'/>"></script> + <script type="text/javascript" src="<s:url value='/endpoints-js.jsp'/>"></script> <link rel="stylesheet" type="text/css" href="<s:url value="/select2-3.4.5/select2.css" />" /> <link rel="stylesheet" type="text/css" href="<s:url value="/select2-3.4.5/select2-bootstrap.css" />" /> <link rel="stylesheet" type="text/css" href="<s:url value="/wao.css" />" media="all" /> Copied: trunk/wao-web/src/main/webapp/endpoints-js.jsp (from rev 1897, trunk/wao-web/src/main/webapp/enpoints-js.jsp) =================================================================== --- trunk/wao-web/src/main/webapp/endpoints-js.jsp (rev 0) +++ trunk/wao-web/src/main/webapp/endpoints-js.jsp 2014-04-18 09:52:55 UTC (rev 1898) @@ -0,0 +1,41 @@ +<%-- + #%L + Wao :: Web + %% + Copyright (C) 2009 - 2014 Ifremer + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + #L% + --%> +<%@ page language="java" contentType="text/javascript; charset=utf-8" pageEncoding="utf-8"%><%@ taglib uri="/struts-tags" prefix="s" %> +<% + // allow this page to be cached by browser + response.setDateHeader("Expires", System.currentTimeMillis() + 3600000L); // 1 hour in future. +%> + +$(document).ready(function () { + + // json + WAO.OBSMER_SAMPLE_ROWS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="sample-rows-filter-values-json"/>'; + WAO.OBSMER_BOATS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="boats-filter-values-json"/>'; + WAO.OBSMER_CONTACTS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="contacts-filter-values-json"/>'; + WAO.OBSMER_UPDATE_BOAT_INFOS_JSON_URL = '<s:url namespace="/obsmer" action="update-boat-infos-json"/>'; + WAO.OBSMER_GET_BOAT_CONTACTS_COUNT_JSON_URL = '<s:url namespace="/obsmer" action="get-boat-contacts-count-json"/>'; + + // fragments + WAO.OBSMER_BOAT_DETAILS_URL = '<s:url namespace="/obsmer" action="boat-details"/>'; + +}); + + Deleted: trunk/wao-web/src/main/webapp/enpoints-js.jsp =================================================================== --- trunk/wao-web/src/main/webapp/enpoints-js.jsp 2014-04-18 09:46:34 UTC (rev 1897) +++ trunk/wao-web/src/main/webapp/enpoints-js.jsp 2014-04-18 09:52:55 UTC (rev 1898) @@ -1,41 +0,0 @@ -<%-- - #%L - Wao :: Web - %% - Copyright (C) 2009 - 2014 Ifremer - %% - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. - #L% - --%> -<%@ page language="java" contentType="text/javascript; charset=utf-8" pageEncoding="utf-8"%><%@ taglib uri="/struts-tags" prefix="s" %> -<% - // allow this page to be cached by browser - response.setDateHeader("Expires", System.currentTimeMillis() + 3600000L); // 1 hour in future. -%> - -$(document).ready(function () { - - // json - WAO.OBSMER_SAMPLE_ROWS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="sample-rows-filter-values-json"/>'; - WAO.OBSMER_BOATS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="boats-filter-values-json"/>'; - WAO.OBSMER_CONTACTS_FILTER_VALUES_JSON_URL = '<s:url namespace="/obsmer" action="contacts-filter-values-json"/>'; - WAO.OBSMER_UPDATE_BOAT_INFOS_JSON_URL = '<s:url namespace="/obsmer" action="update-boat-infos-json"/>'; - WAO.OBSMER_GET_BOAT_CONTACTS_COUNT_JSON_URL = '<s:url namespace="/obsmer" action="get-boat-contacts-count-json"/>'; - - // fragments - WAO.OBSMER_BOAT_DETAILS_URL = '<s:url namespace="/obsmer" action="boat-details"/>'; - -}); - - Modified: trunk/wao-web/src/main/webapp/wao.js =================================================================== --- trunk/wao-web/src/main/webapp/wao.js 2014-04-18 09:46:34 UTC (rev 1897) +++ trunk/wao-web/src/main/webapp/wao.js 2014-04-18 09:52:55 UTC (rev 1898) @@ -75,7 +75,7 @@ var $select = $(select).empty(); // FIXME brendan 26/03/14 should be data-binding but freemarker break the template :-( var binding = $select.attr('databinding'); - var options = WAO.getData(binding, filterValues); + var options = WAO.getNestedPropertyValue(binding, filterValues); $.each(options, function (index, option) { var optionHtml = '<option value="' + option.value + '">' + option.label + '</option>'; $select.append(optionHtml); @@ -208,7 +208,7 @@ this.$spinner.spin(false); }; - this.getData = function(path, data) { + this.getNestedPropertyValue = function(path, data) { return path.split('.').reduce(function(prev, prop){ return prev && prev[prop] }, data)