From 7f5136120d8e3cd2070f77a370fe1a7d0b493ade Mon Sep 17 00:00:00 2001 From: Keivan Beigi Date: Wed, 11 Sep 2013 16:42:39 -0700 Subject: [PATCH] fixed series actions --- UI/Series/Details/InfoView.js | 6 +++- UI/Series/Details/SeriesDetailsLayout.js | 30 +++++++------------- UI/Series/Details/SeriesDetailsTemplate.html | 4 +-- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/UI/Series/Details/InfoView.js b/UI/Series/Details/InfoView.js index c3b5a6a31..60389b17d 100644 --- a/UI/Series/Details/InfoView.js +++ b/UI/Series/Details/InfoView.js @@ -5,6 +5,10 @@ define( ], function (Marionette) { return Marionette.ItemView.extend({ - template: 'Series/Details/InfoViewTemplate' + template: 'Series/Details/InfoViewTemplate', + + initialize: function () { + this.listenTo(this.model, 'change', this.render); + } }); }); diff --git a/UI/Series/Details/SeriesDetailsLayout.js b/UI/Series/Details/SeriesDetailsLayout.js index eed270d82..4067584d9 100644 --- a/UI/Series/Details/SeriesDetailsLayout.js +++ b/UI/Series/Details/SeriesDetailsLayout.js @@ -44,11 +44,7 @@ define( initialize: function () { $('body').addClass('backdrop'); - this.listenTo(this.model, 'sync', function () { - this._setMonitoredState(); - this._showInfo(); - }, this); - + this.listenTo(this.model, 'change:monitored', this._setMonitoredState); this.listenTo(App.vent, App.Events.SeriesDeleted, this._onSeriesDeleted); this.listenTo(App.vent, App.Events.SeasonRenamed, this._onSeasonRenamed); }, @@ -68,28 +64,27 @@ define( this._showInfo(); - }, - onRender: function(){ + onRender: function () { Actioneer.bindToCommand({ element: this.ui.refresh, command: { - name : 'refreshSeries' + name: 'refreshSeries' } }); Actioneer.bindToCommand({ element: this.ui.search, command: { - name : 'seriesSearch' + name: 'seriesSearch' } }); Actioneer.bindToCommand({ element: this.ui.rename, command: { - name : 'renameSeries' + name: 'renameSeries' } }); }, @@ -116,22 +111,19 @@ define( }, _toggleMonitored: function () { - var name = 'monitored'; - this.model.set(name, !this.model.get(name), { silent: true }); - - Actioneer.SaveModel({ - context: this, - element: this.ui.monitored, - always : this._setMonitoredState() + var savePromise = this.model.save('monitored', !this.model.get('monitored'), { + wait: true }); + + this.ui.monitored.spinForPromise(savePromise); }, _setMonitoredState: function () { var monitored = this.model.get('monitored'); - this.ui.monitored.removeClass('icon-spin icon-spinner'); + this.ui.monitored.removeAttr('data-idle-icon'); - if (this.model.get('monitored')) { + if (monitored) { this.ui.monitored.addClass('icon-nd-monitored'); this.ui.monitored.removeClass('icon-nd-unmonitored'); } diff --git a/UI/Series/Details/SeriesDetailsTemplate.html b/UI/Series/Details/SeriesDetailsTemplate.html index 5ac65378c..1aa4ed9fe 100644 --- a/UI/Series/Details/SeriesDetailsTemplate.html +++ b/UI/Series/Details/SeriesDetailsTemplate.html @@ -2,7 +2,7 @@

- + {{title}}
@@ -14,7 +14,7 @@ -
+