summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src
diff options
context:
space:
mode:
authorRomain Derie <rde@odoo.com>2019-12-16 17:19:33 +0000
committerqsm-odoo <qsm@odoo.com>2019-12-19 15:30:06 +0000
commit705b2faa695a42071fea4124aa9ac320ac0839df (patch)
tree371041b319833d863a813211cbfa2d6248eceab7 /addons/web_editor/static/src
parent2a0a0e52dd1d97941b118c4ae9112b6a890e19de (diff)
[REF] web_editor, *: use the name of invisible snippets in the UI
* website, website_mass_mailing Instead of a custom string, use the name of the snippet when displaying an 'invisible' snippet in the 'invisible elements' section. This commit also fixes a font-awesome bug introduced with the library update revert. Part of https://github.com/odoo/odoo/pull/41789 closes odoo/odoo#41789 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src')
-rw-r--r--addons/web_editor/static/src/js/editor/snippets.editor.js38
1 files changed, 18 insertions, 20 deletions
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 4a02f890bb4..dc2f997bf54 100644
--- a/addons/web_editor/static/src/js/editor/snippets.editor.js
+++ b/addons/web_editor/static/src/js/editor/snippets.editor.js
@@ -210,6 +210,20 @@ var SnippetEditor = Widget.extend({
this.$el.toggleClass('o_top_cover', offset.top < this.$editable.offset().top);
},
/**
+ * DOMElements have a default name which appears in the overlay when they
+ * are being edited. This method retrieves this name; it can be defined
+ * directly in the DOM thanks to the `data-name` attribute.
+ */
+ getName: function () {
+ if (this.$target.data('name') !== undefined) {
+ return this.$target.data('name');
+ }
+ if (this.$target.parent('.row').length) {
+ return _t("Column");
+ }
+ return _t("Block");
+ },
+ /**
* @return {boolean}
*/
isShown: function () {
@@ -395,22 +409,6 @@ var SnippetEditor = Widget.extend({
//--------------------------------------------------------------------------
/**
- * DOMElements have a default name which appears in the overlay when they
- * are being edited. This method retrieves this name; it can be defined
- * directly in the DOM thanks to the `data-name` attribute.
- *
- * @private
- */
- _getName: function () {
- if (this.$target.data('name') !== undefined) {
- return this.$target.data('name');
- }
- if (this.$target.parent('.row').length) {
- return _t("Column");
- }
- return _t("Block");
- },
- /**
* Instantiates the snippet's options.
*
* @private
@@ -433,7 +431,7 @@ var SnippetEditor = Widget.extend({
}
var $optionsSection = $(core.qweb.render('web_editor.customize_block_options_section', {
- name: this._getName(),
+ name: this.getName(),
})).data('editor', this);
const $optionsSectionBtnGroup = $optionsSection.find('we-button-group');
$optionsSectionBtnGroup.contents().each((i, node) => {
@@ -472,7 +470,7 @@ var SnippetEditor = Widget.extend({
this.$el,
_.extend({
optionName: optionName,
- snippetName: this._getName(),
+ snippetName: this.getName(),
}, val.data),
this.options
);
@@ -872,7 +870,7 @@ var SnippetsMenu = Widget.extend({
this.invisibleDOMPanelEl.classList.add('o_we_invisible_el_panel');
this.invisibleDOMPanelEl.appendChild(
$('<div/>', {
- text: _t('Invisible'),
+ text: _t('Invisible Elements'),
class: 'o_panel_header',
}).prepend(
$('<i/>', {class: 'fa fa-eye-slash'})
@@ -1217,7 +1215,7 @@ var SnippetsMenu = Widget.extend({
const editor = await this._createSnippetEditor($(el));
const $invisEntry = $('<div/>', {
class: 'o_we_invisible_entry d-flex align-items-center justify-content-between',
- text: _t(el.getAttribute('string')),
+ text: editor.getName(),
}).append($('<i/>', {class: `fa ${editor.isTargetVisible() ? 'fa-eye' : 'fa-eye-slash'} ml-2`}));
$invisibleDOMPanelEl.append($invisEntry);
this.invisibleDOMMap.set($invisEntry[0], el);