From 206144d7e3357dcfbe205ba36b867270247afb35 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Mon, 27 Jun 2011 19:24:42 -0700 Subject: [PATCH] more javascript fixes, UI is still pretty much fucked. --- NzbDrone.Web/Views/AddSeries/AddNew.cshtml | 80 ++-- NzbDrone.Web/Views/AddSeries/Index.cshtml | 271 ++++++----- NzbDrone.Web/Views/Series/SeasonEditor.cshtml | 43 +- .../Views/Settings/EpisodeSorting.cshtml | 431 +++++++++--------- NzbDrone.Web/Views/Settings/Indexers.cshtml | 53 ++- .../Views/Settings/Notifications.cshtml | 259 +++++------ NzbDrone.Web/Views/Settings/Quality.cshtml | 229 +++++----- NzbDrone.Web/Views/Settings/Sabnzbd.cshtml | 109 ++--- NzbDrone.Web/Views/Shared/_Layout.cshtml | 37 +- 9 files changed, 728 insertions(+), 784 deletions(-) diff --git a/NzbDrone.Web/Views/AddSeries/AddNew.cshtml b/NzbDrone.Web/Views/AddSeries/AddNew.cshtml index f3bda9a38..291f115ee 100644 --- a/NzbDrone.Web/Views/AddSeries/AddNew.cshtml +++ b/NzbDrone.Web/Views/AddSeries/AddNew.cshtml @@ -1,27 +1,24 @@ @using NzbDrone.Web.Models - @{ Layout = null; } -
Root Directory - @{int d = 0; foreach (var dir in ViewData["RootDirs"] as List) { -
- @Html.RadioButton("selectedRootDir", dir.CleanPath, d == 0, new { @class = "dirList examplePart", id = "dirRadio_" + d }) - @Html.Label(dir.Path) - @{ d++; } -
- } +
+ @Html.RadioButton("selectedRootDir", dir.CleanPath, d == 0, new { @class = "dirList examplePart", id = "dirRadio_" + d }) + @Html.Label(dir.Path) + @{ d++; } +
+ } }
-
+
@{Html.Telerik().ComboBox() .Name("seriesList_new") @@ -34,37 +31,38 @@
+@section Scripts{ + \ No newline at end of file + function sendToServerNew(id, rootPath, seriesName, quality) { + $.ajax({ + type: "POST", + url: addNewSeriesUrl, + data: jQuery.param({ rootPath: rootPath, seriesName: seriesName, seriesId: id, qualityProfileId: quality }), + error: function (req, status, error) { + alert("Sorry! We could not add " + seriesName + " at this time. " + error); + }, + success: function (data, textStatus, jqXHR) { + //Clear the search box + $("#seriesList_new").data("tComboBox").text(''); + + //Through up an alert if we failed to add the series + if (data != 'ok') + alert("Sorry! We could not add " + seriesName + ", does it already exist?"); + + else + closeAddNewSeries(); //Close the Window! + } + }); + } + +} diff --git a/NzbDrone.Web/Views/AddSeries/Index.cshtml b/NzbDrone.Web/Views/AddSeries/Index.cshtml index 1beeb83ba..37a0e5aae 100644 --- a/NzbDrone.Web/Views/AddSeries/Index.cshtml +++ b/NzbDrone.Web/Views/AddSeries/Index.cshtml @@ -1,30 +1,18 @@ @model List @using NzbDrone.Core.Repository - -@{ Html.Telerik().ScriptRegistrar().DefaultGroup(group => group - .Add("telerik.common.js") - .Add("telerik.draganddrop.js") - .Add("telerik.window.js") - .Add("telerik.panelbar.js") - .Add("telerik.list.js") - .Add("telerik.combobox.js")); } - - @section TitleContent{ - Add Series +Add Series } - @section MainContent{ - @{ Html.Telerik().Window() .Name("Window") .Title("Add New Series") @@ -37,8 +25,7 @@ .Resizable(resizing => resizing.Enabled(false)) .LoadContentFrom("AddNew", "AddSeries") .Render(); -} - + } @{ Html.Telerik().PanelBar() .Name("RootDirPanel") .HtmlAttributes(new { style = "margin: 0px;" }) @@ -51,142 +38,146 @@ .Selected((bool)ViewData["ShowRootDirs"]) .Expanded((bool)ViewData["ShowRootDirs"]) .Content(@ -
-
- - Add New Profile -

Add New Root Directory

-
- -
- @foreach (var root in Model) - { - Html.RenderAction("GetRootDirView", root); - } -
- - -
-
); - }).Render(); +
+
+ + Add New Profile +

+ Add New Root Directory

+
+
+
+ @foreach (var root in Model) + { + Html.RenderAction("GetRootDirView", root); + } +
+ + +
+ ); + }).Render(); } -
- - - @Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList) ViewData["qualities"]).HtmlAttributes( - new {style = "width: 100px; margin-left:224px;"}).ClientEvents(events => events.OnChange("masterChanged")) - + + @Html.Telerik().DropDownList().Name("masterDropbox").BindTo((SelectList)ViewData["qualities"]).HtmlAttributes( + new { style = "width: 100px; margin-left:224px;" }).ClientEvents(events => events.OnChange("masterChanged"))
-
@{ Html.RenderAction("AddExisting", "AddSeries"); }
} - \ No newline at end of file + } + +} diff --git a/NzbDrone.Web/Views/Series/SeasonEditor.cshtml b/NzbDrone.Web/Views/Series/SeasonEditor.cshtml index da8ed7027..3aad85958 100644 --- a/NzbDrone.Web/Views/Series/SeasonEditor.cshtml +++ b/NzbDrone.Web/Views/Series/SeasonEditor.cshtml @@ -1,37 +1,36 @@ @using NzbDrone.Web.Models; @model List - @{ Layout = null; } -
@foreach (var season in Model) { Html.RenderAction("GetSingleSeasonView", "Series", season); }
+@section Scripts{ + + +} diff --git a/NzbDrone.Web/Views/Settings/EpisodeSorting.cshtml b/NzbDrone.Web/Views/Settings/EpisodeSorting.cshtml index 311b3bc96..eaf4562f7 100644 --- a/NzbDrone.Web/Views/Settings/EpisodeSorting.cshtml +++ b/NzbDrone.Web/Views/Settings/EpisodeSorting.cshtml @@ -1,253 +1,242 @@ @using NzbDrone.Web.Helpers @model NzbDrone.Web.Models.EpisodeSortingModel - - @using (Html.BeginForm("SaveEpisodeSorting", "Settings", FormMethod.Post, new { id = "form", name = "form" })) { @Html.ValidationSummary(true, "Unable to save your settings. Please correct the errors and try again.")
Episode Sorting - -
-
-
@Html.LabelFor(m => m.SeriesName)
-
@Html.CheckBoxFor(m => m.SeriesName)
-
-
-
@Html.ValidationMessageFor(m => m.SeriesName)
-
@Html.DescriptionFor(m => m.SeriesName)
-
+
+
+
@Html.LabelFor(m => m.SeriesName)
+
@Html.CheckBoxFor(m => m.SeriesName)
- -
-
-
@Html.LabelFor(m => m.EpisodeName)
-
@Html.CheckBoxFor(m => m.EpisodeName)
-
-
-
@Html.ValidationMessageFor(m => m.EpisodeName)
-
@Html.DescriptionFor(m => m.EpisodeName)
-
+
+
@Html.ValidationMessageFor(m => m.SeriesName)
+
@Html.DescriptionFor(m => m.SeriesName)
- -
-
-
@Html.LabelFor(m => m.ReplaceSpaces)
-
@Html.CheckBoxFor(m => m.ReplaceSpaces)
-
-
-
@Html.ValidationMessageFor(m => m.ReplaceSpaces)
-
@Html.DescriptionFor(m => m.ReplaceSpaces)
-
+
+
+
+
@Html.LabelFor(m => m.EpisodeName)
+
@Html.CheckBoxFor(m => m.EpisodeName)
- -
-
-
@Html.LabelFor(m => m.AppendQuality)
-
@Html.CheckBoxFor(m => m.AppendQuality)
-
-
-
@Html.ValidationMessageFor(m => m.AppendQuality)
-
@Html.DescriptionFor(m => m.AppendQuality)
-
+
+
@Html.ValidationMessageFor(m => m.EpisodeName)
+
@Html.DescriptionFor(m => m.EpisodeName)
- -
-
-
@Html.LabelFor(m => m.SeasonFolders)
-
@Html.CheckBoxFor(m => m.SeasonFolders)
-
-
-
@Html.ValidationMessageFor(m => m.SeasonFolders)
-
@Html.DescriptionFor(m => m.SeasonFolders)
-
+
+
+
+
@Html.LabelFor(m => m.ReplaceSpaces)
+
@Html.CheckBoxFor(m => m.ReplaceSpaces)
- -
-
-
@Html.LabelFor(m => m.SeasonFolderFormat)
-
@Html.TextBoxFor(m => m.SeasonFolderFormat)
-
-
-
@Html.ValidationMessageFor(m => m.SeasonFolderFormat)
-
@Html.DescriptionFor(m => m.SeasonFolderFormat)
-
+
+
@Html.ValidationMessageFor(m => m.ReplaceSpaces)
+
@Html.DescriptionFor(m => m.ReplaceSpaces)
- -
-
-
@Html.LabelFor(m => m.SeparatorStyle)
-
@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)
-
-
-
@Html.ValidationMessageFor(m => m.SeparatorStyle)
-
@Html.DescriptionFor(m => m.SeparatorStyle)
-
+
+
+
+
@Html.LabelFor(m => m.AppendQuality)
+
@Html.CheckBoxFor(m => m.AppendQuality)
- -
-
-
@Html.LabelFor(m => m.NumberStyle)
-
@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)
-
-
-
@Html.ValidationMessageFor(m => m.NumberStyle)
-
@Html.DescriptionFor(m => m.NumberStyle)
-
+
+
@Html.ValidationMessageFor(m => m.AppendQuality)
+
@Html.DescriptionFor(m => m.AppendQuality)
- -
-
-
@Html.LabelFor(m => m.MultiEpisodeStyle)
-
@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)
-
-
-
@Html.ValidationMessageFor(m => m.MultiEpisodeStyle)
-
@Html.DescriptionFor(m => m.MultiEpisodeStyle)
-
+
+
+
+
@Html.LabelFor(m => m.SeasonFolders)
+
@Html.CheckBoxFor(m => m.SeasonFolders)
- -
-
- - - +
+
@Html.ValidationMessageFor(m => m.SeasonFolders)
+
@Html.DescriptionFor(m => m.SeasonFolders)
+
+
+
+
+
@Html.LabelFor(m => m.SeasonFolderFormat)
+
@Html.TextBoxFor(m => m.SeasonFolderFormat)
+
+
+
@Html.ValidationMessageFor(m => m.SeasonFolderFormat)
+
@Html.DescriptionFor(m => m.SeasonFolderFormat)
+
+
+
+
+
@Html.LabelFor(m => m.SeparatorStyle)
+
@Html.DropDownListFor(m => m.SeparatorStyle, Model.SeparatorStyles)
+
+
+
@Html.ValidationMessageFor(m => m.SeparatorStyle)
+
@Html.DescriptionFor(m => m.SeparatorStyle)
+
+
+
+
+
@Html.LabelFor(m => m.NumberStyle)
+
@Html.DropDownListFor(m => m.NumberStyle, Model.NumberStyles)
+
+
+
@Html.ValidationMessageFor(m => m.NumberStyle)
+
@Html.DescriptionFor(m => m.NumberStyle)
+
+
+
+
+
@Html.LabelFor(m => m.MultiEpisodeStyle)
+
@Html.DropDownListFor(m => m.MultiEpisodeStyle, Model.MultiEpisodeStyles)
+
+
+
@Html.ValidationMessageFor(m => m.MultiEpisodeStyle)
+
@Html.DescriptionFor(m => m.MultiEpisodeStyle)
+
+
+
+
+
+
+
} -
+
+
+@section Scripts{ + \ No newline at end of file + if ($('#SeriesName').attr('checked')) { + result += 'Series Name'; + result += separator; + } + + var numberStyle = $("#NumberStyle option:selected").text(); + var numberId = $("#NumberStyle option:selected").val(); + var style = $("#MultiEpisodeStyle option:selected").val(); + + result += numberStyle; + + if (style == 0) + result += '-06'; + + if (style == 1) { + result += separator; + result += numberStyle.replace('5', '6'); + } + + if (style == 2) { + if (numberId <= 1) + result += 'x06'; + + if (numberId == 2) + result += 'E06'; + + if (numberId == 3) + result += 'e06'; + } + + if (style == 3) { + if (numberId <= 1) + result += '-x06'; + + if (numberId == 2) + result += '-E06'; + + if (numberId == 3) + result += '-e06'; + } + + if ($('#EpisodeName').attr('checked')) { + result += separator; + result += 'Episode Name'; + } + + if ($('#AppendQuality').attr('checked')) + result += ' [TV]'; + + if ($('#ReplaceSpaces').attr('checked')) + result = result.replace(/\s/g, '.'); + + result = 'Multi-Episode Example: ' + result; + + $('#multiEpisodeExample').html(result); + } + +} diff --git a/NzbDrone.Web/Views/Settings/Indexers.cshtml b/NzbDrone.Web/Views/Settings/Indexers.cshtml index 737f53c19..44aca26e2 100644 --- a/NzbDrone.Web/Views/Settings/Indexers.cshtml +++ b/NzbDrone.Web/Views/Settings/Indexers.cshtml @@ -1,28 +1,5 @@ @model NzbDrone.Web.Models.IndexerSettingsModel -