From 0ff60bde92ed296f52ef8fc41749710384ca20ae Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Thu, 23 Feb 2012 14:31:50 -0800 Subject: [PATCH] Mass edit is now Series Editor. Renamed Opps to Oops. Fixed broken SeriesEditor. --- .../ProviderTests/SeriesProviderTest.cs | 4 +- NzbDrone.Core/Providers/SeriesProvider.cs | 2 +- NzbDrone.Web/Controllers/CommandController.cs | 8 +- NzbDrone.Web/Controllers/SeriesController.cs | 12 +- .../Controllers/SettingsController.cs | 6 +- NzbDrone.Web/Controllers/SystemController.cs | 2 +- NzbDrone.Web/Filters/JsonErrorFilter.cs | 2 +- NzbDrone.Web/Models/JsonNotificationResult.cs | 4 +- NzbDrone.Web/NzbDrone.Web.csproj | 6 +- NzbDrone.Web/Scripts/NzbDrone/series.js | 4 +- NzbDrone.Web/Views/Series/Index.cshtml | 2 +- NzbDrone.Web/Views/Series/MassEdit.cshtml | 155 -------------- NzbDrone.Web/Views/Series/SeriesEditor.cshtml | 189 ++++++++++++++---- ...iesItem.cshtml => SeriesEditorItem.cshtml} | 13 +- .../Views/Series/SingleSeriesEditor.cshtml | 40 ++++ 15 files changed, 225 insertions(+), 224 deletions(-) delete mode 100644 NzbDrone.Web/Views/Series/MassEdit.cshtml rename NzbDrone.Web/Views/Series/{SeriesItem.cshtml => SeriesEditorItem.cshtml} (85%) create mode 100644 NzbDrone.Web/Views/Series/SingleSeriesEditor.cshtml diff --git a/NzbDrone.Core.Test/ProviderTests/SeriesProviderTest.cs b/NzbDrone.Core.Test/ProviderTests/SeriesProviderTest.cs index 3b5630d61..0ff6e830b 100644 --- a/NzbDrone.Core.Test/ProviderTests/SeriesProviderTest.cs +++ b/NzbDrone.Core.Test/ProviderTests/SeriesProviderTest.cs @@ -768,7 +768,7 @@ namespace NzbDrone.Core.Test.ProviderTests fakeSeries[0].SeasonFolder = newSeasonFolder; //Act - Mocker.Resolve().UpdateFromMassEdit(fakeSeries); + Mocker.Resolve().UpdateFromSeriesEditor(fakeSeries); //Assert var result = Db.Fetch(); @@ -805,7 +805,7 @@ namespace NzbDrone.Core.Test.ProviderTests fakeSeries[0].SeasonFolder = newSeasonFolder; //Act - Mocker.Resolve().UpdateFromMassEdit(fakeSeries); + Mocker.Resolve().UpdateFromSeriesEditor(fakeSeries); //Assert var result = Db.Fetch(); diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index 1986bd0bc..1a5b2b1a6 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -204,7 +204,7 @@ namespace NzbDrone.Core.Providers return series; } - public virtual void UpdateFromMassEdit(IList editedSeries) + public virtual void UpdateFromSeriesEditor(IList editedSeries) { var allSeries = GetAllSeries(); diff --git a/NzbDrone.Web/Controllers/CommandController.cs b/NzbDrone.Web/Controllers/CommandController.cs index 6d72bb7fb..64a722ce7 100644 --- a/NzbDrone.Web/Controllers/CommandController.cs +++ b/NzbDrone.Web/Controllers/CommandController.cs @@ -72,7 +72,7 @@ namespace NzbDrone.Web.Controllers if (_smtpProvider.SendTestEmail(server, port, ssl, username, password, fromAddress, toAddresses)) JsonNotificationResult.Info("Successfull", "Test email sent."); - return JsonNotificationResult.Opps("Couldn't send Email, please check your settings"); + return JsonNotificationResult.Oops("Couldn't send Email, please check your settings"); } public JsonResult GetTwitterAuthorization() @@ -80,7 +80,7 @@ namespace NzbDrone.Web.Controllers var result = _twitterProvider.GetAuthorization(); if (result == null) - JsonNotificationResult.Opps("Couldn't get Twitter Authorization"); + JsonNotificationResult.Oops("Couldn't get Twitter Authorization"); return new JsonResult { Data = result, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; } @@ -90,7 +90,7 @@ namespace NzbDrone.Web.Controllers var result = _twitterProvider.GetAndSaveAccessToken(token, verifier); if (!result) - JsonNotificationResult.Opps("Couldn't verify Twitter Authorization"); + JsonNotificationResult.Oops("Couldn't verify Twitter Authorization"); return JsonNotificationResult.Info("Good News!", "Successfully verified Twitter Authorization."); @@ -111,7 +111,7 @@ namespace NzbDrone.Web.Controllers } catch(Exception ex) { - return JsonNotificationResult.Opps("Couldn't register and test Growl"); + return JsonNotificationResult.Oops("Couldn't register and test Growl"); } } diff --git a/NzbDrone.Web/Controllers/SeriesController.cs b/NzbDrone.Web/Controllers/SeriesController.cs index 26ca21316..72eca3389 100644 --- a/NzbDrone.Web/Controllers/SeriesController.cs +++ b/NzbDrone.Web/Controllers/SeriesController.cs @@ -47,7 +47,7 @@ namespace NzbDrone.Web.Controllers return View((object)serialized); } - public ActionResult SeriesEditor(int seriesId) + public ActionResult SingleSeriesEditor(int seriesId) { var profiles = _qualityProvider.All(); ViewData["SelectList"] = new SelectList(profiles, "QualityProfileId", "Name"); @@ -66,7 +66,7 @@ namespace NzbDrone.Web.Controllers } [HttpPost] - public EmptyResult SaveSeriesEditor(SeriesModel seriesModel) + public EmptyResult SaveSingleSeriesEditor(SeriesModel seriesModel) { var series = _seriesProvider.GetSeries(seriesModel.SeriesId); series.Monitored = seriesModel.Monitored; @@ -133,7 +133,7 @@ namespace NzbDrone.Web.Controllers return View(model); } - public ActionResult MassEdit() + public ActionResult SeriesEditor() { var profiles = _qualityProvider.All(); ViewData["QualityProfiles"] = profiles; @@ -170,13 +170,13 @@ namespace NzbDrone.Web.Controllers } [HttpPost] - public JsonResult SaveMassEdit(List series) + public JsonResult SaveSeriesEditor(List series) { //Save edits if (series == null || series.Count == 0) - return JsonNotificationResult.Opps("Invalid post data"); + return JsonNotificationResult.Oops("Invalid post data"); - _seriesProvider.UpdateFromMassEdit(series); + _seriesProvider.UpdateFromSeriesEditor(series); return JsonNotificationResult.Info("Series Mass Edit Saved"); } diff --git a/NzbDrone.Web/Controllers/SettingsController.cs b/NzbDrone.Web/Controllers/SettingsController.cs index fcf0f7f21..e47af1db1 100644 --- a/NzbDrone.Web/Controllers/SettingsController.cs +++ b/NzbDrone.Web/Controllers/SettingsController.cs @@ -279,7 +279,7 @@ namespace NzbDrone.Web.Controllers public JsonResult DeleteQualityProfile(int profileId) { if (_seriesProvider.GetAllSeries().Where(s => s.QualityProfileId == profileId).Count() != 0) - return JsonNotificationResult.Opps("Profile is still in use."); + return JsonNotificationResult.Oops("Profile is still in use."); _qualityProvider.Delete(profileId); @@ -410,7 +410,7 @@ namespace NzbDrone.Web.Controllers return GetSuccessResult(); } - return JsonNotificationResult.Opps("Invalid Data"); + return JsonNotificationResult.Oops("Invalid Data"); } [HttpPost] @@ -613,7 +613,7 @@ namespace NzbDrone.Web.Controllers private JsonResult GetInvalidModelResult() { - return JsonNotificationResult.Opps("Invalid post data"); + return JsonNotificationResult.Oops("Invalid post data"); } private SelectList GetProwlPrioritySelectList() diff --git a/NzbDrone.Web/Controllers/SystemController.cs b/NzbDrone.Web/Controllers/SystemController.cs index 46fa0f071..a8c7406da 100644 --- a/NzbDrone.Web/Controllers/SystemController.cs +++ b/NzbDrone.Web/Controllers/SystemController.cs @@ -163,7 +163,7 @@ namespace NzbDrone.Web.Controllers public JsonResult RunJob(string typeName) { if (!_jobProvider.QueueJob(typeName)) - return JsonNotificationResult.Opps("Invalid Job Name"); + return JsonNotificationResult.Oops("Invalid Job Name"); return JsonNotificationResult.Info("Job Queued"); } diff --git a/NzbDrone.Web/Filters/JsonErrorFilter.cs b/NzbDrone.Web/Filters/JsonErrorFilter.cs index 135ba7f61..af5105d95 100644 --- a/NzbDrone.Web/Filters/JsonErrorFilter.cs +++ b/NzbDrone.Web/Filters/JsonErrorFilter.cs @@ -11,7 +11,7 @@ namespace NzbDrone.Web.Filters public void OnException(ExceptionContext filterContext) { - filterContext.Result = JsonNotificationResult.Opps(filterContext.Exception.Message); + filterContext.Result = JsonNotificationResult.Oops(filterContext.Exception.Message); filterContext.ExceptionHandled = true; logger.FatalException(filterContext.RequestContext.HttpContext.Request.RawUrl, filterContext.Exception); } diff --git a/NzbDrone.Web/Models/JsonNotificationResult.cs b/NzbDrone.Web/Models/JsonNotificationResult.cs index 548e88846..8f89ee861 100644 --- a/NzbDrone.Web/Models/JsonNotificationResult.cs +++ b/NzbDrone.Web/Models/JsonNotificationResult.cs @@ -29,9 +29,9 @@ namespace NzbDrone.Web.Models return GetJsonResult(NotificationType.Error, title, text); } - public static JsonResult Opps(string text) + public static JsonResult Oops(string text) { - return GetJsonResult(NotificationType.Error, "Opps!", text); + return GetJsonResult(NotificationType.Error, "Oops!", text); } diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index 6d4575510..36f2a14a3 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -472,10 +472,10 @@ - + - + @@ -493,7 +493,7 @@ - + diff --git a/NzbDrone.Web/Scripts/NzbDrone/series.js b/NzbDrone.Web/Scripts/NzbDrone/series.js index ddb8fcc32..b5558e4a5 100644 --- a/NzbDrone.Web/Scripts/NzbDrone/series.js +++ b/NzbDrone.Web/Scripts/NzbDrone/series.js @@ -1,5 +1,5 @@ -var seriesEditorUrl = '../Series/SeriesEditor'; -var saveSeriesEditorUrl = '../Series/SaveSeriesEditor'; +var seriesEditorUrl = '../Series/SingleSeriesEditor'; +var saveSeriesEditorUrl = '../Series/SaveSingleSeriesEditor'; var seriesDeleteUrl = '../Series/DeleteSeries'; $("#seriesEditor").dialog({ diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml index 91faa1e34..9a21d2a32 100644 --- a/NzbDrone.Web/Views/Series/Index.cshtml +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -76,7 +76,7 @@ } diff --git a/NzbDrone.Web/Views/Series/MassEdit.cshtml b/NzbDrone.Web/Views/Series/MassEdit.cshtml deleted file mode 100644 index f1a41b840..000000000 --- a/NzbDrone.Web/Views/Series/MassEdit.cshtml +++ /dev/null @@ -1,155 +0,0 @@ -@using NzbDrone.Web.Helpers -@model IEnumerable -@{ViewBag.Title = "NzbDrone";} - -@section HeaderContent -{ - @Html.IncludeCss("Settings.css") - - -} - -@using (Html.BeginForm("SaveMassEdit", "Series", FormMethod.Post, new { id = "MassEdit", name = "MassEdit" })) -{ - - - - - - - - - - - - - @foreach (var series in Model) - { - Html.RenderPartial("SeriesItem", series); - } - -
@Html.CheckBox("editToggleMaster", false, new { @class = "editToggleMaster" })TitleQualityMonitoredSeason FolderBacklog StatusPath
- -
-
-
- - @Html.DropDownList("masterQualitySelector", (SelectList)ViewData["MasterProfileSelectList"], new { @class = "inputClass" }) - - @Html.DropDownList("masterMonitored", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass" }) - - @Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass" }) - - @Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "inputClass" }) -
-
-
- -
- - - -
-} - -@section Scripts -{ - -} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/SeriesEditor.cshtml b/NzbDrone.Web/Views/Series/SeriesEditor.cshtml index 52dd40e99..e6fa15479 100644 --- a/NzbDrone.Web/Views/Series/SeriesEditor.cshtml +++ b/NzbDrone.Web/Views/Series/SeriesEditor.cshtml @@ -1,40 +1,155 @@ -@using NzbDrone.Web.Helpers; -@model NzbDrone.Web.Models.SeriesModel -@{ - Layout = null; +@using NzbDrone.Web.Helpers +@model IEnumerable +@{ViewBag.Title = "NzbDrone";} + +@section HeaderContent +{ + @Html.IncludeCss("Settings.css") + + } - +@using (Html.BeginForm("SaveSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditor", name = "SeriesEditor" })) +{ + + + + + + + + + + + + + @foreach (var series in Model) + { + Html.RenderPartial("SeriesEditorItem", series); + } + +
@Html.CheckBox("editToggleMaster", false, new { @class = "editToggleMaster" })TitleQualityMonitoredSeason FolderBacklog StatusPath
+ +
+
+
+ + @Html.DropDownList("masterQualitySelector", (SelectList)ViewData["MasterProfileSelectList"], new { @class = "inputClass" }) + + @Html.DropDownList("masterMonitored", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass" }) + + @Html.DropDownList("masterSeasonFolder", (SelectList)ViewData["BoolSelectList"], new { @class = "inputClass" }) + + @Html.DropDownList("masterBacklogSetting", (SelectList)ViewData["MasterBacklogSettingSelectList"], new { @class = "inputClass" }) +
+
+
-
- @using (Html.BeginForm("SaveSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditorForm", name = "SeriesEditorForm", @class = "settingsForm" })) - { - @Html.HiddenFor(m => m.SeriesId) - @Html.HiddenFor(m => m.Status) - - @Html.CheckBoxFor(m => m.Monitored, new { @class = "inputClass checkClass" }) - - @Html.CheckBoxFor(m => m.SeasonFolder, new { @class = "inputClass checkClass" }) - - @Html.DropDownListFor(m => m.QualityProfileId, (SelectList)ViewData["SelectList"], new { @class = "inputClass" }) - - @Html.TextBoxFor(m => m.Path, new { @class = "inputClass" }) - - @Html.DropDownListFor(m => m.BacklogSetting, (SelectList)ViewData["BacklogSettingSelectList"], new { @class = "inputClass" }) - } -
\ No newline at end of file +
+ + + +
+} + +@section Scripts +{ + +} \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/SeriesItem.cshtml b/NzbDrone.Web/Views/Series/SeriesEditorItem.cshtml similarity index 85% rename from NzbDrone.Web/Views/Series/SeriesItem.cshtml rename to NzbDrone.Web/Views/Series/SeriesEditorItem.cshtml index 747e23878..c3bfd363a 100644 --- a/NzbDrone.Web/Views/Series/SeriesItem.cshtml +++ b/NzbDrone.Web/Views/Series/SeriesEditorItem.cshtml @@ -9,10 +9,11 @@ @*SeriesId, Title, Quality, Monitored, Use Season Folder, Root Directory/Path*, Backlog Toggle*@ -@using (Html.BeginCollectionItem("series")) -{ - var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); - + + @using (Html.BeginCollectionItem("series")) + { + var idClean = ViewData.TemplateInfo.HtmlFieldPrefix.Replace('[', '_').Replace(']', '_'); + @Html.HiddenFor(m => m.SeriesId) @Html.CheckBox("editToggle", false, new {@class = "editToggle"}) @Model.Title @@ -21,5 +22,5 @@ @Html.CheckBoxFor(m => m.SeasonFolder, new {@class = "seriesCheckbox seasonFolder"}) @Html.DropDownListFor(m => m.BacklogSetting, new SelectList((List>)ViewData["BacklogSettingTypes"], "Key", "Value", (int)Model.BacklogSetting), new { @class = "backlogSetting" }) @Html.TextBoxFor(m => m.Path, new { @class = "path" }) - -} \ No newline at end of file + } + \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/SingleSeriesEditor.cshtml b/NzbDrone.Web/Views/Series/SingleSeriesEditor.cshtml new file mode 100644 index 000000000..8f6e29cc3 --- /dev/null +++ b/NzbDrone.Web/Views/Series/SingleSeriesEditor.cshtml @@ -0,0 +1,40 @@ +@using NzbDrone.Web.Helpers; +@model NzbDrone.Web.Models.SeriesModel +@{ + Layout = null; +} + + + +
+ @using (Html.BeginForm("SaveSingleSeriesEditor", "Series", FormMethod.Post, new { id = "SeriesEditorForm", name = "SeriesEditorForm", @class = "settingsForm" })) + { + @Html.HiddenFor(m => m.SeriesId) + @Html.HiddenFor(m => m.Status) + + @Html.CheckBoxFor(m => m.Monitored, new { @class = "inputClass checkClass" }) + + @Html.CheckBoxFor(m => m.SeasonFolder, new { @class = "inputClass checkClass" }) + + @Html.DropDownListFor(m => m.QualityProfileId, (SelectList)ViewData["SelectList"], new { @class = "inputClass" }) + + @Html.TextBoxFor(m => m.Path, new { @class = "inputClass" }) + + @Html.DropDownListFor(m => m.BacklogSetting, (SelectList)ViewData["BacklogSettingSelectList"], new { @class = "inputClass" }) + } +
\ No newline at end of file