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'});
}
};
}
}
);
});