mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-11 08:24:50 +03:00
Enable add/delete of Sieve scripts
This commit is contained in:
parent
1a07109d80
commit
ee37ad67bb
12 changed files with 24 additions and 22 deletions
|
|
@ -16,7 +16,7 @@ class SieveScriptModel extends AbstractModel
|
|||
nameError: false,
|
||||
bodyError: false,
|
||||
deleteAccess: false,
|
||||
canBeDeleted: false,
|
||||
canBeDeleted: true,
|
||||
hasChanges: false
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -67,26 +67,11 @@ class FiltersUserSettings {
|
|||
}
|
||||
|
||||
addScript() {
|
||||
const script = new SieveScriptModel();
|
||||
showScreenPopup(require('View/Popup/SieveScript'), [
|
||||
script,
|
||||
() => {
|
||||
if (!this.scripts[script.name]) {
|
||||
this.scripts[script.name] = script.name;
|
||||
}
|
||||
},
|
||||
false
|
||||
]);
|
||||
showScreenPopup(require('View/Popup/SieveScript'), [new SieveScriptModel()]);
|
||||
}
|
||||
|
||||
editScript(script) {
|
||||
showScreenPopup(require('View/Popup/SieveScript'), [
|
||||
script,
|
||||
() => {
|
||||
// TODO on save
|
||||
},
|
||||
true
|
||||
]);
|
||||
showScreenPopup(require('View/Popup/SieveScript'), [script]);
|
||||
}
|
||||
|
||||
deleteScript(script) {
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ class SieveScriptPopupView extends AbstractViewNext {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (this.isNew() && SieveStore.scripts.find(item => item.name() === script.name())) {
|
||||
script.nameError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.saving = true;
|
||||
this.saveError(false);
|
||||
|
||||
|
|
@ -51,6 +56,7 @@ class SieveScriptPopupView extends AbstractViewNext {
|
|||
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
script.hasChanges(false);
|
||||
SieveStore.scripts.push(script);
|
||||
} else {
|
||||
this.saveError(true);
|
||||
this.saveErrorText((data && data.ErrorCode)
|
||||
|
|
@ -110,11 +116,10 @@ class SieveScriptPopupView extends AbstractViewNext {
|
|||
});
|
||||
}
|
||||
|
||||
onShow(oScript, fTrueCallback, bEdit) {
|
||||
this.fTrueCallback = fTrueCallback;
|
||||
onShow(oScript) {
|
||||
this.script(oScript);
|
||||
this.rawActive(!oScript.allowFilters());
|
||||
this.isNew(!bEdit);
|
||||
this.isNew(!oScript.name());
|
||||
this.saveError(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ en:
|
|||
BUTTON_BACK: "Back"
|
||||
SETTINGS_FILTERS:
|
||||
LEGEND_FILTERS: "Filters"
|
||||
BUTTON_ADD_SCRIPT: "Add a Script"
|
||||
BUTTON_DELETE: "Delete"
|
||||
SUBNAME_NONE: "None"
|
||||
SUBNAME_MOVE_TO: "Move to \"%FOLDER%\""
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ de_DE:
|
|||
BUTTON_BACK: "Zurück"
|
||||
SETTINGS_FILTERS:
|
||||
LEGEND_FILTERS: "Filter"
|
||||
BUTTON_ADD_SCRIPT: "Skript hinzufügen"
|
||||
BUTTON_DELETE: "Löschen"
|
||||
SUBNAME_NONE: "Keine"
|
||||
SUBNAME_MOVE_TO: "Verschieben nach \"%FOLDER%\""
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ en_GB:
|
|||
BUTTON_BACK: "Back"
|
||||
SETTINGS_FILTERS:
|
||||
LEGEND_FILTERS: "Filters"
|
||||
BUTTON_ADD_SCRIPT: "Add a Script"
|
||||
BUTTON_DELETE: "Delete"
|
||||
SUBNAME_NONE: "None"
|
||||
SUBNAME_MOVE_TO: "Move to \"%FOLDER%\""
|
||||
|
|
|
|||
|
|
@ -440,6 +440,7 @@ en_US:
|
|||
BUTTON_BACK: "Back"
|
||||
SETTINGS_FILTERS:
|
||||
LEGEND_FILTERS: "Filters"
|
||||
BUTTON_ADD_SCRIPT: "Add a Script"
|
||||
BUTTON_DELETE: "Delete"
|
||||
SUBNAME_NONE: "None"
|
||||
SUBNAME_MOVE_TO: "Move to \"%FOLDER%\""
|
||||
|
|
|
|||
|
|
@ -441,6 +441,7 @@ es_ES:
|
|||
BUTTON_BACK: "Atrás"
|
||||
SETTINGS_FILTERS:
|
||||
LEGEND_FILTERS: "Filtros"
|
||||
BUTTON_ADD_SCRIPT: "Añadir un Script"
|
||||
BUTTON_DELETE: "Borrar"
|
||||
SUBNAME_NONE: "Ninguno"
|
||||
SUBNAME_MOVE_TO: "Mover a \"%FOLDER%\""
|
||||
|
|
|
|||
|
|
@ -441,6 +441,7 @@ fr_FR:
|
|||
BUTTON_BACK: "Retour"
|
||||
SETTINGS_FILTERS:
|
||||
LEGEND_FILTERS: "Filtres"
|
||||
BUTTON_ADD_SCRIPT: "Ajouter un Script"
|
||||
BUTTON_DELETE: "Effacer"
|
||||
SUBNAME_NONE: "Aucun"
|
||||
SUBNAME_MOVE_TO: "Déplacer vers \"%FOLDER%\""
|
||||
|
|
|
|||
|
|
@ -439,6 +439,7 @@ nl_NL:
|
|||
BUTTON_BACK: "Terug"
|
||||
SETTINGS_FILTERS:
|
||||
LEGEND_FILTERS: "Filters"
|
||||
BUTTON_ADD_SCRIPT: "Script toevoegen"
|
||||
BUTTON_DELETE: "Verwijder"
|
||||
SUBNAME_NONE: "Geen"
|
||||
SUBNAME_MOVE_TO: "Verplaats naar map \"%FOLDER%\""
|
||||
|
|
|
|||
|
|
@ -438,6 +438,7 @@ zh_CN:
|
|||
BUTTON_BACK: "返回"
|
||||
SETTINGS_FILTERS:
|
||||
LEGEND_FILTERS: "筛选器"
|
||||
BUTTON_ADD_SCRIPT: "Add a Script"
|
||||
BUTTON_DELETE: "删除"
|
||||
SUBNAME_NONE: "无"
|
||||
SUBNAME_MOVE_TO: "移动到 \"%FOLDER%\""
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
data-bind="i18nUpdate: scripts">
|
||||
<colgroup>
|
||||
<col style="width: 30px" />
|
||||
<col style="width: 16px" />
|
||||
<col />
|
||||
<col style="width: 140px" />
|
||||
<col style="width: 1%" />
|
||||
|
|
@ -47,6 +46,11 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<a class="btn" data-bind="click: $root.addScript">
|
||||
<i class="icon-plus"></i>
|
||||
|
||||
<span class="i18n" data-i18n="SETTINGS_FILTERS/BUTTON_ADD_SCRIPT"></span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue