This commit is contained in:
tidusjar 2016-06-22 09:33:20 +01:00
parent ffc0ec34c4
commit 7b57e3fffc
6 changed files with 433 additions and 429 deletions

View file

@ -57,10 +57,6 @@ namespace PlexRequests.Core
var version = CheckSchema(); var version = CheckSchema();
if (version > 0) if (version > 0)
{ {
if (version > 1700 && version <= 1799)
{
MigrateToVersion1700();
}
if (version > 1799 && version <= 1800) if (version > 1799 && version <= 1800)
{ {
MigrateToVersion1800(); MigrateToVersion1800();

View file

@ -28,19 +28,43 @@ $(".theNoteSaveButton").click(function (e) {
}); });
// Update the note modal // Update the note modal
$('#noteModal').on('show.bs.modal', function (event) { $('#noteModal').on('show.bs.modal', function (event) {
var button = $(event.relatedTarget); // Button that triggered the modal var button = $(event.relatedTarget); // Button that triggered the modal
var id = button.data('identifier'); // Extract info from data-* attributes var id = button.data('identifier'); // Extract info from data-* attributes
var issue = button.data('issue'); var issue = button.data('issue');
var modal = $(this); var modal = $(this);
modal.find('.theNoteSaveButton').val(id); // Add ID to the button modal.find('.theNoteSaveButton').val(id); // Add ID to the button
var requestField = modal.find('.noteId'); var requestField = modal.find('.noteId');
requestField.val(id); // Add ID to the hidden field requestField.val(id); // Add ID to the hidden field
var noteType = modal.find('.issue'); var noteType = modal.find('.issue');
noteType.val(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");
}
});
});

View file

@ -48,7 +48,7 @@ namespace PlexRequests.UI.Modules
Get["/issuecount", true] = async (x, ct) => await IssueCount(); Get["/issuecount", true] = async (x, ct) => await IssueCount();
Get["/tabCount", true] = async (x, ct) => await TabCount(); 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); 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); this.RequiresClaims(UserClaims.Admin);
var issue = await IssuesService.GetAsync(issueId); var issue = await IssuesService.GetAsync(issueId);
var request = await RequestService.GetAsync(issue.RequestId); 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); await IssuesService.DeleteIssueAsync(issueId);
} }
return Response.AsJson(new JsonResponseModel() { Result = true }); return Response.AsJson(new JsonResponseModel { Result = true });
} }
catch (Exception e) catch (Exception e)

View file

@ -42,7 +42,7 @@
} }
@if (Model.IssueStatus == IssueStatus.ResolvedIssue) @if (Model.IssueStatus == IssueStatus.ResolvedIssue)
{ {
<form action="@formAction/issues/remove" method="post"> <form action="@formAction/issues/remove" method="post" id="removeForm">
<input id="issueId" name="issueId" value="@Model.Id" hidden="hidden" /> <input id="issueId" name="issueId" value="@Model.Id" hidden="hidden" />
<button type="submit" id="@Model.Id" class="btn btn-sm btn-danger-outline dropdown-toggle delete">Remove</button> <button type="submit" id="@Model.Id" class="btn btn-sm btn-danger-outline dropdown-toggle delete">Remove</button>
</form> </form>

View file

@ -1,8 +1,15 @@
 
@using PlexRequests.UI.Helpers @using PlexRequests.UI.Helpers
@inherits PlexRequests.UI.Helpers.EmptyViewBase<PlexRequests.UI.Models.LandingPageViewModel> @inherits PlexRequests.UI.Helpers.EmptyViewBase<PlexRequests.UI.Models.LandingPageViewModel>
@{
<img class="landing-header" src="~/Content/images/logo.png" width="300" /> var baseUrl = Html.GetBaseUrl();
var formAction = string.Empty;
if (!string.IsNullOrEmpty(baseUrl.ToHtmlString()))
{
formAction = "/" + baseUrl.ToHtmlString();
}
}
<img class="landing-header" src="@formAction/Content/images/logo.png" width="300" />
<div id="area" class="landing-block"> <div id="area" class="landing-block">
@if (Model.NoticeEnable && (!Model.EnabledNoticeTime || Model.NoticeActive)) @if (Model.NoticeEnable && (!Model.EnabledNoticeTime || Model.NoticeActive))
{ {

View file

@ -239,10 +239,6 @@
<li><a id="{{requestId}}" issue-select="2" class="dropdownIssue" href="#">Wrong Content</a></li> <li><a id="{{requestId}}" issue-select="2" class="dropdownIssue" href="#">Wrong Content</a></li>
<li><a id="{{requestId}}" issue-select="3" class="dropdownIssue" href="#">Playback Issues</a></li> <li><a id="{{requestId}}" issue-select="3" class="dropdownIssue" href="#">Playback Issues</a></li>
<li><a id="{{requestId}}" issue-select="4" class="dropdownIssue" data-identifier="{{requestId}}" href="#" data-toggle="modal" data-target="#myModal">Other</a></li> <li><a id="{{requestId}}" issue-select="4" class="dropdownIssue" data-identifier="{{requestId}}" href="#" data-toggle="modal" data-target="#myModal">Other</a></li>
{{#if_eq admin true}}
<li><a id="{{requestId}}" issue-select="4" class="note" data-identifier="{{requestId}}" href="#" data-toggle="modal" data-target="#noteModal">Add Note</a></li>
{{/if_eq}}
</ul> </ul>
</div> </div>
</form> </form>
@ -347,10 +343,6 @@
<li><a id="{{requestId}}" issue-select="2" class="dropdownIssue" href="#">Wrong Content</a></li> <li><a id="{{requestId}}" issue-select="2" class="dropdownIssue" href="#">Wrong Content</a></li>
<li><a id="{{requestId}}" issue-select="3" class="dropdownIssue" href="#">Playback Issues</a></li> <li><a id="{{requestId}}" issue-select="3" class="dropdownIssue" href="#">Playback Issues</a></li>
<li><a id="{{requestId}}" issue-select="4" class="dropdownIssue" data-identifier="{{requestId}}" href="#" data-toggle="modal" data-target="#myModal">Other</a></li> <li><a id="{{requestId}}" issue-select="4" class="dropdownIssue" data-identifier="{{requestId}}" href="#" data-toggle="modal" data-target="#myModal">Other</a></li>
{{#if_eq admin true}}
<li><a id="{{requestId}}" issue-select="4" class="note" data-identifier="{{requestId}}" href="#" data-toggle="modal" data-target="#noteModal">Add Note</a></li>
{{/if_eq}}
</ul> </ul>
</div> </div>
</form> </form>
@ -370,7 +362,7 @@
</div> </div>
<form method="POST" action="@formAction/issues/issuecomment" id="commentForm"> <form method="POST" action="@formAction/issues/issuecomment" id="commentForm">
<div class="modal-body"> <div class="modal-body">
<input name="requestId" class="requestId" type="text" hidden="hidden" value="" /> <input name="providerId" class="providerId" type="text" hidden="hidden" value="" />
<textarea class="form-control form-control-custom" rows="3" id="commentArea" name="commentArea"></textarea> <textarea class="form-control form-control-custom" rows="3" id="commentArea" name="commentArea"></textarea>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -382,27 +374,6 @@
</div> </div>
</div> </div>
<div class="modal fade" id="noteModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-times"></i></button>
<h4 class="modal-title">Add a note</h4>
</div>
<form method="POST" action="@formAction/requests/addnote" id="noteForm">
<div class="modal-body">
<input name="requestId" class="noteId" type="text" hidden="hidden" value="" />
<textarea class="form-control form-control-custom" rows="3" id="noteArea" name="noteArea"></textarea>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger-outline" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary-outline theNoteSaveButton" data-dismiss="modal">Save changes</button>
</div>
</form>
</div>
</div>
</div>
@Html.LoadRequestAssets() @Html.LoadRequestAssets()