1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-14 11:23:42 +02:00

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

@ -117,3 +117,38 @@
.settingsForm .validation-error {
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 @@ public class SettingsController : Controller
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 @@ public SettingsController(ConfigProvider configProvider, IndexerProvider indexer
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 @@ public ActionResult Notifications()
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 @@ private static bool IsCurrentController(HtmlHelper helper, string actionName, st
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 @@ public static string CurrentActionLink(this HtmlHelper helper, string text, stri
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,6 +181,8 @@
}
</div>
@section Scripts
{
<script type="text/javascript">
$(document).ready(function () {
//Allow unobstrusive validation of the AJAX loaded form
@ -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
@ -36,3 +35,11 @@
Save</button>
}
</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,6 +58,9 @@
Save</button>
}
</div>
@section Scripts
{
<script type="text/javascript">
$(document).ready(function() {
//Allow unobstrusive validation of the AJAX loaded form
@ -89,3 +96,4 @@
$(container).prev('h3.ui-accordion-header').removeClass('validation-error');
});
</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>
@ -90,7 +94,11 @@
Save</button>
}
</div>
@section Scripts {
<script type="text/javascript">
@Html.IncludeScript("NzbDrone/qualitySettings.js")
$(document).ready(function() {
setupSliders();
});
@ -99,3 +107,4 @@
$(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,6 +45,8 @@
}
</div>
@section Scripts
{
<script type="text/javascript">
$(document).ready(function() {
//Allow unobstrusive validation of the AJAX loaded form
@ -70,3 +74,4 @@
};
});
</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>