From 24dae1927f95257509d7f95bcf1ee0a7418d3b26 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 26 Feb 2012 20:47:49 -0800 Subject: [PATCH] Fix: Series Editor enhancements to make it more straight forward. Fix: History and Missing Grids now link to Seriesi/Details. --- NzbDrone.Web/Controllers/HistoryController.cs | 2 + NzbDrone.Web/Controllers/MissingController.cs | 2 + NzbDrone.Web/Controllers/SeriesController.cs | 10 +-- NzbDrone.Web/Models/HistoryModel.cs | 1 + NzbDrone.Web/Models/MissingEpisodeModel.cs | 1 + NzbDrone.Web/NzbDrone.Web.csproj | 4 +- NzbDrone.Web/Views/History/Index.cshtml | 10 ++- NzbDrone.Web/Views/Missing/Index.cshtml | 10 ++- .../{SeriesEditor.cshtml => Editor.cshtml} | 65 ++++++++++++++----- ...iesEditorItem.cshtml => EditorItem.cshtml} | 0 NzbDrone.Web/Views/Series/Index.cshtml | 2 +- 11 files changed, 81 insertions(+), 26 deletions(-) rename NzbDrone.Web/Views/Series/{SeriesEditor.cshtml => Editor.cshtml} (72%) rename NzbDrone.Web/Views/Series/{SeriesEditorItem.cshtml => EditorItem.cshtml} (100%) diff --git a/NzbDrone.Web/Controllers/HistoryController.cs b/NzbDrone.Web/Controllers/HistoryController.cs index eb836f3f6..c8e218fd8 100644 --- a/NzbDrone.Web/Controllers/HistoryController.cs +++ b/NzbDrone.Web/Controllers/HistoryController.cs @@ -1,6 +1,7 @@ using System.Linq; using System.Web.Mvc; using System.Web.Script.Serialization; +using NzbDrone.Core.Helpers; using NzbDrone.Core.Jobs; using NzbDrone.Core.Providers; using NzbDrone.Web.Models; @@ -33,6 +34,7 @@ namespace NzbDrone.Web.Controllers EpisodeTitle = h.Episode.Title, EpisodeOverview = h.Episode.Overview, SeriesTitle = h.SeriesTitle, + SeriesTitleSorter = SortHelper.SkipArticles(h.SeriesTitle), NzbTitle = h.NzbTitle, Quality = h.Quality.ToString(), IsProper = h.IsProper, diff --git a/NzbDrone.Web/Controllers/MissingController.cs b/NzbDrone.Web/Controllers/MissingController.cs index b1764925e..ec13dd92c 100644 --- a/NzbDrone.Web/Controllers/MissingController.cs +++ b/NzbDrone.Web/Controllers/MissingController.cs @@ -5,6 +5,7 @@ using System.Web; using System.Web.Mvc; using System.Web.Script.Serialization; using NzbDrone.Core; +using NzbDrone.Core.Helpers; using NzbDrone.Core.Providers; using NzbDrone.Web.Models; @@ -31,6 +32,7 @@ namespace NzbDrone.Web.Controllers EpisodeTitle = e.Title, Overview = e.Overview, SeriesTitle = e.Series.Title, + SeriesTitleSorter = SortHelper.SkipArticles(e.Series.Title), AirDate = e.AirDate.Value.ToString("MM/dd/yyyy"), AirDateString = e.AirDate.Value.ToBestDateString() }); diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index b0244ffb8..523d6d1e5 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -133,19 +133,19 @@ namespace NzbDrone.Web.Controllers return View(model); } - public ActionResult SeriesEditor() + public ActionResult Editor() { var profiles = _qualityProvider.All(); ViewData["QualityProfiles"] = profiles; //Create the select lists var masterProfiles = profiles.ToList(); - masterProfiles.Insert(0, new QualityProfile {QualityProfileId = -10, Name = "Unchanged"}); + masterProfiles.Insert(0, new QualityProfile {QualityProfileId = -10, Name = "Select..."}); ViewData["MasterProfileSelectList"] = new SelectList(masterProfiles, "QualityProfileId", "Name"); ViewData["BoolSelectList"] = new SelectList(new List> { - new KeyValuePair(-10, "Unchanged"), + new KeyValuePair(-10, "Select..."), new KeyValuePair(1, "True"), new KeyValuePair(0, "False") }, "Key", "Value" @@ -161,7 +161,7 @@ namespace NzbDrone.Web.Controllers ViewData["BacklogSettingTypes"] = backlogSettingTypes; var masterBacklogList = backlogSettingTypes.ToList(); - masterBacklogList.Insert(0, new KeyValuePair(-10, "Unchanged")); + masterBacklogList.Insert(0, new KeyValuePair(-10, "Select...")); ViewData["MasterBacklogSettingSelectList"] = new SelectList(masterBacklogList, "Key", "Value"); var series = _seriesProvider.GetAllSeries().OrderBy(o => SortHelper.SkipArticles(o.Title)); @@ -170,7 +170,7 @@ namespace NzbDrone.Web.Controllers } [HttpPost] - public JsonResult SaveSeriesEditor(List series) + public JsonResult SaveEditor(List series) { //Save edits if (series == null || series.Count == 0) diff --git a/NzbDrone.Web/Models/HistoryModel.cs b/NzbDrone.Web/Models/HistoryModel.cs index 61eb6e802..7b9c5dd96 100644 --- a/NzbDrone.Web/Models/HistoryModel.cs +++ b/NzbDrone.Web/Models/HistoryModel.cs @@ -8,6 +8,7 @@ namespace NzbDrone.Web.Models public int HistoryId { get; set; } public int SeriesId { get; set; } public string SeriesTitle { get; set; } + public string SeriesTitleSorter { get; set; } public string EpisodeNumbering { get; set; } public string EpisodeTitle { get; set; } public string EpisodeOverview { get; set; } diff --git a/NzbDrone.Web/Models/MissingEpisodeModel.cs b/NzbDrone.Web/Models/MissingEpisodeModel.cs index d0790e281..7c54ecaaf 100644 --- a/NzbDrone.Web/Models/MissingEpisodeModel.cs +++ b/NzbDrone.Web/Models/MissingEpisodeModel.cs @@ -9,6 +9,7 @@ namespace NzbDrone.Web.Models public int SeriesId { get; set; } public int EpisodeId { get; set; } public string SeriesTitle { get; set; } + public string SeriesTitleSorter { get; set; } public string EpisodeNumbering { get; set; } public string EpisodeTitle { get; set; } public string AirDate { get; set; } diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index e23dfa8d8..4abc1bb7f 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -479,10 +479,10 @@ - + - + diff --git a/NzbDrone.Web/Views/History/Index.cshtml b/NzbDrone.Web/Views/History/Index.cshtml index b66bbd996..36794c0ed 100644 --- a/NzbDrone.Web/Views/History/Index.cshtml +++ b/NzbDrone.Web/Views/History/Index.cshtml @@ -66,7 +66,15 @@ return " + row.aData["; } }, //Image - { sWidth: 'auto', "mDataProp": "SeriesTitle" }, //Series Title + { sWidth: 'auto', "mDataProp": function (source, type, val) { + // 'display' and 'filter' use our fancy naming + if (type === 'display' || type === 'filter') { + return "" + source["SeriesTitle"] + ""; + } + // 'sort' and 'type' both just use the raw data + return source["SeriesTitleSorter"]; + } + }, //Series Title { sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false }, //EpisodeNumbering { sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title { sWidth: '70px', "mDataProp": "Quality", "bSortable": false }, //Quality diff --git a/NzbDrone.Web/Views/Missing/Index.cshtml b/NzbDrone.Web/Views/Missing/Index.cshtml index 2cb3ca1e4..8d0ee14de 100644 --- a/NzbDrone.Web/Views/Missing/Index.cshtml +++ b/NzbDrone.Web/Views/Missing/Index.cshtml @@ -68,7 +68,15 @@ "iDisplayLength": 20, "sPaginationType": "four_button", "aoColumns": [ - { sWidth: 'auto', "mDataProp": "SeriesTitle" }, //Series Title + { sWidth: 'auto', "mDataProp": function (source, type, val) { + // 'display' and 'filter' use our fancy naming + if (type === 'display' || type === 'filter') { + return "" + source["SeriesTitle"] + ""; + } + // 'sort' and 'type' both just use the raw data + return source["SeriesTitleSorter"]; + } + }, //Series Title { sWidth: '80px', "mDataProp": "EpisodeNumbering", "bSortable": false }, //EpisodeNumbering { sWidth: 'auto', "mDataProp": "EpisodeTitle", "bSortable": false }, //Episode Title { sWidth: '150px', "mDataProp": function (source, type, val) { diff --git a/NzbDrone.Web/Views/Series/SeriesEditor.cshtml b/NzbDrone.Web/Views/Series/Editor.cshtml similarity index 72% rename from NzbDrone.Web/Views/Series/SeriesEditor.cshtml rename to NzbDrone.Web/Views/Series/Editor.cshtml index e6fa15479..0322a7925 100644 --- a/NzbDrone.Web/Views/Series/SeriesEditor.cshtml +++ b/NzbDrone.Web/Views/Series/Editor.cshtml @@ -1,6 +1,6 @@ @using NzbDrone.Web.Helpers @model IEnumerable -@{ViewBag.Title = "NzbDrone";} +@{ViewBag.Title = "Series Editor";} @section HeaderContent { @@ -33,10 +33,23 @@ td .backlogSetting { width: 90px; } + + #stylized, .settingsForm { + overflow: hidden; + } + + #stylized { + float: left; + } + + #changesOverview { + margin-top: 15px; + float: left; + } } -@using (Html.BeginForm("SaveSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" })) +@using (Html.BeginForm("SaveEditor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" })) { @@ -52,7 +65,7 @@ @foreach (var series in Model) { - Html.RenderPartial("SeriesEditorItem", series); + Html.RenderPartial("EditorItem", series); }
@@ -63,26 +76,27 @@ - @Html.DropDownList("masterQualitySelector", (SelectList)ViewData["MasterProfileSelectList"], new { @class = "inputClass" }) + @Html.DropDownList("masterQualitySelector", (SelectList)ViewData["MasterProfileSelectList"], new { @class = "inputClass masterSelector", disabled = true }) - @Html.DropDownList("masterMonitored", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass" }) + @Html.DropDownList("masterMonitored", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass masterSelector", disabled = true }) - @Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass" }) + @Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass masterSelector", disabled = true }) - @Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "inputClass" }) + @Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "inputClass masterSelector", disabled = true }) +
+

+
-
- - +
@@ -105,14 +119,37 @@ }); }); - $('.editToggleMaster').live('change', function () { + $(document).on('change', '.editToggleMaster', function () { var toggle = $(this).prop('checked'); $('.editToggle').each(function () { $(this).prop('checked', toggle); }); }); - $('#updateSelected').live('click', function () { + $(document).on('change', '.editToggle, .editToggleMaster', function () { + var selectedCount = $('.editToggle:checked'); + + if (selectedCount.length > 0) { + $('.masterSelector').each(function () { + $(this).attr("disabled", false); + }); + + $('#editingCount').text(selectedCount.length + ' series have been selected for editing'); + + if (selectedCount.length === 1) { + $('#editingCount').text(selectedCount.length + ' series has been selected for editing'); + } + } + + else { + $('.masterSelector').each(function () { + $(this).attr("disabled", true); + $('#editingCount').text(''); + }); + } + }); + + $(document).on('change', '.masterSelector', function () { //Find selected values var profileId = $('#masterQualitySelector').val(); var monitored = $('#masterMonitored').val(); @@ -146,10 +183,6 @@ $(this).parent('td').parent('.seriesEditRow').find('.backlogSetting').val(backlogStatus); } }); - }); - - - //Update all checked rows } \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/SeriesEditorItem.cshtml b/NzbDrone.Web/Views/Series/EditorItem.cshtml similarity index 100% rename from NzbDrone.Web/Views/Series/SeriesEditorItem.cshtml rename to NzbDrone.Web/Views/Series/EditorItem.cshtml diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml index 9a21d2a32..dac850127 100644 --- a/NzbDrone.Web/Views/Series/Index.cshtml +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -76,7 +76,7 @@ }