From 20a6707144ef93ca7f894f7e7856bd72b972aca0 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 13 Nov 2015 14:16:50 -0700 Subject: [PATCH] Refactor delete button Fixes #50 --- app/pods/components/delete-button/component.js | 7 +++++-- app/pods/components/delete-button/template.hbs | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/pods/components/delete-button/component.js b/app/pods/components/delete-button/component.js index 2ceca5b..1cd364a 100644 --- a/app/pods/components/delete-button/component.js +++ b/app/pods/components/delete-button/component.js @@ -2,10 +2,13 @@ import Ember from 'ember'; export default Ember.Component.extend({ tagName: 'button', - classNames: ["button-red", "smaller"], + classNames: ["button-red", "smaller", "delete"], + showConfirmDelete: false, click: function() { - if (window.confirm("Do you really want to delete this?")) { + if (!this.get('showConfirmDelete')) { + this.set('showConfirmDelete', true); + } else { this.attrs.delete(); } }, diff --git a/app/pods/components/delete-button/template.hbs b/app/pods/components/delete-button/template.hbs index 4b2e04f..de6c612 100644 --- a/app/pods/components/delete-button/template.hbs +++ b/app/pods/components/delete-button/template.hbs @@ -1 +1,5 @@ -Delete +{{#if showConfirmDelete}} + Are you sure? +{{else}} + Delete +{{/if}}