fixed series actions

This commit is contained in:
Keivan Beigi 2013-09-11 16:42:39 -07:00
parent 578808ecd3
commit 7f5136120d
3 changed files with 18 additions and 22 deletions

View File

@ -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);
}
});
});

View File

@ -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');
}

View File

@ -2,7 +2,7 @@
<div class="span11">
<div class="row">
<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}}
<div class="series-actions pull-right">
<div class="x-refresh">
@ -14,7 +14,7 @@
<div class="x-search">
<i class="icon-search" title="Search for all episodes in this series"/>
</div>
<div>
<div class="x-edit">
<i class="icon-nd-edit" title="Edit series"/>
</div>