From 6c5a5340b8475ecda4b973c6ba097c7b1b90b7f2 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 25 Apr 2014 21:22:44 -0700 Subject: [PATCH] Fixed: Back/Cancel on add notification won't break saving settings --- .../Settings/Notifications/NotificationEditView.js | 12 ++++++++++++ .../Notifications/NotificationEditViewTemplate.html | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/UI/Settings/Notifications/NotificationEditView.js b/src/UI/Settings/Notifications/NotificationEditView.js index 161ebde96..f36caa448 100644 --- a/src/UI/Settings/Notifications/NotificationEditView.js +++ b/src/UI/Settings/Notifications/NotificationEditView.js @@ -27,6 +27,7 @@ define( 'click .x-delete' : '_deleteNotification', 'click .x-back' : '_back', 'click .x-test' : '_test', + 'click .x-cancel' : '_cancel', 'change .x-on-download': '_onDownloadChanged' }, @@ -63,12 +64,23 @@ define( } }, + _cancel: function () { + if (this.model.isNew()) { + this.model.destroy(); + vent.trigger(vent.Commands.CloseModalCommand); + } + }, + _deleteNotification: function () { var view = new DeleteView({ model: this.model }); AppLayout.modalRegion.show(view); }, _back: function () { + if (this.model.isNew()) { + this.model.destroy(); + } + require('Settings/Notifications/SchemaModal').open(this.notificationCollection); }, diff --git a/src/UI/Settings/Notifications/NotificationEditViewTemplate.html b/src/UI/Settings/Notifications/NotificationEditViewTemplate.html index e6abfa829..1676b8755 100644 --- a/src/UI/Settings/Notifications/NotificationEditViewTemplate.html +++ b/src/UI/Settings/Notifications/NotificationEditViewTemplate.html @@ -87,7 +87,7 @@ {{/if}} - +