Moved SeasonFolderFormat to NamingConfig

Moved UseSeasonFolder to UI only (add series)
This commit is contained in:
Mark McDowall 2013-11-20 21:34:38 -08:00
parent 9d94c4490f
commit 3db97e9d11
18 changed files with 147 additions and 112 deletions

View file

@ -22,6 +22,7 @@ define(
ui: {
qualityProfile: '.x-quality-profile',
rootFolder : '.x-root-folder',
seasonFolder : '.x-season-folder',
addButton : '.x-add',
overview : '.x-overview',
startingSeason: '.x-starting-season'
@ -30,7 +31,8 @@ define(
events: {
'click .x-add' : '_addSeries',
'change .x-quality-profile': '_qualityProfileChanged',
'change .x-root-folder' : '_rootFolderChanged'
'change .x-root-folder' : '_rootFolderChanged',
'change .x-season-folder' : '_seasonFolderChanged'
},
initialize: function () {
@ -51,6 +53,7 @@ define(
var defaultQuality = Config.getValue(Config.Keys.DefaultQualityProfileId);
var defaultRoot = Config.getValue(Config.Keys.DefaultRootFolderId);
var useSeasonFolder = Config.getValueBoolean(Config.Keys.UseSeasonFolder, true);
if (QualityProfiles.get(defaultQuality)) {
this.ui.qualityProfile.val(defaultQuality);
@ -60,6 +63,8 @@ define(
this.ui.rootFolder.val(defaultRoot);
}
this.ui.seasonFolder.prop('checked', useSeasonFolder);
var minSeasonNotZero = _.min(_.reject(this.model.get('seasons'), { seasonNumber: 0 }), 'seasonNumber');
if (minSeasonNotZero) {
@ -91,15 +96,24 @@ define(
if (options.key === Config.Keys.DefaultQualityProfileId) {
this.ui.qualityProfile.val(options.value);
}
else if (options.key === Config.Keys.DefaultRootFolderId) {
this.ui.rootFolder.val(options.value);
}
else if (options.key === Config.Keys.UseSeasonFolder) {
this.ui.seasonFolder.prop('checked', options.value);
}
},
_qualityProfileChanged: function () {
Config.setValue(Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val());
},
_seasonFolderChanged: function () {
Config.setValue(Config.Keys.UseSeasonFolder, this.ui.seasonFolder.prop('checked'));
},
_rootFolderChanged: function () {
var rootFolderValue = this.ui.rootFolder.val();
if (rootFolderValue === 'addNew') {
@ -125,16 +139,17 @@ define(
var quality = this.ui.qualityProfile.val();
var rootFolderPath = this.ui.rootFolder.children(':selected').text();
var startingSeason = this.ui.startingSeason.val();
var seasonFolder = this.ui.seasonFolder.prop('checked');
this.model.set('qualityProfileId', quality);
this.model.set('rootFolderPath', rootFolderPath);
this.model.setSeasonPass(startingSeason);
this.model.set('seasonFolder', seasonFolder);
var self = this;
SeriesCollection.add(this.model);
var promise = this.model.save();
promise.done(function () {
@ -159,7 +174,6 @@ define(
}
});
AsValidatedView.apply(view);
return view;