Removed virtuals from ConfigService.

Settings UI taking shape.
This commit is contained in:
Mark McDowall 2013-03-04 22:50:42 -08:00
parent b9a14a5cf5
commit 9bb383e2b8
18 changed files with 654 additions and 222 deletions

View File

@ -9,13 +9,14 @@ namespace NzbDrone.Api.Settings
{
public class SettingsModule : NzbDroneApiModule
{
private readonly ConfigService _configService;
private readonly IConfigService _configService;
public SettingsModule(ConfigService configService)
public SettingsModule(IConfigService configService)
: base("/settings")
{
_configService = configService;
Get["/"] = x => GetAllSettings();
Post["/"] = x => SaveSettings();
}
private Response GetAllSettings()
@ -27,5 +28,12 @@ namespace NzbDrone.Api.Settings
return _configService.AllWithDefaults().AsResponse();
}
private Response SaveSettings()
{
var request = Request.Body.FromJson<Dictionary<string, object>>();
return request.AsResponse();
}
}
}

View File

@ -88,19 +88,19 @@ html {
/* Todo: Should move this to somehting modal/form specific */
label.checkbox {
font-size: 14px;
line-height: normal;
color: #595959;
}
/*label.checkbox {*/
/*font-size: 14px;*/
/*line-height: normal;*/
/*color: #595959;*/
/*}*/
label, .form-horizontal input, .form-horizontal select {
font-size: 14px;
line-height: 14px;
}
/*label, .form-horizontal input, .form-horizontal select {*/
/*font-size: 14px;*/
/*line-height: 14px;*/
/*}*/
label.control-label {
font-size: 16px;
line-height: 16px;
font-weight: bold;
}
/*label.control-label {*/
/*font-size: 16px;*/
/*line-height: 16px;*/
/*font-weight: bold;*/
/*}*/

View File

@ -0,0 +1,210 @@
/* ============================================================
* bootstrapSwitch v1.2 by Larentis Mattia @spiritualGuru
* http://www.larentis.eu/switch/
* ============================================================
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* ============================================================ */
/* line 18, ../sass/bootstrapSwitch.scss */
.has-switch {
display: inline-block;
cursor: pointer;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
-ms-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
border: 1px solid;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
background: #e6e6e6;
position: relative;
text-align: left;
overflow: hidden;
line-height: 8px;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
min-width: 102px;
}
/* line 40, ../sass/bootstrapSwitch.scss */
.has-switch.switch-mini {
min-width: 72px;
}
/* line 44, ../sass/bootstrapSwitch.scss */
.has-switch.switch-small {
min-width: 81px;
}
/* line 48, ../sass/bootstrapSwitch.scss */
.has-switch.switch-large {
min-width: 120px;
}
/* line 52, ../sass/bootstrapSwitch.scss */
.has-switch.deactivate {
filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=50);
opacity: 0.5;
cursor: default !important;
}
/* line 55, ../sass/bootstrapSwitch.scss */
.has-switch.deactivate label, .has-switch.deactivate span {
cursor: default !important;
}
/* line 59, ../sass/bootstrapSwitch.scss */
.has-switch > div {
display: inline-block;
width: 150%;
position: relative;
top: 0;
}
/* line 65, ../sass/bootstrapSwitch.scss */
.has-switch > div.switch-animate {
-webkit-transition: left 0.5s;
-moz-transition: left 0.5s;
-o-transition: left 0.5s;
transition: left 0.5s;
}
/* line 68, ../sass/bootstrapSwitch.scss */
.has-switch > div.switch-off {
left: -50%;
}
/* line 71, ../sass/bootstrapSwitch.scss */
.has-switch > div.switch-on {
left: 0%;
}
/* line 75, ../sass/bootstrapSwitch.scss */
.has-switch input[type=checkbox] {
display: none;
}
/* line 83, ../sass/bootstrapSwitch.scss */
.has-switch span, .has-switch label {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
cursor: pointer;
position: relative;
display: inline-block;
height: 100%;
padding-bottom: 4px;
padding-top: 4px;
font-size: 14px;
line-height: 20px;
}
/* line 96, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-mini, .has-switch label.switch-mini {
padding-bottom: 4px;
padding-top: 4px;
font-size: 10px;
line-height: 9px;
}
/* line 103, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-small, .has-switch label.switch-small {
padding-bottom: 3px;
padding-top: 3px;
font-size: 12px;
line-height: 18px;
}
/* line 110, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-large, .has-switch label.switch-large {
padding-bottom: 9px;
padding-top: 9px;
font-size: 16px;
line-height: normal;
}
/* line 118, ../sass/bootstrapSwitch.scss */
.has-switch label {
background: white;
margin-top: -1px;
margin-bottom: -1px;
z-index: 100;
width: 33.333333%;
border-left: 1px solid #e6e6e6;
border-right: 1px solid #e6e6e6;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
background-image: linear-gradient(top, #ffffff, #e6e6e6);
}
/* line 130, ../sass/bootstrapSwitch.scss */
.has-switch span {
color: white;
text-align: center;
z-index: 1;
width: 33.333333%;
}
/* line 136, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-left {
-moz-border-radius-topleft: 4px;
-webkit-border-top-left-radius: 4px;
border-top-left-radius: 4px;
-moz-border-radius-bottomleft: 4px;
-webkit-border-bottom-left-radius: 4px;
border-bottom-left-radius: 4px;
}
/* line 140, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-right {
color: black;
-moz-border-radius-topright: 4px;
-webkit-border-top-right-radius: 4px;
border-top-right-radius: 4px;
-moz-border-radius-bottomright: 4px;
-webkit-border-bottom-right-radius: 4px;
border-bottom-right-radius: 4px;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ffffff), color-stop(100%, #e6e6e6));
background-image: -webkit-linear-gradient(bottom, #ffffff, #e6e6e6);
background-image: -moz-linear-gradient(bottom, #ffffff, #e6e6e6);
background-image: -o-linear-gradient(bottom, #ffffff, #e6e6e6);
background-image: linear-gradient(bottom, #ffffff, #e6e6e6);
}
/* line 147, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-primary, .has-switch span.switch-left {
color: white;
background: #0088cc;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #0088cc), color-stop(100%, #0055cc));
background-image: -webkit-linear-gradient(bottom, #0088cc, #0055cc);
background-image: -moz-linear-gradient(bottom, #0088cc, #0055cc);
background-image: -o-linear-gradient(bottom, #0088cc, #0055cc);
background-image: linear-gradient(bottom, #0088cc, #0055cc);
}
/* line 152, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-info {
color: white;
background: #5bc0de;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #5bc0de), color-stop(100%, #2f96b4));
background-image: -webkit-linear-gradient(bottom, #5bc0de, #2f96b4);
background-image: -moz-linear-gradient(bottom, #5bc0de, #2f96b4);
background-image: -o-linear-gradient(bottom, #5bc0de, #2f96b4);
background-image: linear-gradient(bottom, #5bc0de, #2f96b4);
}
/* line 158, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-success {
color: white;
background: #62c462;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #62c462), color-stop(100%, #51a351));
background-image: -webkit-linear-gradient(bottom, #62c462, #51a351);
background-image: -moz-linear-gradient(bottom, #62c462, #51a351);
background-image: -o-linear-gradient(bottom, #62c462, #51a351);
background-image: linear-gradient(bottom, #62c462, #51a351);
}
/* line 164, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-warning {
color: white;
background: #dbb450;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #dbb450), color-stop(100%, #f89406));
background-image: -webkit-linear-gradient(bottom, #dbb450, #f89406);
background-image: -moz-linear-gradient(bottom, #dbb450, #f89406);
background-image: -o-linear-gradient(bottom, #dbb450, #f89406);
background-image: linear-gradient(bottom, #dbb450, #f89406);
}
/* line 170, ../sass/bootstrapSwitch.scss */
.has-switch span.switch-danger {
color: white;
background: #ee5f5b;
background-image: -webkit-gradient(linear, 50% 100%, 50% 0%, color-stop(0%, #ee5f5b), color-stop(100%, #bd362f));
background-image: -webkit-linear-gradient(bottom, #ee5f5b, #bd362f);
background-image: -moz-linear-gradient(bottom, #ee5f5b, #bd362f);
background-image: -o-linear-gradient(bottom, #ee5f5b, #bd362f);
background-image: linear-gradient(bottom, #ee5f5b, #bd362f);
}

View File

@ -0,0 +1,10 @@
.form-horizontal .controls i {
font-size: 25px;
color: #3A87AD;
cursor: default;
vertical-align: text-bottom;
}
.help-checkbox {
margin-top: -20px;
}

View File

@ -10,13 +10,15 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link href='//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,400,600,300' rel='stylesheet' type='text/css'>
<link href="/static/content/bootstrap/bootstrap.less" rel='stylesheet' type='text/css' />
<link href="/static/content/bootstrapSwitch.css" rel='stylesheet' type='text/css' />
<link href="/static/content/base.css" rel='stylesheet' type='text/css' />
<link href="/static/content/theme.css" rel='stylesheet' type='text/css'>
<link href="/static/content/toastr.css" rel='stylesheet' type='text/css'>
<link href="/static/content/fullcalendar.css" rel='stylesheet' type='text/css'>
<link href="/static/Content/tablesorter.bootstrap.css" rel='stylesheet' type='text/css' />
<link href="/static/content/tablesorter.bootstrap.css" rel='stylesheet' type='text/css' />
<link href="/static/AddSeries/addseries.css" rel='stylesheet' type='text/css' />
<link href="/static/content/menu.css" rel='stylesheet' type='text/css' />
<link href="/static/content/form.css" rel='stylesheet' type='text/css' />
</head>
<script type="text/html" id="notification-template">
<div class="alert alert-{{level}}">
@ -97,6 +99,7 @@
</body>
<script src="/static/JsLibraries/jquery.js"></script>
<script src="/static/JsLibraries/bootstrap.js"></script>
<script src="/static/JsLibraries/bootstrapSwitch.js"></script>
<script src="/static/JsLibraries/underscore.js"></script>
<script src="/static/JsLibraries/handlebars.js"></script>
<script src="/static/JsLibraries/backbone.js"></script>

View File

@ -0,0 +1,238 @@
/* ============================================================
* bootstrapSwitch v1.2 by Larentis Mattia @spiritualGuru
* http://www.larentis.eu/switch/
* ============================================================
* Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0
* ============================================================ */
!function ($) {
"use strict";
$.fn['bootstrapSwitch'] = function (method) {
var methods = {
init: function () {
return this.each(function () {
var $element = $(this)
, $div
, $switchLeft
, $switchRight
, $label
, myClasses = ""
, classes = $element.attr('class')
, color
, moving
, onLabel = "ON"
, offLabel = "OFF";
$.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
if (classes.indexOf(el) >= 0)
myClasses = el;
});
$element.addClass('has-switch');
if ($element.data('on') !== undefined)
color = "switch-" + $element.data('on');
if ($element.data('on-label') !== undefined)
onLabel = $element.data('on-label');
if ($element.data('off-label') !== undefined)
offLabel = $element.data('off-label');
$switchLeft = $('<span>')
.addClass("switch-left")
.addClass(myClasses)
.addClass(color)
.html(onLabel);
color = '';
if ($element.data('off') !== undefined)
color = "switch-" + $element.data('off');
$switchRight = $('<span>')
.addClass("switch-right")
.addClass(myClasses)
.addClass(color)
.html(offLabel);
$label = $('<label>')
.html("&nbsp;")
.addClass(myClasses)
.attr('for', $element.find('input').attr('id'));
$div = $element.find(':checkbox').wrap($('<div>')).parent().data('animated', false);
if ($element.data('animated') !== false)
$div.addClass('switch-animate').data('animated', true);
$div
.append($switchLeft)
.append($label)
.append($switchRight);
$element.find('>div').addClass(
$element.find('input').is(':checked') ? 'switch-on' : 'switch-off'
);
if ($element.find('input').is(':disabled'))
$(this).addClass('deactivate');
var changeStatus = function ($this) {
$this.siblings('label').trigger('mousedown').trigger('mouseup').trigger('click');
};
$element.on('keydown', function (e) {
if (e.keyCode === 32) {
e.stopImmediatePropagation();
e.preventDefault();
changeStatus($(e.target).find('span:first'));
}
});
$switchLeft.on('click', function (e) {
changeStatus($(this));
});
$switchRight.on('click', function (e) {
changeStatus($(this));
});
$element.find('input').on('change', function (e) {
var $element = $(this).parent();
e.preventDefault();
e.stopImmediatePropagation();
$element.css('left', '');
if ($(this).is(':checked'))
$element.removeClass('switch-off').addClass('switch-on');
else $element.removeClass('switch-on').addClass('switch-off');
if ($element.data('animated') !== false)
$element.addClass("switch-animate");
$element.parent().trigger('switch-change', {'el': $(this), 'value': $(this).is(':checked')})
});
$element.find('label').on('mousedown touchstart', function (e) {
var $this = $(this);
moving = false;
e.preventDefault();
e.stopImmediatePropagation();
$this.closest('div').removeClass('switch-animate');
if ($this.closest('.switch').is('.deactivate'))
$this.unbind('click');
else {
$this.on('mousemove touchmove', function (e) {
var $element = $(this).closest('.switch')
, relativeX = (e.pageX || e.originalEvent.targetTouches[0].pageX) - $element.offset().left
, percent = (relativeX / $element.width()) * 100
, left = 25
, right = 75;
moving = true;
if (percent < left)
percent = left;
else if (percent > right)
percent = right;
$element.find('>div').css('left', (percent - right) + "%")
});
$this.on('click touchend', function (e) {
var $this = $(this)
, $target = $(e.target)
, $myCheckBox = $target.siblings('input');
e.stopImmediatePropagation();
e.preventDefault();
$this.unbind('mouseleave');
if (moving)
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25));
else $myCheckBox.prop("checked", !$myCheckBox.is(":checked"));
moving = false;
$myCheckBox.trigger('change');
});
$this.on('mouseleave', function (e) {
var $this = $(this)
, $myCheckBox = $this.siblings('input');
e.preventDefault();
e.stopImmediatePropagation();
$this.unbind('mouseleave');
$this.trigger('mouseup');
$myCheckBox.prop('checked', !(parseInt($this.parent().css('left')) < -25)).trigger('change');
});
$this.on('mouseup', function (e) {
e.stopImmediatePropagation();
e.preventDefault();
$(this).unbind('mousemove');
});
}
});
}
);
},
toggleActivation: function () {
$(this).toggleClass('deactivate');
},
isActive: function () {
return !$(this).hasClass('deactivate');
},
setActive: function (active) {
if (active)
$(this).removeClass('deactivate');
else $(this).addClass('deactivate');
},
toggleState: function (skipOnChange) {
var $input = $(this).find('input:checkbox');
$input.prop('checked', !$input.is(':checked')).trigger('change', skipOnChange);
},
setState: function (value, skipOnChange) {
$(this).find('input:checkbox').prop('checked', value).trigger('change', skipOnChange);
},
status: function () {
return $(this).find('input:checkbox').is(':checked');
},
destroy: function () {
var $div = $(this).find('div')
, $checkbox;
$div.find(':not(input:checkbox)').remove();
$checkbox = $div.children();
$checkbox.unwrap().unwrap();
$checkbox.unbind('change');
return $checkbox;
}
};
if (methods[method])
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
else if (typeof method === 'object' || !method)
return methods.init.apply(this, arguments);
else
$.error('Method ' + method + ' does not exist!');
};
}(jQuery);
$(function () {
$('.switch')['bootstrapSwitch']();
});

View File

@ -8,22 +8,8 @@ define([
NzbDrone.Settings.DownloadClient.DownloadClientView = Backbone.Marionette.ItemView.extend({
template: 'Settings/DownloadClient/DownloadClientTemplate',
events: {
'click .x-save': 'save'
},
initialize: function (options) {
this.model = options.model;
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
save: function () {
//Todo: Actually save the model
alert('Save pressed!');
}
});
});

View File

@ -8,22 +8,8 @@ define([
NzbDrone.Settings.Indexers.IndexersView = Backbone.Marionette.ItemView.extend({
template: 'Settings/Indexers/IndexersTemplate',
events: {
'click .x-save': 'save'
},
initialize: function (options) {
this.model = options.model;
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
save: function () {
//Todo: Actually save the model
alert('Save pressed!');
}
});
});

View File

@ -8,22 +8,8 @@ define([
NzbDrone.Settings.Misc.MiscView = Backbone.Marionette.ItemView.extend({
template: 'Settings/Misc/MiscTemplate',
events: {
'click .x-save': 'save'
},
initialize: function (options) {
this.model = options.model;
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
save: function () {
//Todo: Actually save the model
alert('Save pressed!');
}
});
});

View File

@ -4,68 +4,84 @@
<div class="control-group">
<label class="control-label" for="sortingUseSceneName">Use Scene Name</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" id ="sortingUseSceneName" name="sortingUseSceneName">
Use the scene name, ignoring all other naming settings?
</label>
<div class="switch">
<input type="checkbox" id ="sortingUseSceneName" name="sortingUseSceneName" />
</div>
<span class="help-inline help-checkbox">
<i class="icon-question-sign" title="Use the scene name, ignoring all other naming settings"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sortingIncludeSeriesName">Series Name</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" id ="sortingIncludeSeriesName" name="sortingIncludeSeriesName">
Should filenames contain the series name when renamed?
</label>
<div class="switch">
<input type="checkbox" id ="sortingIncludeSeriesName" name="sortingIncludeSeriesName" />
</div>
<span class="help-inline help-checkbox">
<i class="icon-question-sign" title="Should filenames contain the series name when renamed?"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sortingIncludeSeriesName">Episode Name</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" id ="sortingIncludeEpisodeTitle" name="sortingIncludeEpisodeTitle">
Should filenames contain the episode name when renamed?
</label>
<div class="switch">
<input type="checkbox" id ="sortingIncludeEpisodeTitle" name="sortingIncludeEpisodeTitle" />
</div>
<span class="help-inline help-checkbox">
<i class="icon-question-sign" title="Should filenames contain the episode name when renamed?"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sortingReplaceSpaces">Replace Spaces</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" id ="sortingReplaceSpaces" name="sortingReplaceSpaces">
Do you want to replace spaces in the filename with periods?
</label>
<div class="switch">
<input type="checkbox" id ="sortingReplaceSpaces" name="sortingReplaceSpaces" />
</div>
<span class="help-inline help-checkbox">
<i class="icon-question-sign" title="Do you want to replace spaces in the filename with periods?"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sortingAppendQuality">Append Quality</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" id ="sortingAppendQuality" name="sortingAppendQuality">
Should filenames have the quality appended to the end?
</label>
<div class="switch">
<input type="checkbox" id ="sortingAppendQuality" name="sortingAppendQuality" />
</div>
<span class="help-inline help-checkbox">
<i class="icon-question-sign" title="Should filenames have the quality appended to the end?"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="useSeasonFolder">Use Scene Folders</label>
<div class="controls">
<label class="checkbox">
<input type="checkbox" id ="useSeasonFolder" name="useSeasonFolder">
Should files be stored in season folders by default? (Applied only when a series is added)
</label>
<div class="switch">
<input type="checkbox" id ="useSeasonFolder" name="useSeasonFolder" />
</div>
<span class="help-inline help-checkbox">
<i class="icon-question-sign" title="Should files be stored in season folders by default? (Applied only when a series is added)"></i>
</span>
</div>
</div>
<div class="control-group">
<label class="control-label" for="sortingSeasonFolderFormat">Season Folder Format</label>
<div class="controls">
<input type="text" id="sortingSeasonFolderFormat" placeholder="Season %s" name="sortingSeasonFolderFormat">
<span class="help-inline">How should season folders be named? (Use %0s to pad to two digits)</span>
<input type="text" id="sortingSeasonFolderFormat" placeholder="Season %s" name="sortingSeasonFolderFormat" />
<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>
@ -77,7 +93,9 @@
<option value="1">Space</option>
<option value="2">Period</option>
</select>
<span class="help-inline">How should NzbDrone separate sections of the filename?</span>
<span class="help-inline">
<i class="icon-question-sign" title="How should NzbDrone separate sections of the filename?"></i>
</span>
</div>
</div>
@ -90,7 +108,9 @@
<option value="2">S01E05</option>
<option value="3">s01e05</option>
</select>
<span class="help-inline">What numbering style do you want?</span>
<span class="help-inline">
<i class="icon-question-sign" title="What numbering style do you want?"></i>
</span>
</div>
</div>
@ -103,11 +123,37 @@
<option value="2">Repeat</option>
<option value="3">Scene</option>
</select>
<span class="help-inline">How will multi-episode files be named?</span>
<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" for="metadataXbmcEnabled">XBMC</label>
<div class="controls">
<div class="switch">
<input type="checkbox" id ="metadataXbmcEnabled" name="metadataXbmcEnabled" />
</div>
<span class="help-inline help-checkbox">
<i class="icon-question-sign" title="Enable creating metadata for XBMC"></i>
</span>
</div>
</div>
<button class="btn btn-primary">Save</button>
</fieldset>
<div class="control-group">
<label class="control-label" for="metadataUseBanners">Use Banners</label>
<div class="controls">
<div class="switch">
<input type="checkbox" id ="metadataUseBanners" name="metadataUseBanners" />
</div>
<span class="help-inline help-checkbox">
<i class="icon-question-sign" title="Use banners instead of posters?"></i>
</span>
</div>
</div>
</fieldset>

View File

@ -9,22 +9,15 @@ define([
template: 'Settings/Naming/NamingTemplate',
className: 'form-horizontal',
events: {
'click .x-save': 'save'
},
initialize: function (options) {
this.model = options.model;
ui: {
switch: '.switch',
tooltip: '.help-inline i'
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
save: function () {
//Todo: Actually save the model
alert('Save pressed!');
this.ui.switch.bootstrapSwitch();
this.ui.tooltip.tooltip({ placement: 'right' });
}
});
});

View File

@ -8,22 +8,8 @@ define([
NzbDrone.Settings.Notifications.NotificationsView = Backbone.Marionette.ItemView.extend({
template: 'Settings/Notifications/NotificationsTemplate',
events: {
'click .x-save': 'save'
},
initialize: function (options) {
this.model = options.model;
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
save: function () {
//Todo: Actually save the model
alert('Save pressed!');
}
});
});

View File

@ -8,22 +8,8 @@ define([
NzbDrone.Settings.Quality.QualityView = Backbone.Marionette.ItemView.extend({
template: 'Settings/Quality/QualityTemplate',
events: {
'click .x-save': 'save'
},
initialize: function (options) {
this.model = options.model;
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
save: function () {
//Todo: Actually save the model
alert('Save pressed!');
}
});
});

View File

@ -40,7 +40,8 @@
'click .x-download-client-tab': 'showDownloadClient',
'click .x-notifications-tab': 'showNotifications',
'click .x-system-tab': 'showSystem',
'click .x-misc-tab': 'showMisc'
'click .x-misc-tab': 'showMisc',
'click .x-save-settings': 'save'
},
showNaming: function (e) {
@ -153,6 +154,10 @@
default:
this.showNaming();
}
},
save: function () {
this.settings.save();
}
});
});

View File

@ -17,3 +17,5 @@
<div class="tab-pane" id="system">System Settings</div>
<div class="tab-pane" id="misc">Misc Settings</div>
</div>
<button class="btn btn-primary x-save-settings">Save</button>

View File

@ -8,22 +8,8 @@ define([
NzbDrone.Settings.System.SystemView = Backbone.Marionette.ItemView.extend({
template: 'Settings/System/SystemTemplate',
events: {
'click .x-save': 'save'
},
initialize: function (options) {
this.model = options.model;
},
onRender: function () {
NzbDrone.ModelBinder.bind(this.model, this.el);
},
save: function () {
//Todo: Actually save the model
alert('Save pressed!');
}
});
});

View File

@ -77,6 +77,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Franklin & Bash S02E10 6-50 to SLC [SDTV]", "Franklin & Bash", 2, 10)]
[TestCase("The_Big_Bang_Theory_-_6x12_-_The_Egg_Salad_Equivalency_[HDTV-720p]", "The Big Bang Theory", 6, 12)]
[TestCase("Top_Gear.19x06.720p_HDTV_x264-FoV", "Top Gear", 19, 6)]
[TestCase("Portlandia.S03E10.Alexandra.720p.WEB-DL.AAC2.0.H.264-CROM.mkv", "Portlandia", 3, 10)]
public void ParseTitle_single(string postTitle, string title, int seasonNumber, int episodeNumber)
{
var result = Parser.ParseTitle(postTitle);

View File

@ -44,316 +44,316 @@ namespace NzbDrone.Core.Configuration
return dict;
}
public virtual String NzbsOrgUId
public String NzbsOrgUId
{
get { return GetValue("NzbsOrgUId"); }
set { SetValue("NzbsOrgUId", value); }
}
public virtual String NzbsOrgHash
public String NzbsOrgHash
{
get { return GetValue("NzbsOrgHash"); }
set { SetValue("NzbsOrgHash", value); }
}
public virtual String NzbsrusUId
public String NzbsrusUId
{
get { return GetValue("NzbsrusUId"); }
set { SetValue("NzbsrusUId", value); }
}
public virtual String NzbsrusHash
public String NzbsrusHash
{
get { return GetValue("NzbsrusHash"); }
set { SetValue("NzbsrusHash", value); }
}
public virtual String FileSharingTalkUid
public String FileSharingTalkUid
{
get { return GetValue("FileSharingTalkUid"); }
set { SetValue("FileSharingTalkUid", value); }
}
public virtual String FileSharingTalkSecret
public String FileSharingTalkSecret
{
get { return GetValue("FileSharingTalkSecret"); }
set { SetValue("FileSharingTalkSecret", value); }
}
public virtual String SabHost
public String SabHost
{
get { return GetValue("SabHost", "localhost"); }
set { SetValue("SabHost", value); }
}
public virtual int SabPort
public int SabPort
{
get { return GetValueInt("SabPort", 8080); }
set { SetValue("SabPort", value); }
}
public virtual String SabApiKey
public String SabApiKey
{
get { return GetValue("SabApiKey"); }
set { SetValue("SabApiKey", value); }
}
public virtual String SabUsername
public String SabUsername
{
get { return GetValue("SabUsername"); }
set { SetValue("SabUsername", value); }
}
public virtual String SabPassword
public String SabPassword
{
get { return GetValue("SabPassword"); }
set { SetValue("SabPassword", value); }
}
public virtual String SabTvCategory
public String SabTvCategory
{
get { return GetValue("SabTvCategory", "tv"); }
set { SetValue("SabTvCategory", value); }
}
public virtual SabPriorityType SabBacklogTvPriority
public SabPriorityType SabBacklogTvPriority
{
get { return (SabPriorityType)GetValueInt("SabBacklogTvPriority"); }
set { SetValue("SabBacklogTvPriority", (int)value); }
}
public virtual SabPriorityType SabRecentTvPriority
public SabPriorityType SabRecentTvPriority
{
get { return (SabPriorityType)GetValueInt("SabRecentTvPriority"); }
set { SetValue("SabRecentTvPriority", (int)value); }
}
public virtual String DownloadClientTvDirectory
public String DownloadClientTvDirectory
{
get { return GetValue("DownloadClientTvDirectory"); }
set { SetValue("DownloadClientTvDirectory", value); }
}
public virtual bool SortingIncludeSeriesName
public bool SortingIncludeSeriesName
{
get { return GetValueBoolean("Sorting_SeriesName", true); }
set { SetValue("Sorting_SeriesName", value); }
}
public virtual bool SortingIncludeEpisodeTitle
public bool SortingIncludeEpisodeTitle
{
get { return GetValueBoolean("Sorting_EpisodeName", true); }
set { SetValue("Sorting_EpisodeName", value); }
}
public virtual bool SortingReplaceSpaces
public bool SortingReplaceSpaces
{
get { return GetValueBoolean("Sorting_ReplaceSpaces"); }
set { SetValue("Sorting_ReplaceSpaces", value); }
}
public virtual bool SortingAppendQuality
public bool SortingAppendQuality
{
get { return GetValueBoolean("Sorting_AppendQaulity", true); }
set { SetValue("Sorting_AppendQaulity", value); }
}
public virtual bool UseSeasonFolder
public bool UseSeasonFolder
{
get { return GetValueBoolean("UseSeasonFolder", true); }
set { SetValue("UseSeasonFolder", value); }
}
public virtual string SortingSeasonFolderFormat
public string SortingSeasonFolderFormat
{
get { return GetValue("Sorting_SeasonFolderFormat", "Season %s"); }
set { SetValue("Sorting_SeasonFolderFormat", value); }
}
public virtual int SortingSeparatorStyle
public int SortingSeparatorStyle
{
get { return GetValueInt("Sorting_SeparatorStyle"); }
set { SetValue("Sorting_SeparatorStyle", value); }
}
public virtual int SortingNumberStyle
public int SortingNumberStyle
{
get { return GetValueInt("Sorting_NumberStyle", 2); }
set { SetValue("Sorting_NumberStyle", value); }
}
public virtual int SortingMultiEpisodeStyle
public int SortingMultiEpisodeStyle
{
get { return GetValueInt("Sorting_MultiEpisodeStyle"); }
set { SetValue("Sorting_MultiEpisodeStyle", value); }
}
public virtual bool SortingUseSceneName
public bool SortingUseSceneName
{
get { return GetValueBoolean("Sorting_UseSceneName", false); }
set { SetValue("Sorting_UseSceneName", value); }
}
public virtual int DefaultQualityProfile
public int DefaultQualityProfile
{
get { return GetValueInt("DefaultQualityProfile", 1); }
set { SetValue("DefaultQualityProfile", value); }
}
public virtual Boolean XbmcUpdateLibrary
public Boolean XbmcUpdateLibrary
{
get { return GetValueBoolean("XbmcUpdateLibrary"); }
set { SetValue("XbmcUpdateLibrary", value); }
}
public virtual Boolean XbmcCleanLibrary
public Boolean XbmcCleanLibrary
{
get { return GetValueBoolean("XbmcCleanLibrary"); }
set { SetValue("XbmcCleanLibrary", value); }
}
public virtual Boolean XbmcUpdateWhenPlaying
public Boolean XbmcUpdateWhenPlaying
{
get { return GetValueBoolean("XbmcUpdateWhenPlaying"); }
set { SetValue("XbmcUpdateWhenPlaying", value); }
}
public virtual string XbmcHosts
public string XbmcHosts
{
get { return GetValue("XbmcHosts", "localhost:8080"); }
set { SetValue("XbmcHosts", value); }
}
public virtual string XbmcUsername
public string XbmcUsername
{
get { return GetValue("XbmcUsername", "xbmc"); }
set { SetValue("XbmcUsername", value); }
}
public virtual string XbmcPassword
public string XbmcPassword
{
get { return GetValue("XbmcPassword", String.Empty); }
set { SetValue("XbmcPassword", value); }
}
public virtual string UpdateUrl
public string UpdateUrl
{
get { return GetValue("UpdateUrl", UpdateProvider.DEFAULT_UPDATE_URL); }
set { SetValue("UpdateUrl", value); }
}
public virtual string SmtpServer
public string SmtpServer
{
get { return GetValue("SmtpServer", String.Empty); }
set { SetValue("SmtpServer", value); }
}
public virtual int SmtpPort
public int SmtpPort
{
get { return GetValueInt("SmtpPort", 25); }
set { SetValue("SmtpPort", value); }
}
public virtual Boolean SmtpUseSsl
public Boolean SmtpUseSsl
{
get { return GetValueBoolean("SmtpUseSsl"); }
set { SetValue("SmtpUseSsl", value); }
}
public virtual string SmtpUsername
public string SmtpUsername
{
get { return GetValue("SmtpUsername", String.Empty); }
set { SetValue("SmtpUsername", value); }
}
public virtual string SmtpPassword
public string SmtpPassword
{
get { return GetValue("SmtpPassword", String.Empty); }
set { SetValue("SmtpPassword", value); }
}
public virtual string SmtpFromAddress
public string SmtpFromAddress
{
get { return GetValue("SmtpFromAddress", String.Empty); }
set { SetValue("SmtpFromAddress", value); }
}
public virtual string SmtpToAddresses
public string SmtpToAddresses
{
get { return GetValue("SmtpToAddresses", String.Empty); }
set { SetValue("SmtpToAddresses", value); }
}
public virtual string TwitterAccessToken
public string TwitterAccessToken
{
get { return GetValue("TwitterAccessToken", String.Empty); }
set { SetValue("TwitterAccessToken", value); }
}
public virtual string TwitterAccessTokenSecret
public string TwitterAccessTokenSecret
{
get { return GetValue("TwitterAccessTokenSecret", String.Empty); }
set { SetValue("TwitterAccessTokenSecret", value); }
}
public virtual string GrowlHost
public string GrowlHost
{
get { return GetValue("GrowlHost", "localhost:23053"); }
set { SetValue("GrowlHost", value); }
}
public virtual string GrowlPassword
public string GrowlPassword
{
get { return GetValue("GrowlPassword", String.Empty); }
set { SetValue("GrowlPassword", value); }
}
public virtual string ProwlApiKeys
public string ProwlApiKeys
{
get { return GetValue("ProwlApiKeys", String.Empty); }
set { SetValue("ProwlApiKeys", value); }
}
public virtual int ProwlPriority
public int ProwlPriority
{
get { return GetValueInt("ProwlPriority", 0); }
set { SetValue("ProwlPriority", value); }
}
public virtual bool EnableBacklogSearching
public bool EnableBacklogSearching
{
get { return GetValueBoolean("EnableBacklogSearching"); }
set { SetValue("EnableBacklogSearching", value); }
}
public virtual bool AutoIgnorePreviouslyDownloadedEpisodes
public bool AutoIgnorePreviouslyDownloadedEpisodes
{
get { return GetValueBoolean("AutoIgnorePreviouslyDownloadedEpisodes"); }
set { SetValue("AutoIgnorePreviouslyDownloadedEpisodes", value); }
}
public virtual int Retention
public int Retention
{
get { return GetValueInt("Retention", 0); }
set { SetValue("Retention", value); }
@ -364,162 +364,162 @@ namespace NzbDrone.Core.Configuration
get { return Guid.Parse(GetValue("UGuid", Guid.NewGuid().ToString(), persist: true)); }
}
public virtual DownloadClientType DownloadClient
public DownloadClientType DownloadClient
{
get { return (DownloadClientType)GetValueInt("DownloadClient"); }
set { SetValue("DownloadClient", (int)value); }
}
public virtual string BlackholeDirectory
public string BlackholeDirectory
{
get { return GetValue("BlackholeDirectory", String.Empty); }
set { SetValue("BlackholeDirectory", value); }
}
public virtual string ServiceRootUrl
public string ServiceRootUrl
{
get { return "http://services.nzbdrone.com"; }
}
public virtual Boolean PlexUpdateLibrary
public Boolean PlexUpdateLibrary
{
get { return GetValueBoolean("PlexUpdateLibrary"); }
set { SetValue("PlexUpdateLibrary", value); }
}
public virtual string PlexServerHost
public string PlexServerHost
{
get { return GetValue("PlexServerHost", "localhost:32400"); }
set { SetValue("PlexServerHost", value); }
}
public virtual string PlexClientHosts
public string PlexClientHosts
{
get { return GetValue("PlexClientHosts", "localhost:3000"); }
set { SetValue("PlexClientHosts", value); }
}
public virtual string PlexUsername
public string PlexUsername
{
get { return GetValue("PlexUsername"); }
set { SetValue("PlexUsername", value); }
}
public virtual string PlexPassword
public string PlexPassword
{
get { return GetValue("PlexPassword"); }
set { SetValue("PlexPassword", value); }
}
public virtual Boolean MetadataUseBanners
public Boolean MetadataUseBanners
{
get { return GetValueBoolean("MetadataUseBanners"); }
set { SetValue("MetadataUseBanners", value); }
}
public virtual string AllowedReleaseGroups
public string AllowedReleaseGroups
{
get { return GetValue("AllowedReleaseGroups"); }
set { SetValue("AllowedReleaseGroups", value); }
}
public virtual string PneumaticDirectory
public string PneumaticDirectory
{
get { return GetValue("PneumaticDirectory", String.Empty); }
set { SetValue("PneumaticDirectory", value); }
}
public virtual string RecycleBin
public string RecycleBin
{
get { return GetValue("RecycleBin", String.Empty); }
set { SetValue("RecycleBin", value); }
}
public virtual int RssSyncInterval
public int RssSyncInterval
{
get { return GetValueInt("RssSyncInterval", 25); }
set { SetValue("RssSyncInterval", value); }
}
public virtual string OmgwtfnzbsUsername
public string OmgwtfnzbsUsername
{
get { return GetValue("OmgwtfnzbsUsername", String.Empty); }
set { SetValue("OmgwtfnzbsUsername", value); }
}
public virtual string OmgwtfnzbsApiKey
public string OmgwtfnzbsApiKey
{
get { return GetValue("OmgwtfnzbsApiKey", String.Empty); }
set { SetValue("OmgwtfnzbsApiKey", value); }
}
public virtual Boolean IgnoreArticlesWhenSortingSeries
public Boolean IgnoreArticlesWhenSortingSeries
{
get { return GetValueBoolean("IgnoreArticlesWhenSortingSeries", true); }
set { SetValue("IgnoreArticlesWhenSortingSeries", value); }
}
public virtual Boolean DownloadClientUseSceneName
public Boolean DownloadClientUseSceneName
{
get { return GetValueBoolean("DownloadClientUseSceneName", false); }
set { SetValue("DownloadClientUseSceneName", value); }
}
public virtual String NzbgetUsername
public String NzbgetUsername
{
get { return GetValue("NzbgetUsername", "nzbget"); }
set { SetValue("NzbgetUsername", value); }
}
public virtual String NzbgetPassword
public String NzbgetPassword
{
get { return GetValue("NzbgetPassword", ""); }
set { SetValue("NzbgetPassword", value); }
}
public virtual String NzbgetHost
public String NzbgetHost
{
get { return GetValue("NzbgetHost", "localhost"); }
set { SetValue("NzbgetHost", value); }
}
public virtual Int32 NzbgetPort
public Int32 NzbgetPort
{
get { return GetValueInt("NzbgetPort", 6789); }
set { SetValue("NzbgetPort", value); }
}
public virtual String NzbgetTvCategory
public String NzbgetTvCategory
{
get { return GetValue("NzbgetTvCategory", "nzbget"); }
set { SetValue("NzbgetTvCategory", value); }
}
public virtual Int32 NzbgetPriority
public Int32 NzbgetPriority
{
get { return GetValueInt("NzbgetPriority", 0); }
set { SetValue("NzbgetPriority", value); }
}
public virtual PriorityType NzbgetBacklogTvPriority
public PriorityType NzbgetBacklogTvPriority
{
get { return (PriorityType)GetValueInt("NzbgetBacklogTvPriority"); }
set { SetValue("NzbgetBacklogTvPriority", (int)value); }
}
public virtual PriorityType NzbgetRecentTvPriority
public PriorityType NzbgetRecentTvPriority
{
get { return (PriorityType)GetValueInt("NzbgetRecentTvPriority"); }
@ -541,7 +541,7 @@ namespace NzbDrone.Core.Configuration
return Convert.ToInt32(GetValue(key, defaultValue));
}
public virtual string GetValue(string key, object defaultValue, bool persist = false)
public string GetValue(string key, object defaultValue, bool persist = false)
{
EnsureCache();