From 803ad8ca919f84e60b0459acd68818d8cc2ce9f7 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 29 May 2011 14:25:00 -0700 Subject: [PATCH 1/2] Removed jQuery UI selectable, using custom select boxes now. Cutoff dropbox is dynamic (based on selected qualities). --- .../Controllers/SettingsController.cs | 4 +- .../Views/Settings/QualityProfileItem.cshtml | 99 ++++++++--------- NzbDrone.Web/Views/Settings/Test.cshtml | 101 ++++++++---------- 3 files changed, 99 insertions(+), 105 deletions(-) diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 414ca01a6..f70e006ba 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -472,8 +472,8 @@ namespace NzbDrone.Web.Controllers profile.Allowed = new List(); - //Remove the extra comma from the end and replace double commas with a single one (the Javascript gets a little crazy) - profile.AllowedString = profile.AllowedString.Replace(",,", ",").Trim(','); + //Remove the extra comma from the end + profile.AllowedString = profile.AllowedString.Trim(','); foreach (var quality in profile.AllowedString.Split(',')) { diff --git a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml index aea894c63..b5a6ebaf7 100644 --- a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml +++ b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml @@ -7,11 +7,11 @@ Layout = null; } - + @using (Html.BeginCollectionItem("Profiles")) { @@ -22,36 +22,7 @@ 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", ugly); - - - - + string cutoff = String.Format("{0}_Cutoff", idClean);
@@ -70,49 +41,81 @@
@Html.LabelFor(x => x.Cutoff)
-
@Html.DropDownListFor(m => m.Cutoff, new SelectList(ViewData["Qualities"] as IEnumerable, Model.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++) { + if (qualitiesList[i].ToString() == "Unknown") + { + continue; + } + if (Model.Allowed != null) { if (Model.Allowed.Contains(qualitiesList[i])) { -
  1. - @Html.Label(qualitiesList[i].ToString()) -
  2. +
    @qualitiesList[i].ToString()
    continue; } } -
  3. - @Html.Label(qualitiesList[i].ToString()) -
  4. +
    @qualitiesList[i].ToString()
    } -
+
-
+
@Html.HiddenFor(x => x.QualityProfileId) @Html.HiddenFor(x => x.UserProfile) @Html.HiddenFor(m => m.AllowedString)
-
+ } \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/Test.cshtml b/NzbDrone.Web/Views/Settings/Test.cshtml index 5f27b2002..e2ec5cac0 100644 --- a/NzbDrone.Web/Views/Settings/Test.cshtml +++ b/NzbDrone.Web/Views/Settings/Test.cshtml @@ -1,58 +1,49 @@ -Hello World - -Check 1
- Check 2
- Check 3
- Check 4
- Check 5
- Check 6
- Check 7
- - - - - - - +
+SDTV +
-
    -
  1. Unknown
  2. -
  3. SDTV
  4. -
  5. DVD
  6. -
  7. HDTV
  8. -
  9. WEBDL
  10. -
  11. Bluray720p
  12. -
  13. Bluray1080p
  14. -
\ No newline at end of file +
+DVD +
+ +
+HDTV +
+ +
+WEBDL +
+ +
+Bluray720p +
+ +
+Bluray1080p +
+ +
+ +@Html.TextBox("result", "") + + \ No newline at end of file From cd85964edd22db1a88097e85c8b18b00504a1c80 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 29 May 2011 15:44:05 -0700 Subject: [PATCH 2/2] Fixed add new profile. Removed DownloadPropers bool. --- NzbDrone.Web/Controllers/SettingsController.cs | 8 +------- NzbDrone.Web/Models/QualityModel.cs | 4 ---- NzbDrone.Web/Views/Settings/Quality.cshtml | 13 +------------ 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index f70e006ba..b88d81708 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -134,17 +134,13 @@ namespace NzbDrone.Web.Controllers ViewData["Qualities"] = qualityTypes; var profiles = _qualityProvider.GetAllProfiles().ToList(); - var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.DefaultQualityProfile); - var downloadPropers = _configProvider.DownloadPropers; - var qualityProfileSelectList = new SelectList(profiles, "QualityProfileId", "Name"); var model = new QualityModel { Profiles = profiles, DefaultQualityProfileId = defaultQualityQualityProfileId, - DownloadPropers = downloadPropers, QualityProfileSelectList = qualityProfileSelectList }; @@ -208,7 +204,7 @@ namespace NzbDrone.Web.Controllers qualityTypes.Add(qual); } - ViewData["Qualities"] = new SelectList(qualityTypes); + ViewData["Qualities"] = qualityTypes; var qualityProfile = new QualityProfile { @@ -219,7 +215,6 @@ namespace NzbDrone.Web.Controllers var id = _qualityProvider.Add(qualityProfile); qualityProfile.QualityProfileId = id; - qualityProfile.Allowed = null; ViewData["ProfileId"] = id; @@ -460,7 +455,6 @@ namespace NzbDrone.Web.Controllers if (ModelState.IsValid) { _configProvider.DefaultQualityProfile = data.DefaultQualityProfileId; - _configProvider.DownloadPropers = data.DownloadPropers; //Saves only the Default Quality, skips User Profiles since none exist if (data.Profiles == null) diff --git a/NzbDrone.Web/Models/QualityModel.cs b/NzbDrone.Web/Models/QualityModel.cs index 43794feec..0b6263b46 100644 --- a/NzbDrone.Web/Models/QualityModel.cs +++ b/NzbDrone.Web/Models/QualityModel.cs @@ -13,10 +13,6 @@ namespace NzbDrone.Web.Models [Description("The default quality to use when adding series to NzbDrone")] public int DefaultQualityProfileId { get; set; } - [DisplayName("Download Propers")] - [Description("Should NzbDrone download proper releases (to replace non-proper files)?")] - public bool DownloadPropers { get; set; } - public SelectList QualityProfileSelectList { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/Views/Settings/Quality.cshtml b/NzbDrone.Web/Views/Settings/Quality.cshtml index f25800fa9..6443077fd 100644 --- a/NzbDrone.Web/Views/Settings/Quality.cshtml +++ b/NzbDrone.Web/Views/Settings/Quality.cshtml @@ -48,17 +48,6 @@ Quality
-
-
-
@Html.LabelFor(m => m.DownloadPropers)
-
@Html.CheckBoxFor(m => m.DownloadPropers)
-
-
-
@Html.ValidationMessageFor(m => m.DownloadPropers)
-
@Html.DescriptionFor(m => m.DownloadPropers)
-
-
-
@Html.LabelFor(m => m.DefaultQualityProfileId)
@@ -103,7 +92,7 @@ url: this.href, cache: false, success: function (html) { - $("#profiles").prepend(html); + $("#profiles").append(html); } });