From 803ad8ca919f84e60b0459acd68818d8cc2ce9f7 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 29 May 2011 14:25:00 -0700 Subject: [PATCH] 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 | 99 +++++++++---------- 3 files changed, 98 insertions(+), 104 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 +
- +
+DVD +
+ +
+HDTV +
+ +
+WEBDL +
+ +
+Bluray720p +
+ +
+Bluray1080p +
+ +
+ +@Html.TextBox("result", "") - -
    -
  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 + $('.quality-selectee').click(function () { + if ($(this).hasClass('quality-selected')) + $(this).removeClass('quality-selected'); + else + $(this).addClass('quality-selected'); + + result = ""; + $(".quality-selected").each(function () { + result += this.firstChild.data + ","; + }); + + $("#result").empty().val(result); + }); + \ No newline at end of file