mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-20 21:16:56 +00:00
A little formating on add series
This commit is contained in:
parent
61e8e180fc
commit
6ea0b16585
5 changed files with 51 additions and 50 deletions
|
@ -8,8 +8,15 @@ define(
|
||||||
'AddSeries/AddSeriesView',
|
'AddSeries/AddSeriesView',
|
||||||
'Quality/QualityProfileCollection',
|
'Quality/QualityProfileCollection',
|
||||||
'AddSeries/RootFolders/Collection',
|
'AddSeries/RootFolders/Collection',
|
||||||
'Series/SeriesCollection',
|
'Series/SeriesCollection'
|
||||||
], function (App, Marionette, RootFolderLayout, ExistingSeriesCollectionView, AddSeriesView, qualityProfileCollection, rootFolderCollection, SeriesCollection) {
|
], function (App,
|
||||||
|
Marionette,
|
||||||
|
RootFolderLayout,
|
||||||
|
ExistingSeriesCollectionView,
|
||||||
|
AddSeriesView,
|
||||||
|
QualityProfileCollection,
|
||||||
|
RootFolderCollection,
|
||||||
|
SeriesCollection) {
|
||||||
|
|
||||||
return Marionette.Layout.extend({
|
return Marionette.Layout.extend({
|
||||||
template: 'AddSeries/AddSeriesLayoutTemplate',
|
template: 'AddSeries/AddSeriesLayoutTemplate',
|
||||||
|
@ -30,12 +37,11 @@ define(
|
||||||
initialize: function () {
|
initialize: function () {
|
||||||
|
|
||||||
SeriesCollection.fetch();
|
SeriesCollection.fetch();
|
||||||
|
QualityProfileCollection.fetch();
|
||||||
|
RootFolderCollection.fetch();
|
||||||
|
|
||||||
this.rootFolderLayout = new RootFolderLayout();
|
this.rootFolderLayout = new RootFolderLayout();
|
||||||
this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
|
this.rootFolderLayout.on('folderSelected', this._folderSelected, this);
|
||||||
|
|
||||||
qualityProfileCollection.fetch();
|
|
||||||
rootFolderCollection.fetch();
|
|
||||||
},
|
},
|
||||||
|
|
||||||
onShow: function () {
|
onShow: function () {
|
||||||
|
|
|
@ -44,7 +44,6 @@ define(
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
_onSeriesAdded: function (options) {
|
_onSeriesAdded: function (options) {
|
||||||
if (options.series.get('path') === this.model.get('folder').path) {
|
if (options.series.get('path') === this.model.get('folder').path) {
|
||||||
this.close();
|
this.close();
|
||||||
|
@ -54,7 +53,6 @@ define(
|
||||||
onRender: function () {
|
onRender: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
|
|
||||||
this.$el.addClass(this.className);
|
this.$el.addClass(this.className);
|
||||||
|
|
||||||
this.ui.seriesSearch.data('timeout', null).keyup(function () {
|
this.ui.seriesSearch.data('timeout', null).keyup(function () {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<select class="span6 x-root-folder">
|
<select class="span6 x-root-folder">
|
||||||
{{#each this}}
|
{{#each this}}
|
||||||
<option value="{{id}}">{{path}}</option>
|
<option value="{{id}}">{{path}}</option>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<option value="addNew">Add a different path</option>
|
<option value="addNew">Add a different path</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -16,20 +16,20 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{{#if existing}}
|
{{#if existing}}
|
||||||
<div class="btn pull-right add-series disabled">
|
<div class="btn pull-right add-series disabled">
|
||||||
Already Exists
|
Already Exists
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="btn btn-success x-add pull-right add-series">
|
<div class="btn btn-success x-add pull-right add-series">
|
||||||
Add
|
Add
|
||||||
<icon class="icon-plus"></icon>
|
<icon class="icon-plus"></icon>
|
||||||
</div>
|
</div>
|
||||||
{{#unless path}}
|
{{#unless path}}
|
||||||
{{> RootFolderSelectionPartial rootFolders}}
|
{{> RootFolderSelectionPartial rootFolders}}
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
<div class='pull-right'>
|
<div class='pull-right'>
|
||||||
{{> QualityProfileSelectionPartial qualityProfiles}}
|
{{> QualityProfileSelectionPartial qualityProfiles}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -36,6 +36,32 @@ define(
|
||||||
this.listenTo(this.model, 'change', this.render);
|
this.listenTo(this.model, 'change', this.render);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onRender: function () {
|
||||||
|
|
||||||
|
var defaultQuality = Config.GetValue(Config.Keys.DefaultQualityProfileId);
|
||||||
|
|
||||||
|
if (QualityProfiles.get(defaultQuality)) {
|
||||||
|
this.ui.qualityProfile.val(defaultQuality);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
serializeData: function () {
|
||||||
|
var data = this.model.toJSON();
|
||||||
|
|
||||||
|
var existingSeries = SeriesCollection.where({tvdbId: this.model.get('tvdbId')});
|
||||||
|
|
||||||
|
if (existingSeries.length > 0) {
|
||||||
|
data.existing = existingSeries[0].toJSON();
|
||||||
|
}
|
||||||
|
|
||||||
|
data.qualityProfiles = QualityProfiles.toJSON();
|
||||||
|
|
||||||
|
if (!data.isExisting) {
|
||||||
|
data.rootFolders = RootFolders.toJSON();
|
||||||
|
}
|
||||||
|
|
||||||
|
return data;
|
||||||
|
},
|
||||||
|
|
||||||
_onConfigUpdated: function (options) {
|
_onConfigUpdated: function (options) {
|
||||||
|
|
||||||
|
@ -48,15 +74,6 @@ define(
|
||||||
Config.SetValue(Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val());
|
Config.SetValue(Config.Keys.DefaultQualityProfileId, this.ui.qualityProfile.val());
|
||||||
},
|
},
|
||||||
|
|
||||||
onRender: function () {
|
|
||||||
|
|
||||||
var defaultQuality = Config.GetValue(Config.Keys.DefaultQualityProfileId);
|
|
||||||
|
|
||||||
if (QualityProfiles.get(defaultQuality)) {
|
|
||||||
this.ui.qualityProfile.val(defaultQuality);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_addSeries: function () {
|
_addSeries: function () {
|
||||||
var icon = this.ui.addButton.find('icon');
|
var icon = this.ui.addButton.find('icon');
|
||||||
icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled');
|
icon.removeClass('icon-plus').addClass('icon-spin icon-spinner disabled');
|
||||||
|
@ -83,26 +100,6 @@ define(
|
||||||
}).fail(function () {
|
}).fail(function () {
|
||||||
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
icon.removeClass('icon-spin icon-spinner disabled').addClass('icon-search');
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
serializeData: function () {
|
|
||||||
var data = this.model.toJSON();
|
|
||||||
|
|
||||||
var existingSeries = SeriesCollection.where({tvdbId: this.model.get('tvdbId')});
|
|
||||||
|
|
||||||
if (existingSeries.length > 0) {
|
|
||||||
data.existing = existingSeries[0].toJSON();
|
|
||||||
}
|
|
||||||
|
|
||||||
data.qualityProfiles = QualityProfiles.toJSON();
|
|
||||||
|
|
||||||
if (!data.isExisting) {
|
|
||||||
data.rootFolders = RootFolders.toJSON();
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue