Remove AJAX tabs for settings pages

This commit is contained in:
Mark McDowall 2012-10-14 17:50:01 -07:00
parent 5f217f5720
commit 2e74a6ff05
15 changed files with 264 additions and 160 deletions

View File

@ -1,6 +1,11 @@
#top
{
overflow: auto;
margin: 20px;
overflow: hidden;
}
#top .settingsForm {
float: left;
}
#profileContainer
@ -59,7 +64,7 @@
.profileSection
{
float: left;
width: 270px;
width: 265px;
margin: 2px;
border:solid 1px #CCCCCD;
display: inline-block;
@ -74,7 +79,7 @@
margin-right: 20px;
font-weight: bold;
display: inline-block;
width: 50px;
width: 40px;
}
.profileOptions input, .profileOptions select
@ -142,7 +147,6 @@
width: 600px;
}
.slider-container
{
margin-bottom: 10px;
#QualityForm .ui-accordion .ui-accordion-content {
padding: 1em 2em;
}

View File

@ -115,5 +115,40 @@
}
.settingsForm .validation-error {
background: url("../Content/jQueryUI/images/ui-bg_flat_30_b40404_40x100.png") repeat-x scroll 50% 50% #B40404;
}
background: url("../Content/jQueryUI/images/ui-bg_flat_30_b40404_40x100.png") repeat-x scroll 50% 50% #B40404;
}
/* Navigation */
.settings-navigation {
line-height: normal;
list-style: none outside none;
margin-left: 5px;
margin-bottom: 30px;
padding: 5px 0px 20px 0px;
}
.settings-navigation li {
display: block;
float: left;
padding: 5px;
}
.settings-navigation li.current_action a {
background-color: #065EFE;
}
.settings-navigation a {
background-color: #191919;
color: white;
display: block;
float: left;
font-family: "Segoe UI","Open Sans","Segoe UI Light",sans-serif;
font-size: 16px;
font-weight: normal;
height: 26px;
padding: 2px 10px;
text-align: center;
text-decoration: none;
vertical-align: middle;
}

View File

@ -23,7 +23,6 @@ namespace NzbDrone.Web.Controllers
[HandleError]
public class SettingsController : Controller
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly ConfigProvider _configProvider;
private readonly IndexerProvider _indexerProvider;
private readonly QualityProvider _qualityProvider;
@ -36,6 +35,8 @@ namespace NzbDrone.Web.Controllers
private readonly MetadataProvider _metadataProvider;
private readonly JobProvider _jobProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
public SettingsController(ConfigProvider configProvider, IndexerProvider indexerProvider,
QualityProvider qualityProvider, AutoConfigureProvider autoConfigureProvider,
SeriesProvider seriesProvider, ExternalNotificationProvider externalNotificationProvider,
@ -59,7 +60,33 @@ namespace NzbDrone.Web.Controllers
public ActionResult Index()
{
return View();
return RedirectToAction("Naming", "Settings");
}
public ActionResult Naming()
{
var model = new EpisodeNamingModel();
model.SeriesName = _configProvider.SortingIncludeSeriesName;
model.EpisodeName = _configProvider.SortingIncludeEpisodeTitle;
model.ReplaceSpaces = _configProvider.SortingReplaceSpaces;
model.AppendQuality = _configProvider.SortingAppendQuality;
model.SeasonFolders = _configProvider.UseSeasonFolder;
model.SeasonFolderFormat = _configProvider.SortingSeasonFolderFormat;
model.SeparatorStyle = _configProvider.SortingSeparatorStyle;
model.NumberStyle = _configProvider.SortingNumberStyle;
model.MultiEpisodeStyle = _configProvider.SortingMultiEpisodeStyle;
model.SceneName = _configProvider.SortingUseSceneName;
model.SeparatorStyles = new SelectList(EpisodeSortingHelper.GetSeparatorStyles(), "Id", "Name");
model.NumberStyles = new SelectList(EpisodeSortingHelper.GetNumberStyles(), "Id", "Name");
model.MultiEpisodeStyles = new SelectList(EpisodeSortingHelper.GetMultiEpisodeStyles(), "Id", "Name");
//Metadata
model.MetadataXbmcEnabled = _metadataProvider.GetSettings(typeof(Core.Providers.Metadata.Xbmc)).Enable;
model.MetadataUseBanners = _configProvider.MetadataUseBanners;
return View(model);
}
public ActionResult Indexers()
@ -200,32 +227,6 @@ namespace NzbDrone.Web.Controllers
return View(model);
}
public ActionResult Naming()
{
var model = new EpisodeNamingModel();
model.SeriesName = _configProvider.SortingIncludeSeriesName;
model.EpisodeName = _configProvider.SortingIncludeEpisodeTitle;
model.ReplaceSpaces = _configProvider.SortingReplaceSpaces;
model.AppendQuality = _configProvider.SortingAppendQuality;
model.SeasonFolders = _configProvider.UseSeasonFolder;
model.SeasonFolderFormat = _configProvider.SortingSeasonFolderFormat;
model.SeparatorStyle = _configProvider.SortingSeparatorStyle;
model.NumberStyle = _configProvider.SortingNumberStyle;
model.MultiEpisodeStyle = _configProvider.SortingMultiEpisodeStyle;
model.SceneName = _configProvider.SortingUseSceneName;
model.SeparatorStyles = new SelectList(EpisodeSortingHelper.GetSeparatorStyles(), "Id", "Name");
model.NumberStyles = new SelectList(EpisodeSortingHelper.GetNumberStyles(), "Id", "Name");
model.MultiEpisodeStyles = new SelectList(EpisodeSortingHelper.GetMultiEpisodeStyles(), "Id", "Name");
//Metadata
model.MetadataXbmcEnabled = _metadataProvider.GetSettings(typeof(Core.Providers.Metadata.Xbmc)).Enable;
model.MetadataUseBanners = _configProvider.MetadataUseBanners;
return View(model);
}
public ActionResult System()
{
var selectedAuthenticationType = _configFileProvider.AuthenticationType;

View File

@ -7,7 +7,7 @@ namespace NzbDrone.Web.Helpers
{
public static class IsCurrentActionHelper
{
private static bool IsCurrentController(HtmlHelper helper, string actionName, string controllerName)
private static bool IsCurrentController(HtmlHelper helper, string controllerName)
{
var currentControllerName = (string) helper.ViewContext.RouteData.Values["controller"];
@ -17,12 +17,23 @@ namespace NzbDrone.Web.Helpers
return false;
}
public static string CurrentActionLink(this HtmlHelper helper, string text, string actionName,
string controllerName)
private static bool IsCurrentAction(HtmlHelper helper, string actionName, string controllerName)
{
var currentControllerName = (string)helper.ViewContext.RouteData.Values["controller"];
var currentActionName = (string)helper.ViewContext.RouteData.Values["action"];
if (currentControllerName.Equals(controllerName, StringComparison.CurrentCultureIgnoreCase) &&
currentActionName.Equals(actionName, StringComparison.CurrentCultureIgnoreCase))
return true;
return false;
}
public static string CurrentControllerLink(this HtmlHelper helper, string text, string actionName, string controllerName)
{
string result;
if (IsCurrentController(helper, actionName, controllerName))
if (IsCurrentController(helper, controllerName))
{
result = "<li class='current_page_item'>";
}
@ -33,5 +44,21 @@ namespace NzbDrone.Web.Helpers
return result + helper.ActionLink(text, actionName, controllerName).ToHtmlString() + @"</li>";
}
public static string CurrentActionLink(this HtmlHelper helper, string text, string actionName, string controllerName)
{
string result;
if (IsCurrentAction(helper, actionName, controllerName))
{
result = "<li class='current_action'>";
}
else
{
result = "<li>";
}
return result + helper.ActionLink(text, actionName, controllerName).ToHtmlString() + @"</li>";
}
}
}

View File

@ -412,6 +412,7 @@
<Content Include="Views\Settings\QualityProfileItem.cshtml" />
<Content Include="Views\System\Indexers.cshtml" />
<Content Include="Views\System\Config.cshtml" />
<Content Include="Views\Settings\_SettingsLayout.cshtml" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />

View File

@ -1,6 +1,10 @@
@using NzbDrone.Web.Helpers;
@model NzbDrone.Web.Models.DownloadClientSettingsModel
@{ Layout = null; }
@{
Layout = "_SettingsLayout.cshtml";
}
<style>
.downloadClient
{

View File

@ -1,34 +0,0 @@
@using NzbDrone.Web.Helpers
@{ViewBag.Title = "Settings";}
@section HeaderContent
{
@Html.IncludeCss("Settings.css")
@Html.IncludeCss("IndexerSettings.css")
@Html.IncludeCss("QualitySettings.css")
}
<div class="jquery-tabs">
<ul>
<li><a href="#Naming">Naming</a></li>
<li>@Html.ActionLink("Quality", "Quality", "Settings")</li>
<li>@Html.ActionLink("Indexers", "Indexers", "Settings")</li>
<li>@Html.ActionLink("Download Client", "DownloadClient", "Settings")</li>
<li>@Html.ActionLink("Notifications", "Notifications", "Settings")</li>
<li>@Html.ActionLink("System", "System", "Settings")</li>
<li>@Html.ActionLink("Misc", "Misc", "Settings")</li>
</ul>
<div id="Naming">@{ Html.RenderAction("Naming", "Settings"); }</div>
</div>
@section Scripts{
@Html.IncludeScript("NzbDrone/settings.js")
@Html.IncludeScript("NzbDrone/qualitySettings.js")
<script type="text/javascript">
$(document).ready(function () {
createExamples();
});
</script>
}

View File

@ -1,12 +1,16 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.IndexerSettingsModel
@{ Layout = null; }
@{
Layout = "_SettingsLayout.cshtml";
}
<style>
.indexerStatusContainer {
margin-left: 14px;
}
</style>
<div class="indexerStatusContainer">
@Html.CheckBox("nzbMatrixStatus", @Model.NzbMatrixEnabled, new { @class = "indexerStatusButton" })
<label for="nzbMatrixStatus">NZBMatrix</label>
@ -177,7 +181,9 @@
}
</div>
<script type="text/javascript">
@section Scripts
{
<script type="text/javascript">
$(document).ready(function () {
//Allow unobstrusive validation of the AJAX loaded form
$.validator.unobtrusive.parse("#IndexersForm");
@ -318,3 +324,4 @@
$("#title_" + profileId).text(value);
}).keyup();
</script>
}

View File

@ -1,6 +1,9 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.MiscSettingsModel
@{ Layout = null; }
@{
Layout = "_SettingsLayout.cshtml";
}
<div class="warningBox">
Enabling Backlog Searching can use lots of bandwidth and is not recommended for users with block Usenet accounts or bandwidth restrictions.

View File

@ -1,7 +1,6 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.EpisodeNamingModel
@model NzbDrone.Web.Models.EpisodeNamingModel
@{
Layout = null;
Layout = "_SettingsLayout.cshtml";
}
<style>
#examples
@ -35,4 +34,12 @@
<button type="submit" class="save_button" disabled="disabled">
Save</button>
}
</div>
</div>
@section Scripts{
<script type="text/javascript">
$(document).ready(function () {
createExamples();
});
</script>
}

View File

@ -1,5 +1,9 @@
@model NzbDrone.Web.Models.NotificationSettingsModel
@{ Layout = null; }
@{
Layout = "_SettingsLayout.cshtml";
}
<style>
.notifier
{
@ -54,38 +58,42 @@
Save</button>
}
</div>
<script type="text/javascript">
$(document).ready(function () {
//Allow unobstrusive validation of the AJAX loaded form
$.validator.unobtrusive.parse('#NotificationForm');
//Validator Settings
var settings = $.data($('#NotificationForm')[0], 'validator').settings;
settings.ignore = [];
settings.focusInvalid = false;
settings.onfocusout = function (element) { $(element).valid(); };
@section Scripts
{
<script type="text/javascript">
$(document).ready(function() {
//Allow unobstrusive validation of the AJAX loaded form
$.validator.unobtrusive.parse('#NotificationForm');
var oldHighlight = settings.highlight;
var oldUnhighlight = settings.unhighlight;
//Validator Settings
var settings = $.data($('#NotificationForm')[0], 'validator').settings;
settings.ignore = [];
settings.focusInvalid = false;
settings.onfocusout = function(element) { $(element).valid(); };
settings.highlight = function (element, errorClass, validClass) {
oldHighlight(element, errorClass, validClass);
$(element).parents('div.ui-accordion-content').prev('h3.ui-accordion-header').addClass('validation-error');
};
settings.unhighlight = function (element, errorClass, validClass) {
oldUnhighlight(element, errorClass, validClass);
var oldHighlight = settings.highlight;
var oldUnhighlight = settings.unhighlight;
var container = $(element).parents('div.ui-accordion-content');
if ($(container).children('.' + errorClass).length == 0)
settings.highlight = function(element, errorClass, validClass) {
oldHighlight(element, errorClass, validClass);
$(element).parents('div.ui-accordion-content').prev('h3.ui-accordion-header').addClass('validation-error');
};
settings.unhighlight = function(element, errorClass, validClass) {
oldUnhighlight(element, errorClass, validClass);
var container = $(element).parents('div.ui-accordion-content');
if ($(container).children('.' + errorClass).length == 0)
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
};
});
$(document).on('change', '.checkClass', function() {
$("#NotificationForm").validate().form();
var container = $('div.ui-accordion-content');
if ($(container).children('.input-validation-error').length == 0)
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
};
});
$(document).on('change', '.checkClass', function () {
$("#NotificationForm").validate().form();
var container = $('div.ui-accordion-content');
if ($(container).children('.input-validation-error').length == 0)
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
});
</script>
});
</script>
}

View File

@ -1,11 +1,15 @@
@using NzbDrone.Core.Repository.Quality
@using NzbDrone.Web.Helpers;
@model NzbDrone.Web.Models.QualityModel
@{ Layout = null; }
@{
Layout = "_SettingsLayout.cshtml";
}
<div id="stylized">
@using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "QualityForm", name = "QualityForm" }))
@using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "QualityForm", name = "QualityForm", @class = "settingsForm" }))
{
<div id="top" class="settingsForm">
<div id="top">
<label class="labelClass">@Html.LabelFor(m => m.DefaultQualityProfileId)
<span class="small">@Html.DescriptionFor(m => m.DefaultQualityProfileId)</span>
</label>
@ -41,7 +45,7 @@
</div>
@Html.HiddenFor(m => m.SdtvMaxSize, new { @class = "slider-value" })
30 minute size: <span class="30-minute"></span>MB | 60 minute size: <span class="60-minute">
</span>MB
</span>MB
</div>
<div class="slider-container">
<b>DVD</b>
@ -49,7 +53,7 @@
</div>
@Html.HiddenFor(m => m.DvdMaxSize, new { @class = "slider-value" })
30 minute size: <span class="30-minute"></span>MB | 60 minute size: <span class="60-minute">
</span>MB
</span>MB
</div>
<div class="slider-container">
<b>HDTV</b>
@ -57,7 +61,7 @@
</div>
@Html.HiddenFor(m => m.HdtvMaxSize, new { @class = "slider-value" })
30 minute size: <span class="30-minute"></span>MB | 60 minute size: <span class="60-minute">
</span>MB
</span>MB
</div>
<div class="slider-container">
<b>WEBDL</b>
@ -65,7 +69,7 @@
</div>
@Html.HiddenFor(m => m.WebdlMaxSize, new { @class = "slider-value" })
30 minute size: <span class="30-minute"></span>MB | 60 minute size: <span class="60-minute">
</span>MB
</span>MB
</div>
<div class="slider-container">
<b>Bluray 720p</b>
@ -73,7 +77,7 @@
</div>
@Html.HiddenFor(m => m.Bluray720pMaxSize, new { @class = "slider-value" })
30 minute size: <span class="30-minute"></span>MB | 60 minute size: <span class="60-minute">
</span>MB
</span>MB
</div>
<div class="slider-container">
<b>Bluray 1080p</b>
@ -81,7 +85,7 @@
</div>
@Html.HiddenFor(m => m.Bluray1080pMaxSize, new { @class = "slider-value" })
30 minute size: <span class="30-minute"></span>MB | 60 minute size: <span class="60-minute">
</span>MB
</span>MB
</div>
</div>
</div>
@ -90,12 +94,17 @@
Save</button>
}
</div>
<script type="text/javascript">
$(document).ready(function () {
setupSliders();
});
$('.quality-selectee').livequery(function () {
$(this).button();
});
</script>
@section Scripts {
<script type="text/javascript">
@Html.IncludeScript("NzbDrone/qualitySettings.js")
$(document).ready(function() {
setupSliders();
});
$('.quality-selectee').livequery(function() {
$(this).button();
});
</script>
}

View File

@ -1,7 +1,9 @@
@using NzbDrone.Web.Helpers
@model NzbDrone.Web.Models.SystemSettingsModel
@{ Layout = null; }
@{
Layout = "_SettingsLayout.cshtml";
}
<div class="infoBox">
You must manually restart NzbDrone for these changes to take effect. (Automatic restart coming soon!)
@ -43,30 +45,33 @@
}
</div>
<script type="text/javascript">
$(document).ready(function () {
//Allow unobstrusive validation of the AJAX loaded form
$.validator.unobtrusive.parse('#SystemForm');
@section Scripts
{
<script type="text/javascript">
$(document).ready(function() {
//Allow unobstrusive validation of the AJAX loaded form
$.validator.unobtrusive.parse('#SystemForm');
//Validator Settings
var settings = $.data($('#SystemForm')[0], 'validator').settings;
settings.ignore = [];
settings.focusInvalid = false;
settings.onfocusout = function (element) { $(element).valid(); };
//Validator Settings
var settings = $.data($('#SystemForm')[0], 'validator').settings;
settings.ignore = [];
settings.focusInvalid = false;
settings.onfocusout = function(element) { $(element).valid(); };
var oldHighlight = settings.highlight;
var oldUnhighlight = settings.unhighlight;
var oldHighlight = settings.highlight;
var oldUnhighlight = settings.unhighlight;
settings.highlight = function (element, errorClass, validClass) {
oldHighlight(element, errorClass, validClass);
$(element).parents('div.ui-accordion-content').prev('h3.ui-accordion-header').addClass('validation-error');
};
settings.unhighlight = function (element, errorClass, validClass) {
oldUnhighlight(element, errorClass, validClass);
settings.highlight = function(element, errorClass, validClass) {
oldHighlight(element, errorClass, validClass);
$(element).parents('div.ui-accordion-content').prev('h3.ui-accordion-header').addClass('validation-error');
};
settings.unhighlight = function(element, errorClass, validClass) {
oldUnhighlight(element, errorClass, validClass);
var container = $(element).parents('div.ui-accordion-content');
if ($(container).children('.' + errorClass).length == 0)
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
};
});
</script>
var container = $(element).parents('div.ui-accordion-content');
if ($(container).children('.' + errorClass).length == 0)
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
};
});
</script>
}

View File

@ -0,0 +1,27 @@
@using NzbDrone.Web.Helpers
@{ Layout = "~/Views/Shared/_Layout.cshtml"; }
@section HeaderContent
{
@Html.IncludeCss("Settings.css")
@Html.IncludeCss("IndexerSettings.css")
@Html.IncludeCss("QualitySettings.css")
}
<ul class="settings-navigation">
@MvcHtmlString.Create(Html.CurrentActionLink("Naming", "Naming", "Settings"))
@MvcHtmlString.Create(Html.CurrentActionLink("Quality", "Quality", "Settings"))
@MvcHtmlString.Create(Html.CurrentActionLink("Indexers", "Indexers", "Settings"))
@MvcHtmlString.Create(Html.CurrentActionLink("Download Client", "DownloadClient", "Settings"))
@MvcHtmlString.Create(Html.CurrentActionLink("Notifications", "Notifications", "Settings"))
@MvcHtmlString.Create(Html.CurrentActionLink("System", "System", "Settings"))
@MvcHtmlString.Create(Html.CurrentActionLink("Misc", "Misc", "Settings"))
</ul>
@RenderBody()
@section Scripts{
@Html.IncludeScript("NzbDrone/settings.js")
@RenderSection("Scripts", required: false)
}

View File

@ -24,12 +24,12 @@
<div id="centered">
<div id="menu">
<ul>
@MvcHtmlString.Create(Html.CurrentActionLink("Series", "Index", "Series"))
@MvcHtmlString.Create(Html.CurrentActionLink("Upcoming", "Index", "Upcoming"))
@MvcHtmlString.Create(Html.CurrentActionLink("History", "Index", "History"))
@MvcHtmlString.Create(Html.CurrentActionLink("Missing", "Index", "Missing"))
@MvcHtmlString.Create(Html.CurrentActionLink("Settings", "Index", "Settings"))
@MvcHtmlString.Create(Html.CurrentActionLink("Logs", "Index", "Log"))
@MvcHtmlString.Create(Html.CurrentControllerLink("Series", "Index", "Series"))
@MvcHtmlString.Create(Html.CurrentControllerLink("Upcoming", "Index", "Upcoming"))
@MvcHtmlString.Create(Html.CurrentControllerLink("History", "Index", "History"))
@MvcHtmlString.Create(Html.CurrentControllerLink("Missing", "Index", "Missing"))
@MvcHtmlString.Create(Html.CurrentControllerLink("Settings", "Index", "Settings"))
@MvcHtmlString.Create(Html.CurrentControllerLink("Logs", "Index", "Log"))
</ul>
<input id="localSeriesLookup" type="text" />
</div>