backlog page unfiltered
This commit is contained in:
Родитель
83464c8c5c
Коммит
ec62a4adad
|
@ -5,7 +5,16 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="GenData\" />
|
||||
<None Remove="GenData\fs-items.json" />
|
||||
<None Remove="GenData\fs-users.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="GenData\fs-items.json" />
|
||||
<EmbeddedResource Include="GenData\fs-users.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Helpers\" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
@ -1,8 +1,65 @@
|
|||
@page
|
||||
@model core_test.Pages.BacklogModel
|
||||
@{
|
||||
ViewData["Title"] = "Backlog";
|
||||
@model RPS.Web.Pages.BacklogModel
|
||||
|
||||
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3">
|
||||
<h1 class="h2">Backlog</h1>
|
||||
<div class="btn-toolbar mb-2 mb-md-0">
|
||||
<div class="btn-group mr-2">
|
||||
<button onclick="location.href = '@(Url.Action("Items", "Backlog", new { preset = "My" }))'">My Items</button>
|
||||
<button onclick="location.href = '@(Url.Action("Items", "Backlog", new { preset = "Open" }))'">Open Items</button>
|
||||
<button onclick="location.href = '@(Url.Action("Items", "Backlog", new { preset = "Closed" }))'">Done Items</button>
|
||||
</div>
|
||||
|
||||
<div class="btn-group mr-2">
|
||||
<button onclick="location.href = '@(Url.Action("Create", "Backlog"))'">Add</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-sm table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Assignee</th>
|
||||
<th>Title</th>
|
||||
<th>Status</th>
|
||||
<th>Priority</th>
|
||||
<th>Estimate</th>
|
||||
<th>Created</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.Items)
|
||||
{
|
||||
<tr class="pt-table-row" onclick="location.href = '@(Url.Action("Details", new { id = item.Id }))'">
|
||||
|
||||
<td>
|
||||
<item-type-indicator item-type="@item.Type" class="backlog-icon"></item-type-indicator>
|
||||
</td>
|
||||
<td>
|
||||
<user-avatar user="@item.Assignee"></user-avatar>
|
||||
</td>
|
||||
<td><span class="li-title">@Html.DisplayFor(modelItem => item.Title)</span></td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Status)
|
||||
</td>
|
||||
<td>
|
||||
<priority-indicator priority="@item.Priority"></priority-indicator>
|
||||
</td>
|
||||
<td><span class="li-estimate">@Html.DisplayFor(modelItem => item.Estimate)</span></td>
|
||||
<td><span class="li-date">@item.DateCreated.ToString("MMM d, yyyy")</span></td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@section styles {
|
||||
<link href="~/css/backlog.css" rel="stylesheet" />
|
||||
}
|
||||
|
||||
<h2>Backlog</h2>
|
||||
|
||||
|
|
|
@ -1,17 +1,38 @@
|
|||
using System;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using RPS.Core.Models;
|
||||
using RPS.Data;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace core_test.Pages
|
||||
namespace RPS.Web.Pages
|
||||
{
|
||||
public class BacklogModel : PageModel
|
||||
{
|
||||
private const int CURRENT_USER_ID = 21; //Fake user id for demo
|
||||
|
||||
private readonly IPtUserRepository rpsUserRepo;
|
||||
private readonly IPtItemsRepository rpsItemsRepo;
|
||||
private readonly IPtTasksRepository rpsTasksRepo;
|
||||
private readonly IPtCommentsRepository rpsCommentsRepo;
|
||||
|
||||
public List<PtItem> Items { get; set; }
|
||||
|
||||
public BacklogModel(
|
||||
IPtUserRepository rpsUserData,
|
||||
IPtItemsRepository rpsItemsData,
|
||||
IPtTasksRepository rpsTasksData,
|
||||
IPtCommentsRepository rpsCommentsData
|
||||
)
|
||||
{
|
||||
rpsUserRepo = rpsUserData;
|
||||
rpsItemsRepo = rpsItemsData;
|
||||
rpsTasksRepo = rpsTasksData;
|
||||
rpsCommentsRepo = rpsCommentsData;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
|
||||
Items = rpsItemsRepo.GetAll().ToList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
@page
|
||||
@model core_test.Pages.DashboardModel
|
||||
@model RPS.Web.Pages.DashboardModel
|
||||
@{
|
||||
ViewData["Title"] = "Dashboard";
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Threading.Tasks;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
|
||||
namespace core_test.Pages
|
||||
namespace RPS.Web.Pages
|
||||
{
|
||||
public class DashboardModel : PageModel
|
||||
{
|
||||
|
|
|
@ -8,7 +8,9 @@
|
|||
<link href="~/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />
|
||||
<link href="~/css/site.css" rel="stylesheet" />
|
||||
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
@RenderSection("styles", required: false)
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
|
||||
|
@ -187,6 +189,7 @@
|
|||
|
||||
</div>
|
||||
|
||||
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
@RenderSection("scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
@using RPS.Web
|
||||
@namespace RPS.Web.Pages
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
@addTagHelper *, RPS.Web
|
|
@ -10,4 +10,9 @@
|
|||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RPS.Core\RPS.Core.csproj" />
|
||||
<ProjectReference Include="..\RPS.Data\RPS.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNetCore.HttpsPolicy;
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using RPS.Data;
|
||||
|
||||
namespace RPS.Web
|
||||
{
|
||||
|
@ -24,6 +25,14 @@ namespace RPS.Web
|
|||
// This method gets called by the runtime. Use this method to add services to the container.
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
var tempDataContext = new PtInMemoryContext();
|
||||
|
||||
services.AddSingleton<IPtUserRepository, PtUserRepository>(c => new PtUserRepository(tempDataContext));
|
||||
services.AddSingleton<IPtItemsRepository, PtItemsRepository>(c => new PtItemsRepository(tempDataContext));
|
||||
services.AddSingleton<IPtDashboardRepository, PtDashboardRepository>(c => new PtDashboardRepository(tempDataContext));
|
||||
services.AddSingleton<IPtTasksRepository, PtTasksRepository>(c => new PtTasksRepository(tempDataContext));
|
||||
services.AddSingleton<IPtCommentsRepository, PtCommentsRepository>(c => new PtCommentsRepository(tempDataContext));
|
||||
|
||||
services.Configure<CookiePolicyOptions>(options =>
|
||||
{
|
||||
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
using RPS.Core.Models.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RPS.Web.TagHelpers
|
||||
{
|
||||
[HtmlTargetElement("item-type-indicator")]
|
||||
public class ItemTypeIndicatorImageTagHelper : TagHelper
|
||||
{
|
||||
[HtmlAttributeName("item-type")]
|
||||
public ItemTypeEnum ItemType { get; set; }
|
||||
|
||||
[HtmlAttributeName("class")]
|
||||
public string className { get; set; }
|
||||
|
||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
var imgSrc = "";
|
||||
|
||||
switch (ItemType)
|
||||
{
|
||||
case ItemTypeEnum.Bug:
|
||||
imgSrc = "/images/icon_bug.png";
|
||||
break;
|
||||
case ItemTypeEnum.Chore:
|
||||
imgSrc = "/images/icon_chore.png";
|
||||
break;
|
||||
case ItemTypeEnum.Impediment:
|
||||
imgSrc = "/images/icon_impediment.png";
|
||||
break;
|
||||
case ItemTypeEnum.PBI:
|
||||
imgSrc = "/images/icon_pbi.png";
|
||||
break;
|
||||
}
|
||||
|
||||
output.TagName = "img";
|
||||
output.TagMode = TagMode.SelfClosing;
|
||||
|
||||
output.Attributes.Add("src", imgSrc);
|
||||
output.Attributes.Add("class", className);
|
||||
output.Attributes.Add("alt", ItemType.ToString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
using RPS.Core.Models.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RPS.Web.TagHelpers
|
||||
{
|
||||
[HtmlTargetElement("priority-indicator")]
|
||||
public class PriorityIndicatorTagHelper : TagHelper
|
||||
{
|
||||
[HtmlAttributeName("priority")]
|
||||
public PriorityEnum Priority { get; set; }
|
||||
|
||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
var priorityClassName = "";
|
||||
|
||||
switch (Priority)
|
||||
{
|
||||
case PriorityEnum.Critical:
|
||||
priorityClassName = "priority-critical";
|
||||
break;
|
||||
case PriorityEnum.High:
|
||||
priorityClassName = "priority-high";
|
||||
break;
|
||||
case PriorityEnum.Low:
|
||||
priorityClassName = "priority-low";
|
||||
break;
|
||||
case PriorityEnum.Medium:
|
||||
priorityClassName = "priority-medium";
|
||||
break;
|
||||
}
|
||||
|
||||
output.TagName = "span";
|
||||
output.TagMode = TagMode.StartTagAndEndTag;
|
||||
|
||||
output.Attributes.Add("class", "badge " + priorityClassName);
|
||||
output.Content.AppendHtml(Priority.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using Microsoft.AspNetCore.Razor.TagHelpers;
|
||||
using RPS.Core.Models;
|
||||
using System;
|
||||
|
||||
namespace RPS.Web.TagHelpers
|
||||
{
|
||||
[HtmlTargetElement("user-avatar")]
|
||||
public class UserAvatarTagHelper : TagHelper
|
||||
{
|
||||
[HtmlAttributeName("user")]
|
||||
public PtUser User { get; set; }
|
||||
|
||||
[HtmlAttributeName("class")]
|
||||
public string className { get; set; }
|
||||
|
||||
public override void Process(TagHelperContext context, TagHelperOutput output)
|
||||
{
|
||||
output.TagName = "img";
|
||||
output.TagMode = TagMode.SelfClosing;
|
||||
|
||||
string cl = "li-avatar rounded mx-auto d-block";
|
||||
if (!String.IsNullOrEmpty(className))
|
||||
{
|
||||
cl = className;
|
||||
}
|
||||
|
||||
output.Attributes.Add("src", User.Avatar);
|
||||
output.Attributes.Add("class", cl);
|
||||
output.Attributes.Add("alt", User.FullName);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче