fixed series actions

pull/30/head
Keivan Beigi 11 years ago
parent 578808ecd3
commit 7f5136120d

@ -5,6 +5,10 @@ define(
], function (Marionette) { ], function (Marionette) {
return Marionette.ItemView.extend({ return Marionette.ItemView.extend({
template: 'Series/Details/InfoViewTemplate' template: 'Series/Details/InfoViewTemplate',
initialize: function () {
this.listenTo(this.model, 'change', this.render);
}
}); });
}); });

@ -44,11 +44,7 @@ define(
initialize: function () { initialize: function () {
$('body').addClass('backdrop'); $('body').addClass('backdrop');
this.listenTo(this.model, 'sync', function () { this.listenTo(this.model, 'change:monitored', this._setMonitoredState);
this._setMonitoredState();
this._showInfo();
}, this);
this.listenTo(App.vent, App.Events.SeriesDeleted, this._onSeriesDeleted); this.listenTo(App.vent, App.Events.SeriesDeleted, this._onSeriesDeleted);
this.listenTo(App.vent, App.Events.SeasonRenamed, this._onSeasonRenamed); this.listenTo(App.vent, App.Events.SeasonRenamed, this._onSeasonRenamed);
}, },
@ -68,28 +64,27 @@ define(
this._showInfo(); this._showInfo();
}, },
onRender: function(){ onRender: function () {
Actioneer.bindToCommand({ Actioneer.bindToCommand({
element: this.ui.refresh, element: this.ui.refresh,
command: { command: {
name : 'refreshSeries' name: 'refreshSeries'
} }
}); });
Actioneer.bindToCommand({ Actioneer.bindToCommand({
element: this.ui.search, element: this.ui.search,
command: { command: {
name : 'seriesSearch' name: 'seriesSearch'
} }
}); });
Actioneer.bindToCommand({ Actioneer.bindToCommand({
element: this.ui.rename, element: this.ui.rename,
command: { command: {
name : 'renameSeries' name: 'renameSeries'
} }
}); });
}, },
@ -116,22 +111,19 @@ define(
}, },
_toggleMonitored: function () { _toggleMonitored: function () {
var name = 'monitored'; var savePromise = this.model.save('monitored', !this.model.get('monitored'), {
this.model.set(name, !this.model.get(name), { silent: true }); wait: true
Actioneer.SaveModel({
context: this,
element: this.ui.monitored,
always : this._setMonitoredState()
}); });
this.ui.monitored.spinForPromise(savePromise);
}, },
_setMonitoredState: function () { _setMonitoredState: function () {
var monitored = this.model.get('monitored'); 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.addClass('icon-nd-monitored');
this.ui.monitored.removeClass('icon-nd-unmonitored'); this.ui.monitored.removeClass('icon-nd-unmonitored');
} }

@ -2,7 +2,7 @@
<div class="span11"> <div class="span11">
<div class="row"> <div class="row">
<h1> <h1>
<i class="icon-bookmark x-monitored clickable" title="Toggle monitored state for entire series"/> <i class="x-monitored clickable series-monitor-toggle" title="Toggle monitored state for entire series"/>
{{title}} {{title}}
<div class="series-actions pull-right"> <div class="series-actions pull-right">
<div class="x-refresh"> <div class="x-refresh">
@ -14,7 +14,7 @@
<div class="x-search"> <div class="x-search">
<i class="icon-search" title="Search for all episodes in this series"/> <i class="icon-search" title="Search for all episodes in this series"/>
</div> </div>
<div> <div class="x-edit">
<i class="icon-nd-edit" title="Edit series"/> <i class="icon-nd-edit" title="Edit series"/>
</div> </div>

Loading…
Cancel
Save