Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Commit

Permalink
Small refactor (#541)
Browse files Browse the repository at this point in the history
* Refactor showDeleteLineItem and showDeleteItem to share code

* translate ok button
  • Loading branch information
billybonks authored and jkleinsc committed Jul 6, 2016
1 parent 26cfe1d commit b87dea0
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/invoices/edit/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
updateButtonText: this.get('i18n').t('buttons.ok')
}));
this.send('openModal', 'dialog', options);
},

showRemovePayment: function(payment) {
Expand Down

0 comments on commit b87dea0

Please sign in to comment.