summaryrefslogtreecommitdiff
path: root/addons/web_editor
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2019-03-05 17:26:04 +0100
committerChristophe Simonis <chs@odoo.com>2019-03-05 17:26:04 +0100
commit3e54704e669441e655b1fe19ee0fa0646cdbf8d5 (patch)
treeacddbce8a7f3868c1bf8f882dc959f63134f40ec /addons/web_editor
parent2c495502aa37374f3748d9ff4ab7cf9e8d9a6d6e (diff)
parent27081bf6f5f00ccb39f82ae62d14d428bf1c9223 (diff)
[MERGE] forward port branch 11.0 up to 27081bf6f5f
Diffstat (limited to 'addons/web_editor')
-rw-r--r--addons/web_editor/models/ir_ui_view.py3
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.editor.js16
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.options.js8
3 files changed, 21 insertions, 6 deletions
diff --git a/addons/web_editor/models/ir_ui_view.py b/addons/web_editor/models/ir_ui_view.py
index 37228224971..cbb7e3ef643 100644
--- a/addons/web_editor/models/ir_ui_view.py
+++ b/addons/web_editor/models/ir_ui_view.py
@@ -189,5 +189,6 @@ class IrUiView(models.Model):
``bundles=True`` returns also the asset bundles
"""
user_groups = set(self.env.user.groups_id)
- views = self.with_context(active_test=False)._views_get(key, bundles=bundles)
+ View = self.with_context(active_test=False, lang=None)
+ views = View._views_get(key, bundles=bundles)
return views.filtered(lambda v: not v.groups_id or len(user_groups.intersection(v.groups_id)))
diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js
index 6599000d245..e731ec0fd99 100644
--- a/addons/web_editor/static/src/js/editor/snippets.editor.js
+++ b/addons/web_editor/static/src/js/editor/snippets.editor.js
@@ -84,6 +84,16 @@ var SnippetEditor = Widget.extend({
});
}
+ this.$target.on('transitionstart.snippet_editor, animationstart.snippet_editor', function () {
+ self._targetIsAnimated = true;
+ });
+ this.$target.on('transitionend.snippet_editor, animationend.snippet_editor', function () {
+ self._targetIsAnimated = false;
+ if (self.$el.is('.oe_active')) {
+ self.cover();
+ }
+ });
+
return $.when.apply($, defs);
},
/**
@@ -92,6 +102,7 @@ var SnippetEditor = Widget.extend({
destroy: function () {
this._super.apply(this, arguments);
this.$target.removeData('snippet-editor');
+ this.$target.off('.snippet_editor');
},
//--------------------------------------------------------------------------
@@ -123,6 +134,11 @@ var SnippetEditor = Widget.extend({
* Makes the editor overlay cover the associated snippet.
*/
cover: function () {
+ if (this._targetIsAnimated) {
+ // Do not cover a target being animated, it will be covered once the
+ // animation is completed.
+ return;
+ }
var offset = this.$target.offset();
var manipulatorOffset = this.$el.parent().offset();
offset.top -= manipulatorOffset.top;
diff --git a/addons/web_editor/static/src/js/editor/snippets.options.js b/addons/web_editor/static/src/js/editor/snippets.options.js
index 49285986240..e7580a4aa3b 100644
--- a/addons/web_editor/static/src/js/editor/snippets.options.js
+++ b/addons/web_editor/static/src/js/editor/snippets.options.js
@@ -289,13 +289,11 @@ var SnippetOption = Widget.extend({
.addClass('active');
_processSelectClassElements(this.$el);
- _.each(this.$el.find('.dropdown-menu'), function (group) {
- _processSelectClassElements($(group).children());
- });
- function _processSelectClassElements($elements) {
+ function _processSelectClassElements($el) {
var maxNbClasses = -1;
- $elements.filter('[data-select-class]')
+ $el.find('[data-select-class]')
+ .addBack('[data-select-class]')
.removeClass('active')
.filter(function () {
var className = $(this).data('selectClass');