summaryrefslogtreecommitdiff
path: root/addons/website_forum/static/src/js
diff options
context:
space:
mode:
authorqsm-odoo <qsm@odoo.com>2019-01-23 13:00:33 +0000
committerqsm-odoo <qsm@odoo.com>2019-01-24 09:48:47 +0000
commita00e6f3dd132953fc028795756ead12cc6b03e29 (patch)
tree7ad8f7077e2e556a5fae22d7e5f799afd0595bfe /addons/website_forum/static/src/js
parent7a2394c63185524706e48df562ca5f318abe86c3 (diff)
[FIX] website, *: restore 'animation' system to the way it worked
* website_forum Following the new editor's merge at https://github.com/odoo/odoo/pull/29775, the website 'animation' system was 'extended' to vaguely use a 'Registry' instance instead of an object. This was however left undocumented, with a require in the middle of a file, restarting all animations when used, only used by website_forum... with more code for no reason at all, ... This commit restores the system to the way it was before and re-adapts website_forum: - No need to check if website_forum is in the DOM as it is already checked by the animation system (on top of that... the new code was checking the DOM before it was ready...). - No need of a dynamic add on a registry, this is always done before the DOM is ready, so before the animations are started. - No need to know the root instance in website forum, just use the animation as the Wysiwyg instance's parent. The goal of this commit is also to avoid useless conflicts with https://github.com/odoo/odoo/pull/29442 (that should not have had any conflict at all as totally independent of the editor task...) closes odoo/odoo#30478
Diffstat (limited to 'addons/website_forum/static/src/js')
-rw-r--r--addons/website_forum/static/src/js/website_forum.js12
1 files changed, 3 insertions, 9 deletions
diff --git a/addons/website_forum/static/src/js/website_forum.js b/addons/website_forum/static/src/js/website_forum.js
index 6e9f3577cf1..b9a059cd438 100644
--- a/addons/website_forum/static/src/js/website_forum.js
+++ b/addons/website_forum/static/src/js/website_forum.js
@@ -4,19 +4,13 @@ odoo.define('website_forum.website_forum', function (require) {
var core = require('web.core');
var wContext = require('website.context');
var Wysiwyg = require('web_editor.wysiwyg');
-var rootWidget = require('root.widget');
var sAnimations = require('website.content.snippets.animation');
var session = require('web.session');
var qweb = core.qweb;
var _t = core._t;
-
-if (!$('.website_forum').length) {
- return $.Deferred().reject("DOM doesn't contain '.website_forum'");
-}
-
-sAnimations.registryObject.add('websiteForum', sAnimations.Class.extend({
+sAnimations.registry.websiteForum = sAnimations.Class.extend({
selector: '.website_forum',
xmlDependencies: ['/website_forum/static/src/xml/website_forum_share_templates.xml'],
read_events: {
@@ -155,7 +149,7 @@ sAnimations.registryObject.add('websiteForum', sAnimations.Class.extend({
MediaPlugin: false,
};
}
- var wysiwyg = new Wysiwyg(rootWidget, options);
+ var wysiwyg = new Wysiwyg(self, options);
wysiwyg.attachTo($textarea).then(function () {
// float-left class messes up the post layout OPW 769721
$form.find('.note-editable').find('img.float-left').removeClass('float-left');
@@ -508,7 +502,7 @@ sAnimations.registryObject.add('websiteForum', sAnimations.Class.extend({
$('.forum_intro').slideUp();
return true;
},
-}));
+});
sAnimations.registry.websiteForumSpam = sAnimations.Class.extend({
selector: '.o_wforum_moderation_queue',