From c4fc3e77b39e586c233a04ef5602a11e57ae8c6d Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 29 Jan 2014 20:58:35 -0800 Subject: [PATCH] Cancelling quality profile editing will refetch it from the server --- .../Profile/Edit/EditQualityProfileLayout.js | 18 +++++++++++++++++- .../Edit/EditQualityProfileLayoutTemplate.html | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/UI/Settings/Quality/Profile/Edit/EditQualityProfileLayout.js b/src/UI/Settings/Quality/Profile/Edit/EditQualityProfileLayout.js index 48eb0b1f4..1ef9825d5 100644 --- a/src/UI/Settings/Quality/Profile/Edit/EditQualityProfileLayout.js +++ b/src/UI/Settings/Quality/Profile/Edit/EditQualityProfileLayout.js @@ -20,7 +20,8 @@ define( }, events: { - 'click .x-save': '_saveQualityProfile' + 'click .x-save' : '_saveQualityProfile', + 'click .x-cancel': '_cancelQualityProfile' }, initialize: function (options) { @@ -85,6 +86,21 @@ define( } }, + _cancelQualityProfile: function () { + if (!this.model.has('id')) { + vent.trigger(vent.Commands.CloseModalCommand); + return; + } + + var promise = this.model.fetch(); + + if (promise) { + promise.done(function () { + vent.trigger(vent.Commands.CloseModalCommand); + }); + } + }, + _showFieldsView: function () { this.fields.show(this.fieldsView); } diff --git a/src/UI/Settings/Quality/Profile/Edit/EditQualityProfileLayoutTemplate.html b/src/UI/Settings/Quality/Profile/Edit/EditQualityProfileLayoutTemplate.html index 4c10d0b0f..1cbfffda2 100644 --- a/src/UI/Settings/Quality/Profile/Edit/EditQualityProfileLayoutTemplate.html +++ b/src/UI/Settings/Quality/Profile/Edit/EditQualityProfileLayoutTemplate.html @@ -1,5 +1,5 @@