From eb543ce14f76711f7c17ed45c9784665cb63dc90 Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Thu, 6 Aug 2015 16:19:42 -0400 Subject: [PATCH] (js) Allow to change the labels of Dialog.confirm --- UI/WebServerResources/js/Common/Dialog.service.js | 6 +++--- UI/WebServerResources/js/Contacts/CardController.js | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/UI/WebServerResources/js/Common/Dialog.service.js b/UI/WebServerResources/js/Common/Dialog.service.js index 4544dfaf4..dc290a021 100644 --- a/UI/WebServerResources/js/Common/Dialog.service.js +++ b/UI/WebServerResources/js/Common/Dialog.service.js @@ -31,12 +31,12 @@ * @param {string} content * @returns a promise that resolves if the user has clicked on the 'OK' button */ - Dialog.confirm = function(title, content) { + Dialog.confirm = function(title, content, options) { var confirm = this.$modal.confirm() .title(title) .content(content) - .ok(l('OK')) - .cancel(l('Cancel')); + .ok((options && options.ok)? options.ok : l('OK')) + .cancel((options && options.cancel)? options.cancel : l('Cancel')); return this.$modal.show(confirm); }; diff --git a/UI/WebServerResources/js/Contacts/CardController.js b/UI/WebServerResources/js/Contacts/CardController.js index feb865458..78a77c51b 100644 --- a/UI/WebServerResources/js/Contacts/CardController.js +++ b/UI/WebServerResources/js/Contacts/CardController.js @@ -99,7 +99,8 @@ } function confirmDelete(card) { Dialog.confirm(l('Warning'), - l('Are you sure you want to delete the card of %{0}?', card.$fullname())) + l('Are you sure you want to delete the card of %{0}?', card.$fullname()), + {ok: l('Yes'), cancel: l('No')}) .then(function() { // User confirmed the deletion card.$delete()