summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/framework
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/framework')
-rw-r--r--addons/web/static/src/js/framework/misc.js37
-rw-r--r--addons/web/static/src/js/framework/view.js11
2 files changed, 38 insertions, 10 deletions
diff --git a/addons/web/static/src/js/framework/misc.js b/addons/web/static/src/js/framework/misc.js
index 7a87c05350b..ef073d1ab0d 100644
--- a/addons/web/static/src/js/framework/misc.js
+++ b/addons/web/static/src/js/framework/misc.js
@@ -322,10 +322,47 @@ $.extend( proto, {
}
});
+/**
+ * Private function that triggers an event on core.bus
+ * @param {htmlString or Element or Array or jQuery} [content] the content that
+ * has been attached in the DOM
+ */
+function _notify (content) {
+ core.bus.trigger('DOM_updated', content);
+}
+/**
+ * Appends content in a jQuery object and optionnally triggers an event
+ * @param {jQuery} [$target] the node where content will be appended
+ * @param {htmlString or Element or Array or jQuery} [content] DOM element,
+ * array of elements, HTML string or jQuery object to append to $target
+ * @param {jQuery} [trigger] true to trigger an event, false otherwise
+ */
+function append ($target, content, trigger) {
+ $target.append(content);
+ if (trigger) {
+ _notify(content);
+ }
+}
+/**
+ * Prepends content in a jQuery object and optionnally triggers an event
+ * @param {jQuery} [$target] the node where content will be prepended
+ * @param {htmlString or Element or Array or jQuery} [content] DOM element,
+ * array of elements, HTML string or jQuery object to prepend to $target
+ * @param {jQuery} [trigger] true to trigger an event, false otherwise
+ */
+function prepend ($target, content, trigger) {
+ $target.prepend(content);
+ if (trigger) {
+ _notify(content);
+ }
+}
+
return {
blockUI: blockUI,
unblockUI: unblockUI,
redirect: redirect,
+ append: append,
+ prepend: prepend,
};
});
diff --git a/addons/web/static/src/js/framework/view.js b/addons/web/static/src/js/framework/view.js
index 8eee01d414d..d803b7487df 100644
--- a/addons/web/static/src/js/framework/view.js
+++ b/addons/web/static/src/js/framework/view.js
@@ -166,18 +166,9 @@ var View = Widget.extend({
this.embedded_view = embedded_view;
},
do_show: function () {
- var self = this;
- this.$el.show();
- setTimeout(function () {
- self.$el.parent().addClass('in');
- }, 0);
-
+ this._super();
core.bus.trigger('view_shown', this);
},
- do_hide: function () {
- this.$el.parent().removeClass('in');
- this.$el.hide();
- },
is_active: function () {
return this.ViewManager.active_view.controller === this;
},