From 859c5246d90ab7e0b69580831139a0cfe6096998 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Fri, 1 Jul 2011 02:10:42 -0700 Subject: [PATCH] Overhauled Settings/Quality CSS for Settings uses classes for aligning instead of label/input directly. --- NzbDrone.Web/Content/QualitySettings.css | 116 +++++++++++++ NzbDrone.Web/Content/Settings.css | 9 +- .../Controllers/SettingsController.cs | 9 +- NzbDrone.Web/NzbDrone.Web.csproj | 1 + NzbDrone.Web/Views/Settings/Quality.cshtml | 151 +++++++++++------ .../Views/Settings/QualityProfileItem.cshtml | 152 +++++------------- NzbDrone.Web/Views/Settings/Sabnzbd.cshtml | 38 ++--- 7 files changed, 288 insertions(+), 188 deletions(-) create mode 100644 NzbDrone.Web/Content/QualitySettings.css diff --git a/NzbDrone.Web/Content/QualitySettings.css b/NzbDrone.Web/Content/QualitySettings.css new file mode 100644 index 000000000..fc0679fa0 --- /dev/null +++ b/NzbDrone.Web/Content/QualitySettings.css @@ -0,0 +1,116 @@ +#bottom +{ + margin-top: -25px; + margin-left: 15px; +} + +#addItem +{ + text-decoration: none; + font-size:16px; + color: black; + font-weight:bold; +} + +#profileHeader +{ + margin-bottom: 5px; +} + +/* QualityProfileItem */ +.quality-selectee +{ + border-color: #065EFE; + border-style: solid; + border-width: 1px; + width: 75px; + padding: 1px; + padding-left: 3px; + padding-right: 3px; + margin: 2px; + float: left; + cursor: default; +} +.quality-selecting +{ + background: #85AEF9; +} +.quality-selected +{ + background: #065EFE; + color: white; +} + +.profileSection +{ + float: left; + height: 157px; + width: 270px; + margin: 2px; + border:solid 1px #CCCCCD; + display: inline-block; + overflow: hidden; +} + +.profileOptions label +{ + margin-top: 10px; + margin-left: 7px; + margin-right: 25px; + float: left; + font-weight: bold; + width: 50px; +} + +.profileOptions input, .profileOptions select +{ + font-size:12px; + padding:4px 2px; + border:solid 1px #aacfe4; + width:170px; + margin-right: 2px; +} + +.profileOptions select +{ + width:176px; +} + +.qualitySelector +{ + padding-left: 5px; +} + +.deleteProfile +{ + position: absolute; + top: 0px; + right: 0px; +} + +.titleText +{ + font-size: 1.5em; + line-height: 1; + margin-bottom: 1em; + display:inline; + position: absolute; + top: -1px; + left: 2px; + padding-bottom: 0px; + white-space:nowrap; +} + +.qualityHeader +{ + background: #d7e6f2; /* Old browsers */ + background: -moz-linear-gradient(left, #d7e6f2 0%, #57a9c6 100%); /* FF3.6+ */ + background: -webkit-gradient(linear, left top, right top, color-stop(0%,#d7e6f2), color-stop(100%,#57a9c6)); /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(left, #d7e6f2 0%,#57a9c6 100%); /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(left, #d7e6f2 0%,#57a9c6 100%); /* Opera11.10+ */ + background: -ms-linear-gradient(left, #d7e6f2 0%,#57a9c6 100%); /* IE10+ */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d7e6f2', endColorstr='#57a9c6',GradientType=1 ); /* IE6-9 */ + background: linear-gradient(left, #d7e6f2 0%,#57a9c6 100%); /* W3C */ + min-height: 23px; + position: relative; +} \ No newline at end of file diff --git a/NzbDrone.Web/Content/Settings.css b/NzbDrone.Web/Content/Settings.css index 6ba5707bf..dc5852615 100644 --- a/NzbDrone.Web/Content/Settings.css +++ b/NzbDrone.Web/Content/Settings.css @@ -36,7 +36,7 @@ p, h1, form, button{border:0; margin:0; padding:0;} padding-bottom:10px; } -#stylized label +#stylized .labelClass { display:block; font-weight:bold; @@ -55,7 +55,7 @@ p, h1, form, button{border:0; margin:0; padding:0;} width:340px; } -#stylized input, select +#stylized .inputClass { float:left; font-size:12px; @@ -65,6 +65,11 @@ p, h1, form, button{border:0; margin:0; padding:0;} margin:2px 0 20px 10px; } +#stylized .selectClass +{ + width: 206px; +} + #stylized button { clear:both; diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 2f4583a80..e45cb7487 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -125,6 +125,12 @@ namespace NzbDrone.Web.Controllers ViewData["Qualities"] = qualityTypes; var profiles = _qualityProvider.GetAllProfiles().ToList(); + + foreach (var qualityProfile in profiles) + { + qualityProfile.AllowedString = string.Join(",", qualityProfile.Allowed); + } + var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.DefaultQualityProfile); var qualityProfileSelectList = new SelectList(profiles, "QualityProfileId", "Name"); @@ -201,11 +207,12 @@ namespace NzbDrone.Web.Controllers { Name = "New Profile", Allowed = new List { QualityTypes.Unknown }, - Cutoff = QualityTypes.Unknown, + Cutoff = QualityTypes.Unknown }; var id = _qualityProvider.Add(qualityProfile); qualityProfile.QualityProfileId = id; + qualityProfile.AllowedString = "Unknown"; ViewData["ProfileId"] = id; diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 1466a16e2..173d159fc 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -493,6 +493,7 @@ + diff --git a/NzbDrone.Web/Views/Settings/Quality.cshtml b/NzbDrone.Web/Views/Settings/Quality.cshtml index 7b98e773c..04ecba17d 100644 --- a/NzbDrone.Web/Views/Settings/Quality.cshtml +++ b/NzbDrone.Web/Views/Settings/Quality.cshtml @@ -3,6 +3,27 @@ @section HeaderContent{ + + + + } @section TitleContent{ @@ -14,43 +35,40 @@ } @section MainContent{ -@using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "form", name = "form" })) -{ -
- Quality -
-
-
-
@Html.LabelFor(m => m.DefaultQualityProfileId)
-
@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList)
-
-
-
@Html.ValidationMessageFor(m => m.DefaultQualityProfileId)
-
@Html.DescriptionFor(m => m.DefaultQualityProfileId)
-
-
-
-
-
- - Add New Profile -

- Add New Profile

-
+
+ @using (Html.BeginForm("SaveQuality", "Settings", FormMethod.Post, new { id = "form", name = "form" })) + { +
+

Quality

+

+ + @Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList, new { @class = "inputClass" })
-
- @foreach (var item in Model.Profiles) - { - Html.RenderAction("GetQualityProfileView", item); - } + +
+
+ + +
+ @foreach (var item in Model.Profiles) + { + Html.RenderAction("GetQualityProfileView", item); + } +
+
+ + Loader
-
- -
-} -
+ + }
+ +
} @section Scripts{ @@ -58,23 +76,6 @@ } diff --git a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml index 25599cab6..9291d4acf 100644 --- a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml +++ b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml @@ -5,127 +5,49 @@ @{ Layout = null; } - + @using (Html.BeginCollectionItem("Profiles")) { var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); - string selectable = String.Format("{0}_selectable", idClean); - string allowedStringName = String.Format("{0}_AllowedString", idClean); - string title = String.Format("{0}_Title", idClean); - string nameBox = String.Format("{0}_Name", idClean); - string cutoff = String.Format("{0}_Cutoff", idClean); - -
-
-
-
-

- @{Html.DisplayTextFor(m => m.Name);} -

- - Delete -
-
-
@Html.LabelFor(x => x.Name)
-
@Html.TextBoxFor(x => x.Name, new { maxlength = 15, style="width: 150px" })
-
@Html.ValidationMessageFor(x => x.Name)
-
-
-
@Html.LabelFor(x => x.Cutoff)
-
@Html.DropDownListFor(m => m.Cutoff, new SelectList(Model.Allowed, Model.Cutoff))
-
@Html.ValidationMessageFor(x => x.Cutoff)
-
-
-
-
- @{var qualitiesList = (List)ViewData["Qualities"];} - @for (int i = 0; i < qualitiesList.Count(); i++) +
+
+ + @Model.Name + + + Delete +
+
+ @Html.LabelFor(x => x.Name) + @Html.TextBoxFor(x => x.Name, new {@class = "profileName_textbox"}) + + @Html.LabelFor(x => x.Cutoff) + @Html.DropDownListFor(m => m.Cutoff, new SelectList(Model.Allowed, Model.Cutoff)) +
+
+ @{ var qualitiesList = (List) ViewData["Qualities"]; } + @for (int i = 0; i < qualitiesList.Count(); i++) + { + if (qualitiesList[i].ToString() == "Unknown") + { + continue; + } + + if (Model.Allowed != null) + { + if (Model.Allowed.Contains(qualitiesList[i])) { - if (qualitiesList[i].ToString() == "Unknown") - { - continue; - } - - if (Model.Allowed != null) - { - if (Model.Allowed.Contains(qualitiesList[i])) - { -
@qualitiesList[i].ToString()
- continue; - } - } - -
@qualitiesList[i].ToString()
+
@qualitiesList[i].ToString()
+ continue; } -
-
-
- @Html.HiddenFor(x => x.QualityProfileId) - @Html.HiddenFor(m => m.AllowedString) -
-
-
- - + + @Html.HiddenFor(x => x.QualityProfileId, new {@class = "qualityProfileId"}) + @Html.HiddenFor(m => m.AllowedString) + @Html.Hidden("cleanId", idClean, new {@class = "cleanId"}) + } \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml b/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml index a0e5a0ec5..cc2ce896e 100644 --- a/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml +++ b/NzbDrone.Web/Views/Settings/Sabnzbd.cshtml @@ -21,50 +21,50 @@

SABnzbd

-