mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-26 22:46:53 -04:00
UI Cleanup - Updated Settings subtree.
This commit is contained in:
@@ -5,15 +5,19 @@ var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
require('../../../Mixins/DirectoryAutoComplete');
|
||||
require('../../../Mixins/FileBrowser');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/MediaManagement/FileManagement/FileManagementViewTemplate',
|
||||
ui : {recyclingBin : '.x-path'},
|
||||
onShow : function(){
|
||||
this.ui.recyclingBin.fileBrowser();
|
||||
}
|
||||
});
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
return view;
|
||||
}).call(this);
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/MediaManagement/FileManagement/FileManagementViewTemplate',
|
||||
|
||||
ui : {
|
||||
recyclingBin : '.x-path'
|
||||
},
|
||||
|
||||
onShow : function() {
|
||||
this.ui.recyclingBin.fileBrowser();
|
||||
}
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
|
||||
module.exports = view;
|
||||
@@ -5,21 +5,24 @@ var FileManagementView = require('./FileManagement/FileManagementView');
|
||||
var PermissionsView = require('./Permissions/PermissionsView');
|
||||
|
||||
module.exports = Marionette.Layout.extend({
|
||||
template : 'Settings/MediaManagement/MediaManagementLayoutTemplate',
|
||||
regions : {
|
||||
template : 'Settings/MediaManagement/MediaManagementLayoutTemplate',
|
||||
|
||||
regions : {
|
||||
episodeNaming : '#episode-naming',
|
||||
sorting : '#sorting',
|
||||
fileManagement : '#file-management',
|
||||
permissions : '#permissions'
|
||||
},
|
||||
initialize : function(options){
|
||||
|
||||
initialize : function(options) {
|
||||
this.settings = options.settings;
|
||||
this.namingSettings = options.namingSettings;
|
||||
},
|
||||
onShow : function(){
|
||||
this.episodeNaming.show(new NamingView({model : this.namingSettings}));
|
||||
this.sorting.show(new SortingView({model : this.settings}));
|
||||
this.fileManagement.show(new FileManagementView({model : this.settings}));
|
||||
this.permissions.show(new PermissionsView({model : this.settings}));
|
||||
|
||||
onShow : function() {
|
||||
this.episodeNaming.show(new NamingView({ model : this.namingSettings }));
|
||||
this.sorting.show(new SortingView({ model : this.settings }));
|
||||
this.fileManagement.show(new FileManagementView({ model : this.settings }));
|
||||
this.permissions.show(new PermissionsView({ model : this.settings }));
|
||||
}
|
||||
});
|
||||
@@ -5,101 +5,114 @@ var NamingSampleModel = require('../NamingSampleModel');
|
||||
var BasicNamingModel = require('./BasicNamingModel');
|
||||
var AsModelBoundView = require('../../../../Mixins/AsModelBoundView');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/MediaManagement/Naming/Basic/BasicNamingViewTemplate',
|
||||
ui : {
|
||||
namingOptions : '.x-naming-options',
|
||||
singleEpisodeExample : '.x-single-episode-example',
|
||||
multiEpisodeExample : '.x-multi-episode-example',
|
||||
dailyEpisodeExample : '.x-daily-episode-example'
|
||||
},
|
||||
initialize : function(options){
|
||||
this.namingModel = options.model;
|
||||
this.model = new BasicNamingModel();
|
||||
this._parseNamingModel();
|
||||
this.listenTo(this.model, 'change', this._buildFormat);
|
||||
this.listenTo(this.namingModel, 'sync', this._parseNamingModel);
|
||||
},
|
||||
_parseNamingModel : function(){
|
||||
var standardFormat = this.namingModel.get('standardEpisodeFormat');
|
||||
var includeSeriesTitle = standardFormat.match(/\{Series[-_. ]Title\}/i);
|
||||
var includeEpisodeTitle = standardFormat.match(/\{Episode[-_. ]Title\}/i);
|
||||
var includeQuality = standardFormat.match(/\{Quality[-_. ]Title\}/i);
|
||||
var numberStyle = standardFormat.match(/s?\{season(?:\:0+)?\}[ex]\{episode(?:\:0+)?\}/i);
|
||||
var replaceSpaces = standardFormat.indexOf(' ') === -1;
|
||||
var separator = standardFormat.match(/\}( - |\.-\.|\.| )|( - |\.-\.|\.| )\{/i);
|
||||
if(separator === null || separator[1] === '.-.') {
|
||||
separator = ' - ';
|
||||
}
|
||||
else {
|
||||
separator = separator[1];
|
||||
}
|
||||
if(numberStyle === null) {
|
||||
numberStyle = 'S{season:00}E{episode:00}';
|
||||
}
|
||||
else {
|
||||
numberStyle = numberStyle[0];
|
||||
}
|
||||
this.model.set({
|
||||
includeSeriesTitle : includeSeriesTitle !== null,
|
||||
includeEpisodeTitle : includeEpisodeTitle !== null,
|
||||
includeQuality : includeQuality !== null,
|
||||
numberStyle : numberStyle,
|
||||
replaceSpaces : replaceSpaces,
|
||||
separator : separator
|
||||
}, {silent : true});
|
||||
},
|
||||
_buildFormat : function(){
|
||||
if(Config.getValueBoolean(Config.Keys.AdvancedSettings)) {
|
||||
return;
|
||||
}
|
||||
var standardEpisodeFormat = '';
|
||||
var dailyEpisodeFormat = '';
|
||||
if(this.model.get('includeSeriesTitle')) {
|
||||
if(this.model.get('replaceSpaces')) {
|
||||
standardEpisodeFormat += '{Series.Title}';
|
||||
dailyEpisodeFormat += '{Series.Title}';
|
||||
}
|
||||
else {
|
||||
standardEpisodeFormat += '{Series Title}';
|
||||
dailyEpisodeFormat += '{Series Title}';
|
||||
}
|
||||
standardEpisodeFormat += this.model.get('separator');
|
||||
dailyEpisodeFormat += this.model.get('separator');
|
||||
}
|
||||
standardEpisodeFormat += this.model.get('numberStyle');
|
||||
dailyEpisodeFormat += '{Air-Date}';
|
||||
if(this.model.get('includeEpisodeTitle')) {
|
||||
standardEpisodeFormat += this.model.get('separator');
|
||||
dailyEpisodeFormat += this.model.get('separator');
|
||||
if(this.model.get('replaceSpaces')) {
|
||||
standardEpisodeFormat += '{Episode.Title}';
|
||||
dailyEpisodeFormat += '{Episode.Title}';
|
||||
}
|
||||
else {
|
||||
standardEpisodeFormat += '{Episode Title}';
|
||||
dailyEpisodeFormat += '{Episode Title}';
|
||||
}
|
||||
}
|
||||
if(this.model.get('includeQuality')) {
|
||||
if(this.model.get('replaceSpaces')) {
|
||||
standardEpisodeFormat += ' {Quality.Title}';
|
||||
dailyEpisodeFormat += ' {Quality.Title}';
|
||||
}
|
||||
else {
|
||||
standardEpisodeFormat += ' {Quality Title}';
|
||||
dailyEpisodeFormat += ' {Quality Title}';
|
||||
}
|
||||
}
|
||||
if(this.model.get('replaceSpaces')) {
|
||||
standardEpisodeFormat = standardEpisodeFormat.replace(/\s/g, '.');
|
||||
dailyEpisodeFormat = dailyEpisodeFormat.replace(/\s/g, '.');
|
||||
}
|
||||
this.namingModel.set('standardEpisodeFormat', standardEpisodeFormat);
|
||||
this.namingModel.set('dailyEpisodeFormat', dailyEpisodeFormat);
|
||||
this.namingModel.set('animeEpisodeFormat', standardEpisodeFormat);
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/MediaManagement/Naming/Basic/BasicNamingViewTemplate',
|
||||
|
||||
ui : {
|
||||
namingOptions : '.x-naming-options',
|
||||
singleEpisodeExample : '.x-single-episode-example',
|
||||
multiEpisodeExample : '.x-multi-episode-example',
|
||||
dailyEpisodeExample : '.x-daily-episode-example'
|
||||
},
|
||||
|
||||
initialize : function(options) {
|
||||
this.namingModel = options.model;
|
||||
this.model = new BasicNamingModel();
|
||||
|
||||
this._parseNamingModel();
|
||||
|
||||
this.listenTo(this.model, 'change', this._buildFormat);
|
||||
this.listenTo(this.namingModel, 'sync', this._parseNamingModel);
|
||||
},
|
||||
|
||||
_parseNamingModel : function() {
|
||||
var standardFormat = this.namingModel.get('standardEpisodeFormat');
|
||||
|
||||
var includeSeriesTitle = standardFormat.match(/\{Series[-_. ]Title\}/i);
|
||||
var includeEpisodeTitle = standardFormat.match(/\{Episode[-_. ]Title\}/i);
|
||||
var includeQuality = standardFormat.match(/\{Quality[-_. ]Title\}/i);
|
||||
var numberStyle = standardFormat.match(/s?\{season(?:\:0+)?\}[ex]\{episode(?:\:0+)?\}/i);
|
||||
var replaceSpaces = standardFormat.indexOf(' ') === -1;
|
||||
var separator = standardFormat.match(/\}( - |\.-\.|\.| )|( - |\.-\.|\.| )\{/i);
|
||||
|
||||
if (separator === null || separator[1] === '.-.') {
|
||||
separator = ' - ';
|
||||
} else {
|
||||
separator = separator[1];
|
||||
}
|
||||
});
|
||||
return AsModelBoundView.call(view);
|
||||
}).call(this);
|
||||
|
||||
if (numberStyle === null) {
|
||||
numberStyle = 'S{season:00}E{episode:00}';
|
||||
} else {
|
||||
numberStyle = numberStyle[0];
|
||||
}
|
||||
|
||||
this.model.set({
|
||||
includeSeriesTitle : includeSeriesTitle !== null,
|
||||
includeEpisodeTitle : includeEpisodeTitle !== null,
|
||||
includeQuality : includeQuality !== null,
|
||||
numberStyle : numberStyle,
|
||||
replaceSpaces : replaceSpaces,
|
||||
separator : separator
|
||||
}, { silent : true });
|
||||
},
|
||||
|
||||
_buildFormat : function() {
|
||||
if (Config.getValueBoolean(Config.Keys.AdvancedSettings)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var standardEpisodeFormat = '';
|
||||
var dailyEpisodeFormat = '';
|
||||
|
||||
if (this.model.get('includeSeriesTitle')) {
|
||||
if (this.model.get('replaceSpaces')) {
|
||||
standardEpisodeFormat += '{Series.Title}';
|
||||
dailyEpisodeFormat += '{Series.Title}';
|
||||
} else {
|
||||
standardEpisodeFormat += '{Series Title}';
|
||||
dailyEpisodeFormat += '{Series Title}';
|
||||
}
|
||||
|
||||
standardEpisodeFormat += this.model.get('separator');
|
||||
dailyEpisodeFormat += this.model.get('separator');
|
||||
}
|
||||
|
||||
standardEpisodeFormat += this.model.get('numberStyle');
|
||||
dailyEpisodeFormat += '{Air-Date}';
|
||||
|
||||
if (this.model.get('includeEpisodeTitle')) {
|
||||
standardEpisodeFormat += this.model.get('separator');
|
||||
dailyEpisodeFormat += this.model.get('separator');
|
||||
|
||||
if (this.model.get('replaceSpaces')) {
|
||||
standardEpisodeFormat += '{Episode.Title}';
|
||||
dailyEpisodeFormat += '{Episode.Title}';
|
||||
} else {
|
||||
standardEpisodeFormat += '{Episode Title}';
|
||||
dailyEpisodeFormat += '{Episode Title}';
|
||||
}
|
||||
}
|
||||
|
||||
if (this.model.get('includeQuality')) {
|
||||
if (this.model.get('replaceSpaces')) {
|
||||
standardEpisodeFormat += ' {Quality.Title}';
|
||||
dailyEpisodeFormat += ' {Quality.Title}';
|
||||
} else {
|
||||
standardEpisodeFormat += ' {Quality Title}';
|
||||
dailyEpisodeFormat += ' {Quality Title}';
|
||||
}
|
||||
}
|
||||
|
||||
if (this.model.get('replaceSpaces')) {
|
||||
standardEpisodeFormat = standardEpisodeFormat.replace(/\s/g, '.');
|
||||
dailyEpisodeFormat = dailyEpisodeFormat.replace(/\s/g, '.');
|
||||
}
|
||||
|
||||
this.namingModel.set('standardEpisodeFormat', standardEpisodeFormat);
|
||||
this.namingModel.set('dailyEpisodeFormat', dailyEpisodeFormat);
|
||||
this.namingModel.set('animeEpisodeFormat', standardEpisodeFormat);
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = AsModelBoundView.call(view);
|
||||
@@ -1,3 +1,3 @@
|
||||
var Backbone = require('backbone');
|
||||
|
||||
module.exports = Backbone.Model.extend({url : window.NzbDrone.ApiRoot + '/config/naming/samples'});
|
||||
module.exports = Backbone.Model.extend({ url : window.NzbDrone.ApiRoot + '/config/naming/samples' });
|
||||
@@ -5,7 +5,7 @@ var BasicNamingView = require('./Basic/BasicNamingView');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
|
||||
module.exports = (function(){
|
||||
module.exports = (function() {
|
||||
var view = Marionette.Layout.extend({
|
||||
template : 'Settings/MediaManagement/Naming/NamingViewTemplate',
|
||||
ui : {
|
||||
@@ -27,31 +27,30 @@ module.exports = (function(){
|
||||
"click .x-naming-token-helper a" : '_addToken',
|
||||
"change .x-multi-episode-style" : '_multiEpisodeFomatChanged'
|
||||
},
|
||||
regions : {basicNamingRegion : '.x-basic-naming'},
|
||||
onRender : function(){
|
||||
if(!this.model.get('renameEpisodes')) {
|
||||
regions : { basicNamingRegion : '.x-basic-naming' },
|
||||
onRender : function() {
|
||||
if (!this.model.get('renameEpisodes')) {
|
||||
this.ui.namingOptions.hide();
|
||||
}
|
||||
var basicNamingView = new BasicNamingView({model : this.model});
|
||||
var basicNamingView = new BasicNamingView({ model : this.model });
|
||||
this.basicNamingRegion.show(basicNamingView);
|
||||
this.namingSampleModel = new NamingSampleModel();
|
||||
this.listenTo(this.model, 'change', this._updateSamples);
|
||||
this.listenTo(this.namingSampleModel, 'sync', this._showSamples);
|
||||
this._updateSamples();
|
||||
},
|
||||
_setFailedDownloadOptionsVisibility : function(){
|
||||
_setFailedDownloadOptionsVisibility : function() {
|
||||
var checked = this.ui.renameEpisodesCheckbox.prop('checked');
|
||||
if(checked) {
|
||||
if (checked) {
|
||||
this.ui.namingOptions.slideDown();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
this.ui.namingOptions.slideUp();
|
||||
}
|
||||
},
|
||||
_updateSamples : function(){
|
||||
this.namingSampleModel.fetch({data : this.model.toJSON()});
|
||||
_updateSamples : function() {
|
||||
this.namingSampleModel.fetch({ data : this.model.toJSON() });
|
||||
},
|
||||
_showSamples : function(){
|
||||
_showSamples : function() {
|
||||
this.ui.singleEpisodeExample.html(this.namingSampleModel.get('singleEpisodeExample'));
|
||||
this.ui.multiEpisodeExample.html(this.namingSampleModel.get('multiEpisodeExample'));
|
||||
this.ui.dailyEpisodeExample.html(this.namingSampleModel.get('dailyEpisodeExample'));
|
||||
@@ -60,16 +59,15 @@ module.exports = (function(){
|
||||
this.ui.seriesFolderExample.html(this.namingSampleModel.get('seriesFolderExample'));
|
||||
this.ui.seasonFolderExample.html(this.namingSampleModel.get('seasonFolderExample'));
|
||||
},
|
||||
_addToken : function(e){
|
||||
_addToken : function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
var target = e.target;
|
||||
var token = '';
|
||||
var input = this.$(target).closest('.x-helper-input').children('input');
|
||||
if(this.$(target).attr('data-token')) {
|
||||
if (this.$(target).attr('data-token')) {
|
||||
token = '{{0}}'.format(this.$(target).attr('data-token'));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
token = this.$(target).attr('data-separator');
|
||||
}
|
||||
input.val(input.val() + token);
|
||||
@@ -77,7 +75,7 @@ module.exports = (function(){
|
||||
this.ui.namingTokenHelper.removeClass('open');
|
||||
input.focus();
|
||||
},
|
||||
multiEpisodeFormatChanged : function(){
|
||||
multiEpisodeFormatChanged : function() {
|
||||
this.model.set('multiEpisodeStyle', this.ui.multiEpisodeStyle.val());
|
||||
}
|
||||
});
|
||||
|
||||
@@ -2,9 +2,10 @@ var Marionette = require('marionette');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({template : 'Settings/MediaManagement/Permissions/PermissionsViewTemplate'});
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
return view;
|
||||
}).call(this);
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/MediaManagement/Permissions/PermissionsViewTemplate'
|
||||
});
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
|
||||
module.exports = view;
|
||||
@@ -2,9 +2,11 @@ var Marionette = require('marionette');
|
||||
var AsModelBoundView = require('../../../Mixins/AsModelBoundView');
|
||||
var AsValidatedView = require('../../../Mixins/AsValidatedView');
|
||||
|
||||
module.exports = (function(){
|
||||
var view = Marionette.ItemView.extend({template : 'Settings/MediaManagement/Sorting/SortingViewTemplate'});
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
return view;
|
||||
}).call(this);
|
||||
var view = Marionette.ItemView.extend({
|
||||
template : 'Settings/MediaManagement/Sorting/SortingViewTemplate'
|
||||
});
|
||||
|
||||
AsModelBoundView.call(view);
|
||||
AsValidatedView.call(view);
|
||||
|
||||
module.exports = view;
|
||||
Reference in New Issue
Block a user