Added confirm dialog for starred expression remove links #501 (#3436)

* Updated 'remove' link for starred expressions to include a confirm dialog

* bring remove expression dialog dismissal inline with other dialog dismissal

* Changed 'unstar expression?' in translation-en.json to allow better translation.

* Update main/webapp/modules/core/langs/translation-en.json

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>

Co-authored-by: Antonin Delpeuch <antonin@delpeuch.eu>
This commit is contained in:
Cameron Bedard 2021-01-02 03:46:24 -05:00 committed by GitHub
parent 2690a0ee03
commit c6b6616f01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 9 deletions

View File

@ -244,6 +244,7 @@
"core-dialogs/sql-exporter": "SQL Exporter",
"core-dialogs/custom-tab-exp": "Custom Tabular Exporter",
"core-dialogs/select-columns-dialog": "Select columns",
"core-dialogs/unstar-expression": "Unstar expression?",
"core-dialogs/content": "Content",
"core-dialogs/download": "Download",
"core-dialogs/upload": "Upload",

View File

@ -350,15 +350,30 @@ ExpressionPreviewDialog.Widget.prototype._renderStarredExpressions = function(da
var o = Scripting.parse(entry.code);
$('<a href="javascript:{}">'+$.i18n('core-dialogs/remove')+'</a>').appendTo(tr.insertCell(0)).click(function() {
Refine.postCSRF(
"command/core/toggle-starred-expression",
{ expression: entry.code, returnList: true },
function(data) {
self._renderStarredExpressions(data);
self._renderExpressionHistoryTab();
},
"json"
);
var removeExpression = DialogSystem.createDialog();
removeExpression.width("250px");
var removeExpressionHead = $('<div></div>').addClass("dialog-header").text($.i18n('core-dialogs/unstar-expression'))
.appendTo(removeExpression);
var removeExpressionFooter = $('<div></div>').addClass("dialog-footer").appendTo(removeExpression);
$('<button class="button"></button>').html($.i18n('core-buttons/ok')).click(function() {
Refine.postCSRF(
"command/core/toggle-starred-expression",
{ expression: entry.code, returnList: true },
function(data) {
self._renderStarredExpressions(data);
self._renderExpressionHistoryTab();
},
"json"
);
DialogSystem.dismissUntil(DialogSystem._layers.length - 1);
}).appendTo(removeExpressionFooter);
$('<button class="button" style="float:right;"></button>').text($.i18n('core-buttons/cancel')).click(function() {
DialogSystem.dismissUntil(DialogSystem._layers.length - 1);
}).appendTo(removeExpressionFooter);
this._level = DialogSystem.showDialog(removeExpression);
});
$('<a href="javascript:{}">Reuse</a>').appendTo(tr.insertCell(1)).click(function() {