From aaeef14903d4a3f359fcd6dd61a4f8ee41c947a4 Mon Sep 17 00:00:00 2001 From: Kishan Gajjar Date: Tue, 21 Mar 2017 11:48:02 +0530 Subject: [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. --- addons/web_editor/static/src/js/snippets.editor.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'addons/web_editor/static/src/js') 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 = $('', { + 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) { -- cgit v1.2.3