Plugins: add translation for plugin buttons, add option for hiding buttons in the viewer

This commit is contained in:
Julia Radzhabova 2018-12-13 15:01:19 +03:00
parent 540da6573d
commit 3eb1c21ecd
4 changed files with 23 additions and 1 deletions

View file

@ -312,6 +312,7 @@ define([
if (_.isArray(arrBtns)) {
_.each(arrBtns, function(b, index){
if (b.visible)
newBtns[index] = {text: b.text, cls: 'custom' + ((b.primary) ? ' primary' : '')};
});
}

View file

@ -2110,11 +2110,18 @@ define([
if (typeof itemVar.descriptionLocale == 'object')
description = itemVar.descriptionLocale[lang] || itemVar.descriptionLocale['en'] || description || '';
_.each(itemVar.buttons, function(b, index){
if (typeof b.textLocale == 'object')
b.text = b.textLocale[lang] || b.textLocale['en'] || b.text || '';
b.visible = (isEdit || b.isViewer !== false);
});
model.set({
description: description,
index: variationsArr.length,
url: itemVar.url,
icons: itemVar.icons,
buttons: itemVar.buttons,
visible: visible
});

View file

@ -1856,11 +1856,18 @@ define([
if (typeof itemVar.descriptionLocale == 'object')
description = itemVar.descriptionLocale[lang] || itemVar.descriptionLocale['en'] || description || '';
_.each(itemVar.buttons, function(b, index){
if (typeof b.textLocale == 'object')
b.text = b.textLocale[lang] || b.textLocale['en'] || b.text || '';
b.visible = (isEdit || b.isViewer !== false);
});
model.set({
description: description,
index: variationsArr.length,
url: itemVar.url,
icons: itemVar.icons,
buttons: itemVar.buttons,
visible: visible
});

View file

@ -2053,11 +2053,18 @@ define([
if (typeof itemVar.descriptionLocale == 'object')
description = itemVar.descriptionLocale[lang] || itemVar.descriptionLocale['en'] || description || '';
_.each(itemVar.buttons, function(b, index){
if (typeof b.textLocale == 'object')
b.text = b.textLocale[lang] || b.textLocale['en'] || b.text || '';
b.visible = (isEdit || b.isViewer !== false);
});
model.set({
description: description,
index: variationsArr.length,
url: itemVar.url,
icons: itemVar.icons,
buttons: itemVar.buttons,
visible: visible
});