[FIX] survey: only load js scripts when needed

This is done with the help of website.if_dom_contains and 1) js_surveyform
class for survey.js 2) a new fake class js_surveyresult for survey_result.js
This fix also allow to avoid spurious logs on runbot during phantomjs tests.
This commit is contained in:
Simon Lejeune
2014-12-19 17:49:12 +01:00
parent 0f99b7254c
commit 4dd5dbb289
3 changed files with 10 additions and 8 deletions
+4 -4
View File
@@ -21,12 +21,11 @@
* the website engine.
*/
$(document).ready(function () {
'use strict';
(function () {
'use strict';
openerp.website.if_dom_contains('.js_surveyform', function (the_form) {
console.debug("[survey] Custom JS for survey is loading...");
var the_form = $('.js_surveyform');
var prefill_controller = the_form.attr("data-prefill");
var validate_controller = the_form.attr("data-validate");
var submit_controller = the_form.attr("data-submit");
@@ -153,3 +152,4 @@ $(document).ready(function () {
console.debug("[survey] Custom JS for survey loaded!");
});
})();
+5 -3
View File
@@ -16,8 +16,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
$(document).ready(function () {
'use strict';
(function () {
'use strict';
openerp.website.if_dom_contains('.js_surveyresult', function () {
console.debug("[survey] Survey Result JS is loading...");
//Script For Pagination
@@ -174,4 +175,5 @@ $(document).ready(function () {
});
console.debug("[survey] Survey Result JS loaded!");
});
});
})();
+1 -1
View File
@@ -13,7 +13,7 @@
<template id="result" name="Survey Result">
<t t-call="website.layout">
<div class="oe_structure" />
<div class="container">
<div class="container js_surveyresult">
<div class="jumbotron mt32">
<h1><span t-field="survey.title" /> <span style="font-size:1.5em;" class="fa fa-bar-chart-o pull-right "/></h1>
<div t-field="survey.description" class="oe_no_empty" />