From eb6d8af92eec2b85161e6c3af1be48bc5010500a Mon Sep 17 00:00:00 2001 From: tidusjar Date: Mon, 13 Jun 2016 13:21:38 +0100 Subject: [PATCH] small changes --- .../Models/IssuesDetailsViewModel.cs | 51 +++++++++++++++++++ PlexRequests.UI/Modules/IssuesModule.cs | 19 +++++-- PlexRequests.UI/PlexRequests.UI.csproj | 1 + PlexRequests.UI/Views/Admin/_Sidebar.cshtml | 1 + PlexRequests.UI/Views/Issues/Details.cshtml | 7 ++- 5 files changed, 72 insertions(+), 7 deletions(-) create mode 100644 PlexRequests.UI/Models/IssuesDetailsViewModel.cs diff --git a/PlexRequests.UI/Models/IssuesDetailsViewModel.cs b/PlexRequests.UI/Models/IssuesDetailsViewModel.cs new file mode 100644 index 000000000..b2126fd9d --- /dev/null +++ b/PlexRequests.UI/Models/IssuesDetailsViewModel.cs @@ -0,0 +1,51 @@ +#region Copyright +// /************************************************************************ +// Copyright (c) 2016 Jamie Rees +// File: IssuesDetailsViewModel.cs +// Created By: Jamie Rees +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// ************************************************************************/ +#endregion +using System.Collections.Generic; + +using PlexRequests.Core.Models; +using PlexRequests.Store; + +namespace PlexRequests.UI.Models +{ + public class IssuesDetailsViewModel + { + public IssuesDetailsViewModel() + { + Issues = new List(); + } + + public int Id { get; set; } + public string Title { get; set; } + public string PosterUrl { get; set; } + public int RequestId { get; set; } + public List Issues { get; set; } + public bool Deleted { get; set; } + public RequestType Type { get; set; } + public IssueStatus IssueStatus { get; set; } + public int ProviderId { get; set; } + } +} \ No newline at end of file diff --git a/PlexRequests.UI/Modules/IssuesModule.cs b/PlexRequests.UI/Modules/IssuesModule.cs index cce09e6ca..82cb1d2f0 100644 --- a/PlexRequests.UI/Modules/IssuesModule.cs +++ b/PlexRequests.UI/Modules/IssuesModule.cs @@ -135,10 +135,23 @@ namespace PlexRequests.UI.Modules public async Task Details(int id) { var issue = await IssuesService.GetAsync(id); + if (issue == null) + return Index(); + issue = Order(issue); - return issue == null - ? Index() - : View["Details", issue]; + var m = new IssuesDetailsViewModel + { + Issues = issue.Issues, + RequestId = issue.RequestId, + Title = issue.Title, + IssueStatus = issue.IssueStatus, + Deleted = issue.Deleted, + Type = issue.Type, + ProviderId = issue.ProviderId, + PosterUrl = issue.PosterUrl, + Id = issue.Id + }; + return View["Details", m]; } private async Task ReportRequestIssue(int requestId, IssueState issue, string comment) diff --git a/PlexRequests.UI/PlexRequests.UI.csproj b/PlexRequests.UI/PlexRequests.UI.csproj index 30442e1a8..99b5f8641 100644 --- a/PlexRequests.UI/PlexRequests.UI.csproj +++ b/PlexRequests.UI/PlexRequests.UI.csproj @@ -177,6 +177,7 @@ + diff --git a/PlexRequests.UI/Views/Admin/_Sidebar.cshtml b/PlexRequests.UI/Views/Admin/_Sidebar.cshtml index 4f85a898b..4791c9f19 100644 --- a/PlexRequests.UI/Views/Admin/_Sidebar.cshtml +++ b/PlexRequests.UI/Views/Admin/_Sidebar.cshtml @@ -15,5 +15,6 @@ @Html.GetSidebarUrl(Context, "/admin/slacknotification", "Slack Notifications") @Html.GetSidebarUrl(Context, "/admin/logs", "Logs") @Html.GetSidebarUrl(Context, "/admin/status", "Status") + @Html.GetSidebarUrl(Context, "/admin/scheduledjobs", "Scheduled Jobs") \ No newline at end of file diff --git a/PlexRequests.UI/Views/Issues/Details.cshtml b/PlexRequests.UI/Views/Issues/Details.cshtml index ccebcf41e..53a6c8994 100644 --- a/PlexRequests.UI/Views/Issues/Details.cshtml +++ b/PlexRequests.UI/Views/Issues/Details.cshtml @@ -1,7 +1,6 @@ @using System.Linq @using PlexRequests.Core.Models @using PlexRequests.UI.Helpers -@inherits Nancy.ViewEngines.Razor.NancyRazorViewBase @{ var baseUrl = Html.GetBaseUrl(); var formAction = string.Empty; @@ -24,15 +23,15 @@

Details

-
+
-
+

Issues For "@Model.Title"

@if (isAdmin) { -
+
@if (Model.IssueStatus == IssueStatus.PendingIssue) {