Rename series added

This commit is contained in:
Mark McDowall 2013-07-18 22:23:04 -07:00
commit 637b101975
13 changed files with 233 additions and 19 deletions

View file

@ -54,6 +54,15 @@
color : @errorText;
}
.icon-nd-spinner:before {
.icon(@spinner);
.icon-spin;
}
.icon-nd-rename:before {
.icon(@pencil)
}
.icon-nd-add:before {
.icon(@plus);
}

View file

@ -15,12 +15,14 @@ define(
ui: {
seasonSearch : '.x-season-search',
seasonMonitored: '.x-season-monitored'
seasonMonitored: '.x-season-monitored',
seasonRename : '.x-season-rename'
},
events: {
'click .x-season-search' : '_seasonSearch',
'click .x-season-monitored': '_seasonMonitored'
'click .x-season-monitored': '_seasonMonitored',
'click .x-season-rename' : '_seasonRename'
},
regions: {
@ -151,6 +153,40 @@ define(
this.ui.seasonMonitored.addClass('icon-bookmark-empty');
this.ui.seasonMonitored.removeClass('icon-bookmark');
}
},
_seasonRename: function () {
var command = 'renameSeason';
this.idle = false;
this.ui.seasonRename.toggleClass('icon-nd-rename icon-nd-spinner');
var properties = {
seriesId : this.model.get('seriesId'),
seasonNumber: this.model.get('seasonNumber')
};
var self = this;
var commandPromise = CommandController.Execute(command, properties);
commandPromise.fail(function (options) {
if (options.readyState === 0 || options.status === 0) {
return;
}
Messenger.show({
message: 'Season rename failed',
type : 'error'
});
});
commandPromise.always(function () {
if (!self.isClosed) {
self.ui.seasonRename.toggleClass('icon-nd-rename icon-nd-spinner');
self.idle = true;
}
});
}
});
});

View file

@ -2,11 +2,12 @@
<h2>
<i class="x-season-monitored clickable" title="Toggle season monitored status"/>
{{#if seasonNumber}}
Season {{seasonNumber}}
Season {{seasonNumber}}
{{else}}
Specials
Specials
{{/if}}
<span class="season-actions pull-right">
<i class="icon-nd-rename x-season-rename" title="Rename all episodes in season {{seasonNumber}}"/>
<i class="icon-search x-season-search" title="Search for all episodes in season {{seasonNumber}}"/>
</span>
</h2>

View file

@ -24,13 +24,15 @@ define(
header : '.x-header',
monitored: '.x-monitored',
edit : '.x-edit',
refresh : '.x-refresh'
refresh : '.x-refresh',
rename : '.x-rename'
},
events: {
'click .x-monitored': '_toggleMonitored',
'click .x-edit' : '_editSeries',
'click .x-refresh' : '_refreshSeries'
'click .x-refresh' : '_refreshSeries',
'click .x-rename' : '_renameSeries'
},
initialize: function () {
@ -136,6 +138,39 @@ define(
if (this.model.get('id') === event.series.get('id')) {
App.Router.navigate('/', { trigger: true });
}
},
_renameSeries: function () {
var command = 'renameSeries';
this.idle = false;
this.ui.rename.toggleClass('icon-nd-rename icon-nd-spinner');
var properties = {
seriesId : this.model.get('id')
};
var self = this;
var commandPromise = CommandController.Execute(command, properties);
commandPromise.fail(function (options) {
if (options.readyState === 0 || options.status === 0) {
return;
}
Messenger.show({
message: 'Season rename failed',
type : 'error'
});
});
commandPromise.always(function () {
if (!self.isClosed) {
self.ui.rename.toggleClass('icon-nd-rename icon-nd-spinner');
self.idle = true;
}
});
}
});
});

View file

@ -5,6 +5,7 @@
<i class="icon-bookmark x-monitored clickable" title="Toggle monitored state for entire series"/>
{{title}}
<span class="series-actions pull-right">
<i class="icon-nd-rename x-rename" title="Rename Series"/>
<i class="icon-refresh x-refresh" title="Update Series"/>
<i class="icon-nd-edit x-edit" title="Edit series"/>
</span>