summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2019-01-21 12:55:05 +0000
committerqsm-odoo <qsm@odoo.com>2019-01-22 17:55:00 +0000
commit6521cf4f662a62912b54f52a1236935634913053 (patch)
treef1acdcbf7c86b49672a4ac4d5461e9e606b7bb9d /addons
parentc0a7c1b1675a0b5fad93c3b8cd519c0e2154227f (diff)
[FIX] *: review 'frontend' pages init (web_editor.base)
* auth_password_policy_signup, auth_signup, website, portal, survey, web_unsplash, website Following the new editor's merge at https://github.com/odoo/odoo/pull/29775 web_editor.base has been moved to website while it was still used by frontend pages which do not depend on website (especially portal). This commit moves web_editor.base to portal while waiting for https://github.com/odoo/odoo/pull/29442. It also removes the unnecessary dependencies to it in non-portal pages (in survey for example).
Diffstat (limited to 'addons')
-rw-r--r--addons/auth_password_policy_signup/static/src/js/signup_policy.js28
-rw-r--r--addons/auth_signup/static/src/js/signup.js18
-rw-r--r--addons/portal/static/src/js/base.js (renamed from addons/website/static/src/js/content/base.js)0
-rw-r--r--addons/portal/views/assets.xml1
-rw-r--r--addons/survey/static/src/js/survey.js4
-rw-r--r--addons/survey/static/src/js/tour_test_survey.js2
-rw-r--r--addons/web_unsplash/static/src/js/unsplash_beacon.js34
-rw-r--r--addons/website/views/website_templates.xml1
8 files changed, 39 insertions, 49 deletions
diff --git a/addons/auth_password_policy_signup/static/src/js/signup_policy.js b/addons/auth_password_policy_signup/static/src/js/signup_policy.js
index 299db244806..1d37484a34c 100644
--- a/addons/auth_password_policy_signup/static/src/js/signup_policy.js
+++ b/addons/auth_password_policy_signup/static/src/js/signup_policy.js
@@ -1,25 +1,23 @@
odoo.define('auth_password_policy_signup.policy', function (require) {
"use strict";
-var base = require('web_editor.base');
+require('web.dom_ready');
var policy = require('auth_password_policy');
var PasswordMeter = require('auth_password_policy.Meter');
-base.ready().then(function () {
- var $signupForm = $('.oe_signup_form, .oe_reset_password_form');
- if (!$signupForm.length) { return; }
+var $signupForm = $('.oe_signup_form, .oe_reset_password_form');
+if (!$signupForm.length) { return; }
- // hook in password strength meter
- // * requirement is the password field's minlength
- // * recommendations are from the module
- var $password = $signupForm.find('#password');
- var minlength = Number($password.attr('minlength'));
- if (isNaN(minlength)) { return; }
+// hook in password strength meter
+// * requirement is the password field's minlength
+// * recommendations are from the module
+var $password = $signupForm.find('#password');
+var minlength = Number($password.attr('minlength'));
+if (isNaN(minlength)) { return; }
- var meter = new PasswordMeter(null, new policy.Policy({minlength: minlength}), policy.recommendations);
- meter.insertAfter($password);
- $password.on('input', function () {
- meter.update($password.val());
- });
+var meter = new PasswordMeter(null, new policy.Policy({minlength: minlength}), policy.recommendations);
+meter.insertAfter($password);
+$password.on('input', function () {
+ meter.update($password.val());
});
});
diff --git a/addons/auth_signup/static/src/js/signup.js b/addons/auth_signup/static/src/js/signup.js
index fc35d689d8a..739ad5e283f 100644
--- a/addons/auth_signup/static/src/js/signup.js
+++ b/addons/auth_signup/static/src/js/signup.js
@@ -1,16 +1,14 @@
odoo.define('auth_signup.signup', function (require) {
'use strict';
-var base = require('web_editor.base');
+require('web.dom_ready');
-base.ready().then(function() {
- // Disable 'Sign Up' button to prevent user form continuous clicking
- if ($('.oe_signup_form').length > 0) {
- $('.oe_signup_form').on('submit', function () {
- $('.o_signup_btn').attr('disabled', 'disabled');
- $('.o_signup_btn').prepend('<i class="fa fa-refresh fa-spin"/> ');
- });
- }
-});
+// Disable 'Sign Up' button to prevent user form continuous clicking
+if ($('.oe_signup_form').length > 0) {
+ $('.oe_signup_form').on('submit', function () {
+ $('.o_signup_btn').attr('disabled', 'disabled');
+ $('.o_signup_btn').prepend('<i class="fa fa-refresh fa-spin"/> ');
+ });
+}
});
diff --git a/addons/website/static/src/js/content/base.js b/addons/portal/static/src/js/base.js
index bc5aa9892d0..bc5aa9892d0 100644
--- a/addons/website/static/src/js/content/base.js
+++ b/addons/portal/static/src/js/base.js
diff --git a/addons/portal/views/assets.xml b/addons/portal/views/assets.xml
index da71821fa9a..f9a9197f855 100644
--- a/addons/portal/views/assets.xml
+++ b/addons/portal/views/assets.xml
@@ -17,6 +17,7 @@
<link rel="stylesheet" type="text/scss" href="/portal/static/src/scss/portal.scss"/>
</xpath>
<xpath expr="//script[last()]" position="after">
+ <script type="text/javascript" src="/portal/static/src/js/base.js"></script>
<script type="text/javascript" src="/portal/static/src/js/portal.js"></script>
<script type="text/javascript" src="/portal/static/src/js/portal_tour.js"></script>
<script type="text/javascript" src="/portal/static/src/js/portal_chatter.js"></script>
diff --git a/addons/survey/static/src/js/survey.js b/addons/survey/static/src/js/survey.js
index 200928f428c..42a98752ab6 100644
--- a/addons/survey/static/src/js/survey.js
+++ b/addons/survey/static/src/js/survey.js
@@ -5,7 +5,6 @@ require('web.dom_ready');
var core = require('web.core');
var time = require('web.time');
var ajax = require('web.ajax');
-var base = require('web_editor.base');
var field_utils = require('web.field_utils');
var _t = core._t;
@@ -169,11 +168,10 @@ if(!the_form.length) {
return ajax.loadJS(url);
}
- var ready_with_locale = $.when(base.ready(), load_locale());
// datetimepicker use moment locale to display date format according to language
// frontend does not load moment locale at all.
// so wait until DOM ready with locale then init datetimepicker
- ready_with_locale.then(function(){
+ load_locale().then(function(){
_.each($('.input-group.date'), function(date_field){
var minDate = $(date_field).data('mindate') || moment({ y: 1900 });
var maxDate = $(date_field).data('maxdate') || moment().add(200, "y");
diff --git a/addons/survey/static/src/js/tour_test_survey.js b/addons/survey/static/src/js/tour_test_survey.js
index 9a9cac10001..8b2425d6be4 100644
--- a/addons/survey/static/src/js/tour_test_survey.js
+++ b/addons/survey/static/src/js/tour_test_survey.js
@@ -2,12 +2,10 @@ odoo.define('survey.tour_test_survey', function (require) {
'use strict';
var tour = require('web_tour.tour');
-var base = require("web_editor.base");
tour.register('test_survey', {
test: true,
url: '/survey/start/1',
- wait_for: base.ready()
}, [
// Page-1
{
diff --git a/addons/web_unsplash/static/src/js/unsplash_beacon.js b/addons/web_unsplash/static/src/js/unsplash_beacon.js
index 179d566cee3..eb19383b93f 100644
--- a/addons/web_unsplash/static/src/js/unsplash_beacon.js
+++ b/addons/web_unsplash/static/src/js/unsplash_beacon.js
@@ -1,26 +1,24 @@
odoo.define('web_unsplash.beacon', function (require) {
'use strict';
-var base = require('web_editor.base');
+require('web.dom_ready');
var ajax = require('web.ajax');
-base.ready().then(function () {
- var unsplash_images = [];
- _.each($('img[src*="/unsplash/"]'), function (img, index) {
- // get image id from URL (`http://www.domain.com:1234/unsplash/xYdf5feoI/lion.jpg` -> `xYdf5feoI`)
- unsplash_images.push(img.src.split('/unsplash/')[1].split('/')[0]);
- });
- if (unsplash_images.length) {
- ajax.jsonRpc('/web_unsplash/get_app_id', 'call').then(function (appID) {
- if (appID) {
- var unsplash_view_url = 'https://views.unsplash.com/v';
- $.get(unsplash_view_url, {
- photo_id: unsplash_images.join(','),
- app_id: appID,
- });
- }
- });
- }
+var unsplash_images = [];
+_.each($('img[src*="/unsplash/"]'), function (img, index) {
+ // get image id from URL (`http://www.domain.com:1234/unsplash/xYdf5feoI/lion.jpg` -> `xYdf5feoI`)
+ unsplash_images.push(img.src.split('/unsplash/')[1].split('/')[0]);
});
+if (unsplash_images.length) {
+ ajax.jsonRpc('/web_unsplash/get_app_id', 'call').then(function (appID) {
+ if (appID) {
+ var unsplash_view_url = 'https://views.unsplash.com/v';
+ $.get(unsplash_view_url, {
+ photo_id: unsplash_images.join(','),
+ app_id: appID,
+ });
+ }
+ });
+}
});
diff --git a/addons/website/views/website_templates.xml b/addons/website/views/website_templates.xml
index 5078c534458..47965104432 100644
--- a/addons/website/views/website_templates.xml
+++ b/addons/website/views/website_templates.xml
@@ -51,7 +51,6 @@
<script type="text/javascript" src="/website/static/src/js/utils.js"/>
<script type="text/javascript" src="/website/static/src/js/website.js"/>
- <script type="text/javascript" src="/website/static/src/js/content/base.js"/>
<script type="text/javascript" src="/website/static/src/js/content/ready.js"/>
<script type="text/javascript" src="/website/static/src/js/content/context.js"/>
<script type="text/javascript" src="/website/static/src/js/content/compatibility.js"/>