From 7b57e3fffc8d6c41e9e1ff5fa5bd898ee29c00f5 Mon Sep 17 00:00:00 2001 From: tidusjar Date: Wed, 22 Jun 2016 09:33:20 +0100 Subject: [PATCH] Fixed #353 #354 #355 --- PlexRequests.Core/Setup.cs | 4 - PlexRequests.UI/Content/issue-details.js | 38 +- PlexRequests.UI/Modules/IssuesModule.cs | 18 +- PlexRequests.UI/Views/Issues/Details.cshtml | 2 +- PlexRequests.UI/Views/Landing/Index.cshtml | 11 +- PlexRequests.UI/Views/Requests/Index.cshtml | 787 ++++++++++---------- 6 files changed, 432 insertions(+), 428 deletions(-) diff --git a/PlexRequests.Core/Setup.cs b/PlexRequests.Core/Setup.cs index 85a72d7f9..e66a15cec 100644 --- a/PlexRequests.Core/Setup.cs +++ b/PlexRequests.Core/Setup.cs @@ -57,10 +57,6 @@ namespace PlexRequests.Core var version = CheckSchema(); if (version > 0) { - if (version > 1700 && version <= 1799) - { - MigrateToVersion1700(); - } if (version > 1799 && version <= 1800) { MigrateToVersion1800(); diff --git a/PlexRequests.UI/Content/issue-details.js b/PlexRequests.UI/Content/issue-details.js index 28b10c997..92693ac94 100644 --- a/PlexRequests.UI/Content/issue-details.js +++ b/PlexRequests.UI/Content/issue-details.js @@ -27,19 +27,43 @@ $(".theNoteSaveButton").click(function (e) { }); }); // Update the note modal -$('#noteModal').on('show.bs.modal', function (event) { - var button = $(event.relatedTarget); // Button that triggered the modal - var id = button.data('identifier'); // Extract info from data-* attributes +$('#noteModal').on('show.bs.modal', function (event) { + var button = $(event.relatedTarget); // Button that triggered the modal + var id = button.data('identifier'); // Extract info from data-* attributes + var issue = button.data('issue'); - var modal = $(this); - modal.find('.theNoteSaveButton').val(id); // Add ID to the button - var requestField = modal.find('.noteId'); - requestField.val(id); // Add ID to the hidden field + var modal = $(this); + modal.find('.theNoteSaveButton').val(id); // Add ID to the button + var requestField = modal.find('.noteId'); + requestField.val(id); // Add ID to the hidden field + var noteType = modal.find('.issue'); + noteType.val(issue); + }); + + + $('.delete').click(function(e) { + e.preventDefault(); + var url = createBaseUrl(base, "/issues"); + var $form = $("#removeForm"); + $.ajax({ + type: $form.prop("method"), + url: $form.prop("action"), + data: $form.serialize(), + dataType: "json", + success: function (response) { + if (checkJsonResponse(response)) { window.location.replace(url); } + }, + error: function (e) { + console.log(e); + generateNotify("Something went wrong!", "danger"); + } + }); + }); diff --git a/PlexRequests.UI/Modules/IssuesModule.cs b/PlexRequests.UI/Modules/IssuesModule.cs index 1c66831e0..d5129f303 100644 --- a/PlexRequests.UI/Modules/IssuesModule.cs +++ b/PlexRequests.UI/Modules/IssuesModule.cs @@ -48,7 +48,7 @@ namespace PlexRequests.UI.Modules Get["/issuecount", true] = async (x, ct) => await IssueCount(); Get["/tabCount", true] = async (x, ct) => await TabCount(); - Post["/issuecomment", true] = async (x, ct) => await ReportRequestIssue((int)Request.Form.provierId, IssueState.Other, (string)Request.Form.commentArea); + Post["/issuecomment", true] = async (x, ct) => await ReportRequestIssue((int)Request.Form.providerId, IssueState.Other, (string)Request.Form.commentArea); Post["/nonrequestissue", true] = async (x, ct) => await ReportNonRequestIssue((int)Request.Form.providerId, (string)Request.Form.type, (IssueState)(int)Request.Form.issue, null); @@ -369,16 +369,22 @@ namespace PlexRequests.UI.Modules this.RequiresClaims(UserClaims.Admin); var issue = await IssuesService.GetAsync(issueId); var request = await RequestService.GetAsync(issue.RequestId); + if (request.Id > 0) + { + request.IssueId = 0; // No issue; - request.IssueId = 0; // No issue; - - var result = await RequestService.UpdateRequestAsync(request); - if (result) + var result = await RequestService.UpdateRequestAsync(request); + if (result) + { + await IssuesService.DeleteIssueAsync(issueId); + } + } + else { await IssuesService.DeleteIssueAsync(issueId); } - return Response.AsJson(new JsonResponseModel() { Result = true }); + return Response.AsJson(new JsonResponseModel { Result = true }); } catch (Exception e) diff --git a/PlexRequests.UI/Views/Issues/Details.cshtml b/PlexRequests.UI/Views/Issues/Details.cshtml index 53a6c8994..4c4f06178 100644 --- a/PlexRequests.UI/Views/Issues/Details.cshtml +++ b/PlexRequests.UI/Views/Issues/Details.cshtml @@ -42,7 +42,7 @@ } @if (Model.IssueStatus == IssueStatus.ResolvedIssue) { -
+
diff --git a/PlexRequests.UI/Views/Landing/Index.cshtml b/PlexRequests.UI/Views/Landing/Index.cshtml index 8e0cd90a0..2a3ff8945 100644 --- a/PlexRequests.UI/Views/Landing/Index.cshtml +++ b/PlexRequests.UI/Views/Landing/Index.cshtml @@ -1,8 +1,15 @@  @using PlexRequests.UI.Helpers @inherits PlexRequests.UI.Helpers.EmptyViewBase - - +@{ + var baseUrl = Html.GetBaseUrl(); + var formAction = string.Empty; + if (!string.IsNullOrEmpty(baseUrl.ToHtmlString())) + { + formAction = "/" + baseUrl.ToHtmlString(); + } +} +
@if (Model.NoticeEnable && (!Model.EnabledNoticeTime || Model.NoticeActive)) { diff --git a/PlexRequests.UI/Views/Requests/Index.cshtml b/PlexRequests.UI/Views/Requests/Index.cshtml index 95db35a11..e0e36f5ed 100644 --- a/PlexRequests.UI/Views/Requests/Index.cshtml +++ b/PlexRequests.UI/Views/Requests/Index.cshtml @@ -1,408 +1,379 @@ -@using Nancy.Security -@using PlexRequests.UI.Helpers -@{ - var baseUrl = Html.GetBaseUrl(); - var formAction = string.Empty; - if (!string.IsNullOrEmpty(baseUrl.ToHtmlString())) - { - formAction = "/" + baseUrl.ToHtmlString(); - } -} -
-

Requests

-

Below you can see yours and all other requests, as well as their download and approval status.

-
- - - -
- - -
-
-
-
-
- @if (Context.CurrentUser.IsAuthenticated()) //TODO replace with IsAdmin - { - @if (Model.SearchForMovies) - { - - - } - @if (Model.SearchForTvShows) - { - - - } - @if (Model.SearchForMusic) - { - - - } - } -
- - -
-
-
- @if (Model.SearchForMovies) - { - - -
- -
-
- -
-
-
- } - - @if (Model.SearchForTvShows) - { - -
- -
-
- -
-
-
- } - - @if (Model.SearchForMusic) - { - -
- -
-
- -
-
-
- } -
- -
- - - - - - - - - - -@Html.LoadRequestAssets() - - +@using Nancy.Security +@using PlexRequests.UI.Helpers +@{ + var baseUrl = Html.GetBaseUrl(); + var formAction = string.Empty; + if (!string.IsNullOrEmpty(baseUrl.ToHtmlString())) + { + formAction = "/" + baseUrl.ToHtmlString(); + } +} +
+

Requests

+

Below you can see yours and all other requests, as well as their download and approval status.

+
+ + + +
+ + +
+
+
+
+
+ @if (Context.CurrentUser.IsAuthenticated()) //TODO replace with IsAdmin + { + @if (Model.SearchForMovies) + { + + + } + @if (Model.SearchForTvShows) + { + + + } + @if (Model.SearchForMusic) + { + + + } + } +
+ + +
+
+
+ @if (Model.SearchForMovies) + { + + +
+ +
+
+ +
+
+
+ } + + @if (Model.SearchForTvShows) + { + +
+ +
+
+ +
+
+
+ } + + @if (Model.SearchForMusic) + { + +
+ +
+
+ +
+
+
+ } +
+ +
+ + + + + + + + +@Html.LoadRequestAssets() + +