[FIX] website, *: fix placeholder translate

* = web_editor

InputUserValueWidget's data-placeholder where not translatable.

task-2210358

closes odoo/odoo#47029

X-original-commit: dfaf497de5eb95f1ba65e927631cc48d97ca6127
Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
fja-odoo
2020-03-05 17:10:50 +00:00
parent 94b39d3ea3
commit c730da7197
2 changed files with 9 additions and 3 deletions
@@ -18,6 +18,8 @@ var _t = core._t;
* @param {string} [title]
* @param {Object} [options]
* @param {string[]} [options.classes]
* @param {string} [options.tooltip]
* @param {string} [options.placeholder]
* @param {Object} [options.dataAttributes]
* @returns {HTMLElement} - the original 'el' argument
*/
@@ -35,6 +37,9 @@ function _addTitleAndAllowedAttributes(el, title, options) {
if (options && options.tooltip) {
tooltipEl.title = options.tooltip;
}
if (options && options.placeholder) {
el.setAttribute('placeholder', options.placeholder);
}
if (options && options.dataAttributes) {
for (const key in options.dataAttributes) {
el.dataset[key] = options.dataAttributes[key];
@@ -750,7 +755,7 @@ const InputUserValueWidget = UserValueWidget.extend({
this.inputEl = document.createElement('input');
this.inputEl.setAttribute('type', 'text');
this.inputEl.setAttribute('placeholder', this.el.dataset.placeholder || '');
this.inputEl.setAttribute('placeholder', this.el.getAttribute('placeholder') || '');
this.inputEl.classList.toggle('text-left', !unit);
this.inputEl.classList.toggle('text-right', !!unit);
this.containerEl.appendChild(this.inputEl);
@@ -1898,6 +1903,7 @@ const SnippetOptionWidget = Widget.extend({
classes: el.classList,
dataAttributes: el.dataset,
tooltip: el.title,
placeholder: el.getAttribute('placeholder'),
childNodes: [...el.childNodes],
},
};
+2 -2
View File
@@ -281,8 +281,8 @@
data-background-position-overlay="true" data-no-preview="true"/>
</we-row>
<we-multi data-css-property="background-size" data-dependencies="background_repeat_opt">
<we-input string="Width" data-select-style="auto" data-placeholder="auto" data-unit="px"/>
<we-input string="Height" data-select-style="auto" data-placeholder="auto" data-unit="px"/>
<we-input string="Width" data-select-style="auto" placeholder="auto" data-unit="px"/>
<we-input string="Height" data-select-style="auto" placeholder="auto" data-unit="px"/>
</we-multi>
</div>