diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index 3dc0cbf32..414ca01a6 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -138,14 +138,14 @@ namespace NzbDrone.Web.Controllers var defaultQualityQualityProfileId = Convert.ToInt32(_configProvider.DefaultQualityProfile); var downloadPropers = _configProvider.DownloadPropers; - var selectList = new SelectList(profiles, "QualityProfileId", "Name"); + var qualityProfileSelectList = new SelectList(profiles, "QualityProfileId", "Name"); var model = new QualityModel { Profiles = profiles, DefaultQualityProfileId = defaultQualityQualityProfileId, DownloadPropers = downloadPropers, - SelectList = selectList + QualityProfileSelectList = qualityProfileSelectList }; return View("Index", model); @@ -208,7 +208,7 @@ namespace NzbDrone.Web.Controllers qualityTypes.Add(qual); } - ViewData["Qualities"] = qualityTypes; + ViewData["Qualities"] = new SelectList(qualityTypes); var qualityProfile = new QualityProfile { @@ -234,6 +234,7 @@ namespace NzbDrone.Web.Controllers { qualityTypes.Add(qual); } + ViewData["Qualities"] = qualityTypes; ViewData["ProfileId"] = profile.QualityProfileId; @@ -286,7 +287,7 @@ namespace NzbDrone.Web.Controllers Convert.ToInt32(_configProvider.GetValue("DefaultQualityProfile", profiles[0].QualityProfileId, true)); var selectList = new SelectList(profiles, "QualityProfileId", "Name"); - return new QualityModel { DefaultQualityProfileId = defaultQualityQualityProfileId, SelectList = selectList }; + return new QualityModel { DefaultQualityProfileId = defaultQualityQualityProfileId, QualityProfileSelectList = selectList }; } public JsonResult DeleteQualityProfile(int profileId) @@ -470,6 +471,10 @@ namespace NzbDrone.Web.Controllers Logger.Debug(String.Format("Updating Profile: {0}", profile)); 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(','); + foreach (var quality in profile.AllowedString.Split(',')) { var qType = (QualityTypes)Enum.Parse(typeof(QualityTypes), quality); diff --git a/NzbDrone.Web/Models/QualityModel.cs b/NzbDrone.Web/Models/QualityModel.cs index 47e173b8e..43794feec 100644 --- a/NzbDrone.Web/Models/QualityModel.cs +++ b/NzbDrone.Web/Models/QualityModel.cs @@ -17,6 +17,6 @@ namespace NzbDrone.Web.Models [Description("Should NzbDrone download proper releases (to replace non-proper files)?")] public bool DownloadPropers { get; set; } - public SelectList SelectList { get; set; } + public SelectList QualityProfileSelectList { get; set; } } } \ No newline at end of file diff --git a/NzbDrone.Web/Models/QualityTypeModel.cs b/NzbDrone.Web/Models/QualityTypeModel.cs new file mode 100644 index 000000000..357395ddf --- /dev/null +++ b/NzbDrone.Web/Models/QualityTypeModel.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using NzbDrone.Core.Repository.Quality; + +namespace NzbDrone.Web.Models +{ + public class QualityTypeModel + { + public int Id { get; set; } + public QualityTypes Name { get; set; } + } +} \ No newline at end of file diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 89e3be2c8..a75cebce3 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -237,6 +237,7 @@ + diff --git a/NzbDrone.Web/Views/Settings/Quality.cshtml b/NzbDrone.Web/Views/Settings/Quality.cshtml index 45a13d697..f25800fa9 100644 --- a/NzbDrone.Web/Views/Settings/Quality.cshtml +++ b/NzbDrone.Web/Views/Settings/Quality.cshtml @@ -62,7 +62,7 @@
@Html.LabelFor(m => m.DefaultQualityProfileId)
-
@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.SelectList)
+
@Html.DropDownListFor(m => m.DefaultQualityProfileId, Model.QualityProfileSelectList)
@Html.ValidationMessageFor(m => m.DefaultQualityProfileId)
diff --git a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml index fb5c119ef..aea894c63 100644 --- a/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml +++ b/NzbDrone.Web/Views/Settings/QualityProfileItem.cshtml @@ -1,4 +1,5 @@ @model NzbDrone.Core.Repository.Quality.QualityProfile +@using System.Collections @using NzbDrone.Core.Repository.Quality @using NzbDrone.Web.Helpers @@ -17,123 +18,92 @@ var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); var ugly = ViewData.TemplateInfo.HtmlFieldPrefix; - string sortable1 = String.Format("{0}_sortable1", idClean); - string sortable2 = String.Format("{0}_sortable2", idClean); + string selectable = String.Format("{0}_selectable", idClean); string allowedStringName = String.Format("{0}_AllowedString", idClean); - string connectedSortable = String.Format("connected{0}", idClean); string title = String.Format("{0}_Title", idClean); string nameBox = String.Format("{0}_Name", idClean); string cutoff = String.Format("{0}.Cutoff", ugly); - - + + }); + }) +
-
-
+
+
+
+

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

+ Delete +
-
-

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

- Delete -
+
+
@Html.LabelFor(x => x.Name)
+
@Html.TextBoxFor(x => x.Name, new { maxlength = 16 })
+
@Html.ValidationMessageFor(x => x.Name)
+
-
-
@Html.LabelFor(x => x.Name)
-
@Html.TextBoxFor(x => x.Name, new { maxlength = 16})
-
@Html.ValidationMessageFor(x => x.Name)
+
+
@Html.LabelFor(x => x.Cutoff)
+
@Html.DropDownListFor(m => m.Cutoff, new SelectList(ViewData["Qualities"] as IEnumerable, Model.Cutoff))
+
@Html.ValidationMessageFor(x => x.Cutoff)
+
-
-
-

Allowed

-
    - @if (Model.Allowed != null) +
    +
      + + @{var qualitiesList = (List)ViewData["Qualities"];} + + @for (int i = 0; i < qualitiesList.Count(); i++) + { + if (Model.Allowed != null) { - for (int i = 0; i < Model.Allowed.Count(); i++) + if (Model.Allowed.Contains(qualitiesList[i])) { -
    1. - @Html.RadioButtonFor(x => x.Cutoff, Model.Allowed[i]) - @Html.DisplayTextFor(c => c.Allowed[i]) +
    2. + @Html.Label(qualitiesList[i].ToString())
    3. + continue; } } -
-
- -
-

Not-Allowed

-
    - - @{var qualitiesList = (List)ViewData["Qualities"];} - - @for (int i = 0; i < qualitiesList.Count(); i++) - { - //Skip Unknown and any item that is in the allowed list - //if (qualitiesList[i].ToString() == "Unknown") - //{ - // continue; - //} - - if (Model.Allowed != null) - { - if (Model.Allowed.Contains(qualitiesList[i])) - { - continue; - } - } - -
  • - @Html.RadioButtonFor(x => x.Cutoff, qualitiesList[i]) - @Html.Label(qualitiesList[i].ToString()) -
  • - } -
-
+ +
  • + @Html.Label(qualitiesList[i].ToString()) +
  • + } +
    - @Html.ValidationMessageFor(x => x.Cutoff) - -
    - @Html.TextBoxFor(x => x.QualityProfileId, new { @style = "display:none" }) - @Html.CheckBoxFor(x => x.UserProfile, new { @style = "display:none" }) - @Html.TextBoxFor(m => m.AllowedString, new { @style = "display:none" }) +
    + @Html.HiddenFor(x => x.QualityProfileId) + @Html.HiddenFor(x => x.UserProfile) + @Html.HiddenFor(m => m.AllowedString)
    diff --git a/NzbDrone.Web/Views/Settings/Test.cshtml b/NzbDrone.Web/Views/Settings/Test.cshtml index 05eac029f..5f27b2002 100644 --- a/NzbDrone.Web/Views/Settings/Test.cshtml +++ b/NzbDrone.Web/Views/Settings/Test.cshtml @@ -1 +1,58 @@ -Hello World \ No newline at end of file +Hello World + +Check 1
    + Check 2
    + Check 3
    + Check 4
    + Check 5
    + Check 6
    + Check 7
    + + + + + + + + + +
      +
    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