summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/snippets.editor.js
diff options
context:
space:
mode:
authorKishan Gajjar <kig@odoo.com>2017-03-21 11:48:02 +0530
committerqsm-odoo <qsm@odoo.com>2017-07-04 10:54:20 +0200
commitaaeef14903d4a3f359fcd6dd61a4f8ee41c947a4 (patch)
tree60f858c1ee67be6cdcc0918f1f59a48f8d956c48 /addons/web_editor/static/src/js/snippets.editor.js
parent79c9f0a7a52b0d88339efcb69296ab3b66f44442 (diff)
[IMP] web_editor, website(_*): show all snippets even if module is not installed
* mail_channel, mass_mailing, twitter, event - t-install attribute holds the technical name of the module that needs to be install to use a particular snippet. - Disable the drag & drop feature for these dummy snippets. - Move some images to website module. - Installed snippets display at the top of the list. - Hide not-installed module snippets if user don't have rights to install module.
Diffstat (limited to 'addons/web_editor/static/src/js/snippets.editor.js')
-rw-r--r--addons/web_editor/static/src/js/snippets.editor.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/snippets.editor.js b/addons/web_editor/static/src/js/snippets.editor.js
index e11e3205815..d0b6394ecd9 100644
--- a/addons/web_editor/static/src/js/snippets.editor.js
+++ b/addons/web_editor/static/src/js/snippets.editor.js
@@ -251,12 +251,25 @@ data.Class = Widget.extend({
$div.find('.oe_snippet_thumbnail_img').css('background-image', 'url(' + thumbnail + ')');
}
// end
+
+ var moduleID = $snippet.data('moduleId');
+ if (moduleID) {
+ $snippet.addClass('o_snippet_install');
+ var $installBtn = $('<a/>', {
+ class: 'btn btn-primary btn-sm o_install_btn',
+ target: '_blank',
+ href: '/web#id=' + moduleID + '&view_type=form&model=ir.module.module&action=base.open_module_tree',
+ text: _t("Install"),
+ });
+ $div.append($installBtn);
+ }
}
if (!$snippet.data("selector")) {
$("> *:not(.oe_snippet_thumbnail)", this).addClass('oe_snippet_body');
}
number++;
- });
+ })
+ .not('[data-module-id]');
// hide scroll if no snippets defined
if (!number) {