From 01305826695cd8393532e76b382b5f877e78a8fe Mon Sep 17 00:00:00 2001 From: billybonks Date: Thu, 30 Jun 2016 16:06:19 +0200 Subject: [PATCH 1/2] Refactor showDeleteLineItem and showDeleteItem to share code --- app/invoices/edit/controller.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/app/invoices/edit/controller.js b/app/invoices/edit/controller.js index 6aab101596..263f57c3fe 100644 --- a/app/invoices/edit/controller.js +++ b/app/invoices/edit/controller.js @@ -122,26 +122,28 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub }, showDeleteItem: function(itemToDelete, deleteFrom) { - this.send('openModal', 'dialog', Ember.Object.create({ + this.showDeleteModal(itemToDelete, Ember.Object.create({ confirmAction: 'deleteCharge', deleteFrom: deleteFrom, - title: 'Delete Charge', - message: `Are you sure you want to delete ${itemToDelete.get('name')}?`, - itemToDelete: itemToDelete, - updateButtonAction: 'confirm', - updateButtonText: 'Ok' + title: 'Delete Charge' })); }, showDeleteLineItem: function(item) { - this.send('openModal', 'dialog', Ember.Object.create({ + this.showDeleteModal(item, Ember.Object.create({ confirmAction: 'deleteLineItem', - title: 'Delete Line Item', + title: 'Delete Line Item' + })); + }, + + showDeleteModal(item, options) { + options = Ember.merge(options, Ember.Object.create({ message: `Are you sure you want to delete ${item.get('name')}?`, itemToDelete: item, updateButtonAction: 'confirm', updateButtonText: 'Ok' })); + this.send('openModal', 'dialog', options); }, showRemovePayment: function(payment) { From 836526d5f06f2f0eb54235874d97f51c82ee83f7 Mon Sep 17 00:00:00 2001 From: billybonks Date: Thu, 30 Jun 2016 18:29:30 +0200 Subject: [PATCH 2/2] translate ok button --- app/invoices/edit/controller.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/invoices/edit/controller.js b/app/invoices/edit/controller.js index 263f57c3fe..5510e0e207 100644 --- a/app/invoices/edit/controller.js +++ b/app/invoices/edit/controller.js @@ -141,7 +141,7 @@ export default AbstractEditController.extend(NumberFormat, PatientSubmodule, Pub message: `Are you sure you want to delete ${item.get('name')}?`, itemToDelete: item, updateButtonAction: 'confirm', - updateButtonText: 'Ok' + updateButtonText: this.get('i18n').t('buttons.ok') })); this.send('openModal', 'dialog', options); },