diff --git a/NzbDrone.Web/NzbDrone.Web.csproj b/NzbDrone.Web/NzbDrone.Web.csproj index c26dc5494..6d4575510 100644 --- a/NzbDrone.Web/NzbDrone.Web.csproj +++ b/NzbDrone.Web/NzbDrone.Web.csproj @@ -351,6 +351,7 @@ + diff --git a/NzbDrone.Web/Scripts/NzbDrone/series.js b/NzbDrone.Web/Scripts/NzbDrone/series.js new file mode 100644 index 000000000..ddb8fcc32 --- /dev/null +++ b/NzbDrone.Web/Scripts/NzbDrone/series.js @@ -0,0 +1,107 @@ +var seriesEditorUrl = '../Series/SeriesEditor'; +var saveSeriesEditorUrl = '../Series/SaveSeriesEditor'; +var seriesDeleteUrl = '../Series/DeleteSeries'; + +$("#seriesEditor").dialog({ + autoOpen: false, + height: 'auto', + width: 670, + resizable: false, + modal: true, + buttons: { + "Delete": { + text: "Delete", + class: "ui-delete-button", + click: function () { + var answer = confirm("Are you sure you want to delete this series?"); + if (answer) { + var seriesId = $('#SeriesId').val(); + + $.ajax({ + type: "POST", + url: seriesDeleteUrl, + data: { seriesId: seriesId }, + success: function (data) { + //Remove the row from the grid... along with the details row + afterDelete(); + } + }); + $(this).dialog("close"); + } + } + }, + "Save": function () { + //Save the form + $('#SeriesEditorForm').submit(); + afterSave(); + + $(this).dialog("close"); + }, + Cancel: function () { + $(this).dialog("close"); + } + } +}); + +$("#seriesDelete").dialog({ + autoOpen: false, + resizable: false, + height: 'auto', + width: 450, + modal: true, + buttons: { + "Delete": function () { + var seriesId = $('.seriesId').val(); + $.ajax({ + type: "POST", + url: seriesDeleteUrl, + data: { seriesId: seriesId }, + success: function (data) { + //Remove the row from the grid... along with the details row + afterDelete(seriesId); + } + }); + $(this).dialog("close"); + }, + Cancel: function () { + $(this).dialog("close"); + } + } +}); + +$(".editButton").live('click', function () { + //Get the SeriesId and Title + var seriesId = parseInt($(this).attr("value")); + var title = $(this).attr("rel"); + + //Set the title of the dialog + $("#seriesEditor").dialog("option", "title", title); + + //Pre-populate the view with ajax + $('#seriesEditor').html('
'); + + //Get the view + $.ajax({ + url: seriesEditorUrl, + data: { seriesId: seriesId }, + success: function (data) { + $('#seriesEditor').html(data); + } + }); + + //Open the dialog + $("#seriesEditor").dialog("open"); +}); + +$(".deleteButton").live('click', function () { + //Get the SeriesId and Title + var seriesId = parseInt($(this).attr("value")); + var title = $(this).attr("rel"); + + //Fill in the view + $('#seriesDelete').children('.seriesId').val(seriesId); + $('#seriesDelete').children('.seriesTitle').html(title); + + //Open the dialog + $("#seriesDelete").dialog("open"); +}); \ No newline at end of file diff --git a/NzbDrone.Web/Views/Series/Details.cshtml b/NzbDrone.Web/Views/Series/Details.cshtml index 0be7f1ed9..7bfa0c0d0 100644 --- a/NzbDrone.Web/Views/Series/Details.cshtml +++ b/NzbDrone.Web/Views/Series/Details.cshtml @@ -5,57 +5,65 @@ @section HeaderContent { + @Html.IncludeCss("Settings.css") @Html.IncludeCss("Grid.css") -} -@{ ViewBag.Title = Model.Title; } - + .seasonSection + { + margin-top: 50px; + } + + .ui-dialog-buttonpane .ui-dialog-buttonset .ui-delete-button + { + margin-right: 445px; + } + +} +@{ ViewBag.Title = Model.Title; } + @section ActionMenu { } @@ -95,9 +104,27 @@ } } + +
+
+
+
+ @section Scripts{ @Html.IncludeScript("NzbDrone/seriesDetails.js") + @Html.IncludeScript("NzbDrone/series.js") + } diff --git a/NzbDrone.Web/Views/Series/Index.cshtml b/NzbDrone.Web/Views/Series/Index.cshtml index 6c413c506..91faa1e34 100644 --- a/NzbDrone.Web/Views/Series/Index.cshtml +++ b/NzbDrone.Web/Views/Series/Index.cshtml @@ -110,10 +110,10 @@ @section Scripts{ + @Html.IncludeScript("NzbDrone/series.js") + }