Added Auth, startup options to UI

Added caching to ConfigFileProvider,
This commit is contained in:
kay.one 2013-05-22 22:12:01 -07:00
commit 4da6654440
34 changed files with 579 additions and 365 deletions

View file

@ -0,0 +1,16 @@
"use strict";
define(['app'], function () {
NzbDrone.Settings.General.GeneralSettingsModel = Backbone.Model.extend({
url: NzbDrone.Constants.ApiRoot + '/settings/host',
initialize: function () {
this.on('change', function () {
this.isSaved = false;
}, this);
this.on('sync', function () {
this.isSaved = true;
}, this);
}
});
});

View file

@ -0,0 +1,70 @@
<div class="form-horizontal">
<fieldset>
<legend>Start-Up</legend>
<div class="control-group">
<label class="control-label">Port Number</label>
<div class="controls">
<input type="text" placeholder="8989" name="port"/>
<span>
<i class="icon-exclamation-sign danger" title="Requires restart to take effect"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Open browser on start</label>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="launchBrowser"/>
<p>
<span>Yes</span>
<span>No</span>
</p>
<div class="btn btn-primary slide-button"></div>
</label>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Open a web browser and navigate to NzbDrone homepage on app start. Has no effect if installed as a windows service"></i>
</span>
</div>
</div>
</fieldset>
<fieldset>
<legend>Security</legend>
<div class="control-group">
<label class="control-label">Authentication</label>
<div class="controls">
<select class="inputClass" name="authenticationType">
<option value="Anonymous">Anonymous</option>
<option value="Basic">Basic</option>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label">Username</label>
<div class="controls">
<input type="text" placeholder="Username" name="basicAuthUsername"/>
</div>
</div>
<div class="control-group">
<label class="control-label">Password</label>
<div class="controls">
<input type="password" name="basicAuthPassword"/>
</div>
</div>
</fieldset>
</div>

View file

@ -0,0 +1,31 @@
'use strict';
define(['app', 'Settings/SettingsModel', 'Shared/Messenger'], function () {
NzbDrone.Settings.General.GeneralView = Backbone.Marionette.ItemView.extend({
template: 'Settings/General/GeneralTemplate',
initialize: function () {
NzbDrone.vent.on(NzbDrone.Commands.SaveSettings, this.saveSettings, this);
},
saveSettings: function () {
if (!this.model.isSaved) {
this.model.save(undefined, this.syncNotification("Naming Settings Saved", "Couldn't Save Naming Settings"));
}
},
syncNotification: function (success, error) {
return {
success: function () {
NzbDrone.Shared.Messenger.show({message: 'General Settings Saved'});
},
error : function () {
NzbDrone.Shared.Messenger.show({message: "Couldn't Save General Settings", type: 'error'});
}
};
}
}
);
});

View file

@ -1,191 +1,198 @@
<fieldset>
<legend>Episode Naming</legend>
<div class="form-horizontal">
<fieldset>
<legend>Episode Naming</legend>
<div class="control-group">
<label class="control-label">Use Scene Name</label>
<div class="control-group">
<label class="control-label">Use Scene Name</label>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="useSceneName"/>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="useSceneName"/>
<div class="btn btn-primary slide-button"></div>
</label>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="btn btn-primary slide-button"></div>
</label>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Use the scene name, ignoring all other naming settings"></i>
</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Include Series Title</label>
<div class="control-group">
<label class="control-label">Include Series Title</label>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="includeSeriesTitle"/>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="includeSeriesTitle"/>
<div class="btn btn-primary slide-button"></div>
</label>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="btn btn-primary slide-button"></div>
</label>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Should filenames contain the series name when renamed?"></i>
</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Include Episode Title</label>
<div class="control-group">
<label class="control-label">Include Episode Title</label>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="includeEpisodeTitle"/>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="includeEpisodeTitle"/>
<div class="btn btn-primary slide-button"></div>
</label>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="btn btn-primary slide-button"></div>
</label>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Should filenames contain the episode name when renamed?"></i>
</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Include Quality</label>
<div class="control-group">
<label class="control-label">Include Quality</label>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="includeQuality"/>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="includeQuality"/>
<div class="btn btn-primary slide-button"></div>
</label>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="btn btn-primary slide-button"></div>
</label>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Should filenames have the include the quality?"></i>
</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Replace Spaces</label>
<div class="control-group">
<label class="control-label">Replace Spaces</label>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="replaceSpaces"/>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="controls">
<label class="checkbox toggle well">
<input type="checkbox" name="replaceSpaces"/>
<div class="btn btn-primary slide-button"></div>
</label>
<p>
<span>On</span>
<span>Off</span>
</p>
<div class="btn btn-primary slide-button"></div>
</label>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Do you want to replace spaces in the filename with periods?"></i>
</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Season Folder Format</label>
<div class="control-group">
<label class="control-label">Season Folder Format</label>
<div class="controls">
<input type="text" placeholder="Season %s" name="seasonFolderFormat"/>
<div class="controls">
<input type="text" placeholder="Season %s" name="seasonFolderFormat"/>
<span class="help-inline">
<i class="icon-question-sign" title="How should season folders be named? (Use %0s to pad to two digits)"></i>
</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Separator</label>
<div class="control-group">
<label class="control-label">Separator</label>
<div class="controls">
<select class="inputClass x-backlog-setting" name="separator">
<option value=" - ">Dash</option>
<option value=" ">Space</option>
<option value=".">Period</option>
</select>
<div class="controls">
<select class="inputClass x-backlog-setting" name="separator">
<option value=" - ">Dash</option>
<option value=" ">Space</option>
<option value=".">Period</option>
</select>
<span class="help-inline">
<i class="icon-question-sign" title="How should NzbDrone separate sections of the filename?"></i>
</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Numbering Style</label>
<div class="control-group">
<label class="control-label">Numbering Style</label>
<div class="controls">
<select class="inputClass x-backlog-setting" name="numberStyle">
<option value="0">1x05</option>
<option value="1">01x05</option>
<option value="2">S01E05</option>
<option value="3">s01e05</option>
</select>
<div class="controls">
<select class="inputClass x-backlog-setting" name="numberStyle">
<option value="0">1x05</option>
<option value="1">01x05</option>
<option value="2">S01E05</option>
<option value="3">s01e05</option>
</select>
<span class="help-inline">
<i class="icon-question-sign" title="What numbering style do you want?"></i>
</span>
</div>
</div>
</div>
<div class="control-group">
<label class="control-label">Multi-Episode Style</label>
<div class="control-group">
<label class="control-label">Multi-Episode Style</label>
<div class="controls">
<select class="inputClass x-backlog-setting" name="multiEpisodeStyle">
<option value="0">Extend</option>
<option value="1">Duplicate</option>
<option value="2">Repeat</option>
<option value="3">Scene</option>
</select>
<div class="controls">
<select class="inputClass x-backlog-setting" name="multiEpisodeStyle">
<option value="0">Extend</option>
<option value="1">Duplicate</option>
<option value="2">Repeat</option>
<option value="3">Scene</option>
</select>
<span class="help-inline">
<i class="icon-question-sign" title="How will multi-episode files be named?"></i>
</span>
</div>
</div>
</fieldset>
<fieldset>
<legend>Metadata</legend>
<div class="control-group">
<label class="control-label">XBMC</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="metadataXbmcEnabled"/>
</div>
</div>
</fieldset>
<fieldset>
<legend>Metadata</legend>
<div class="control-group">
<label class="control-label">XBMC</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="metadataXbmcEnabled"/>
</div>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Enable creating metadata for XBMC"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Use Banners</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="metadataUseBanners"/>
</div>
</div>
<div class="control-group">
<label class="control-label">Use Banners</label>
<div class="controls">
<div class="switch">
<input type="checkbox" name="metadataUseBanners"/>
</div>
<span class="help-inline-checkbox">
<i class="icon-question-sign" title="Use banners instead of posters?"></i>
</span>
</div>
</div>
</div>
</fieldset>
</fieldset>
</div>

View file

@ -3,7 +3,6 @@ define(['app', 'Settings/Naming/NamingModel'], function () {
NzbDrone.Settings.Naming.NamingView = Backbone.Marionette.ItemView.extend({
template : 'Settings/Naming/NamingTemplate',
className: 'form-horizontal',
ui: {
tooltip: '[class^="help-inline"] i'

View file

@ -6,7 +6,8 @@ define([
'Settings/Indexers/CollectionView',
'Settings/DownloadClient/DownloadClientView',
'Settings/Notifications/CollectionView',
'Settings/System/SystemView',
'Settings/General/GeneralView',
'Settings/General/GeneralSettingsModel',
'Settings/Misc/MiscView'
],
function () {
@ -19,7 +20,7 @@ define([
indexers : '#indexers',
downloadClient: '#download-client',
notifications : '#notifications',
system : '#system',
general : '#general',
misc : '#misc'
},
@ -29,7 +30,7 @@ define([
indexersTab : '.x-indexers-tab',
downloadClientTab: '.x-download-client-tab',
notificationsTab : '.x-notifications-tab',
systemTab : '.x-system-tab',
generalTab : '.x-general-tab',
miscTab : '.x-misc-tab'
},
@ -39,7 +40,7 @@ define([
'click .x-indexers-tab' : 'showIndexers',
'click .x-download-client-tab': 'showDownloadClient',
'click .x-notifications-tab' : 'showNotifications',
'click .x-system-tab' : 'showSystem',
'click .x-general-tab' : 'showGeneral',
'click .x-misc-tab' : 'showMisc',
'click .x-save-settings' : 'save'
},
@ -89,13 +90,13 @@ define([
NzbDrone.Router.navigate('settings/notifications');
},
showSystem: function (e) {
showGeneral: function (e) {
if (e) {
e.preventDefault();
}
this.ui.systemTab.tab('show');
NzbDrone.Router.navigate('settings/system');
this.ui.generalTab.tab('show');
NzbDrone.Router.navigate('settings/general');
},
showMisc: function (e) {
@ -111,6 +112,9 @@ define([
this.settings = new NzbDrone.Settings.SettingsModel();
this.settings.fetch();
this.generalSettings = new NzbDrone.Settings.General.GeneralSettingsModel();
this.generalSettings.fetch();
this.namingSettings = new NzbDrone.Settings.Naming.NamingModel();
this.namingSettings.fetch();
@ -131,7 +135,7 @@ define([
this.indexers.show(new NzbDrone.Settings.Indexers.CollectionView({collection: this.indexerSettings}));
this.downloadClient.show(new NzbDrone.Settings.DownloadClient.DownloadClientView({model: this.settings}));
this.notifications.show(new NzbDrone.Settings.Notifications.CollectionView({collection: this.notificationSettings}));
this.system.show(new NzbDrone.Settings.System.SystemView({model: this.settings}));
this.general.show(new NzbDrone.Settings.General.GeneralView({model: this.generalSettings}));
this.misc.show(new NzbDrone.Settings.Misc.MiscView({model: this.settings}));
},
@ -149,8 +153,8 @@ define([
case 'notifications':
this.showNotifications();
break;
case 'system':
this.showSystem();
case 'general':
this.showGeneral();
break;
case 'misc':
this.showMisc();

View file

@ -4,7 +4,7 @@
<li><a href="#indexers" class="x-indexers-tab">Indexers</a></li>
<li><a href="#download-client" class="x-download-client-tab">Download Client</a></li>
<li><a href="#notifications" class="x-notifications-tab">Notifications</a></li>
<li><a href="#system" class="x-system-tab">System</a></li>
<li><a href="#general" class="x-general-tab">general</a></li>
<li><a href="#misc" class="x-misc-tab">Misc</a></li>
</ul>
@ -14,7 +14,7 @@
<div class="tab-pane" id="indexers">Indexer Settings</div>
<div class="tab-pane" id="download-client">Download Client Settings</div>
<div class="tab-pane" id="notifications">Notification Settings</div>
<div class="tab-pane" id="system">System Settings</div>
<div class="tab-pane" id="general">general Settings</div>
<div class="tab-pane" id="misc">Misc Settings</div>
</div>

View file

@ -1,3 +0,0 @@
<div>
System settings will go here
</div>

View file

@ -1,11 +0,0 @@
'use strict';
define([
'app', 'Settings/SettingsModel'
], function () {
NzbDrone.Settings.System.SystemView = Backbone.Marionette.ItemView.extend({
template: 'Settings/System/SystemTemplate'
});
});

View file

@ -76,7 +76,7 @@ define('app', ['shared/modal/region'], function (ModalRegion) {
Indexers : {},
DownloadClient: {},
Notifications : {},
System : {},
General : {},
Misc : {}
};