details page
This commit is contained in:
Родитель
ec62a4adad
Коммит
50eb877c10
|
@ -0,0 +1,9 @@
|
|||
namespace RPS.Web.Models.Routing
|
||||
{
|
||||
public enum DetailScreenEnum
|
||||
{
|
||||
Details,
|
||||
Tasks,
|
||||
Chitchat
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
namespace RPS.Web.Models.Routing
|
||||
{
|
||||
public enum PresetEnum
|
||||
{
|
||||
My,
|
||||
Open,
|
||||
Closed
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
@page "/{id:int}/Details"
|
||||
@model RPS.Web.Pages.Backlog.DetailsModel
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
|
@ -1,12 +1,15 @@
|
|||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using RPS.Core.Models;
|
||||
using RPS.Data;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using RPS.Core.Models;
|
||||
using RPS.Data;
|
||||
|
||||
namespace RPS.Web.Pages
|
||||
namespace RPS.Web.Pages.Backlog
|
||||
{
|
||||
public class BacklogModel : PageModel
|
||||
public class DetailsModel : PageModel
|
||||
{
|
||||
private const int CURRENT_USER_ID = 21; //Fake user id for demo
|
||||
|
||||
|
@ -15,14 +18,14 @@ namespace RPS.Web.Pages
|
|||
private readonly IPtTasksRepository rpsTasksRepo;
|
||||
private readonly IPtCommentsRepository rpsCommentsRepo;
|
||||
|
||||
public List<PtItem> Items { get; set; }
|
||||
public PtItem Item { get; set; }
|
||||
|
||||
public BacklogModel(
|
||||
|
||||
public DetailsModel(
|
||||
IPtUserRepository rpsUserData,
|
||||
IPtItemsRepository rpsItemsData,
|
||||
IPtTasksRepository rpsTasksData,
|
||||
IPtCommentsRepository rpsCommentsData
|
||||
)
|
||||
IPtCommentsRepository rpsCommentsData)
|
||||
{
|
||||
rpsUserRepo = rpsUserData;
|
||||
rpsItemsRepo = rpsItemsData;
|
||||
|
@ -30,9 +33,15 @@ namespace RPS.Web.Pages
|
|||
rpsCommentsRepo = rpsCommentsData;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
public void OnGet(int id)
|
||||
{
|
||||
Items = rpsItemsRepo.GetAll().ToList();
|
||||
var item = rpsItemsRepo.GetItemById(id);
|
||||
var users = rpsUserRepo.GetAll();
|
||||
var currentUser = users.Single(u => u.Id == CURRENT_USER_ID);
|
||||
|
||||
//ViewBag.screen = DetailScreenEnum.Details;
|
||||
//ViewBag.users = users;
|
||||
//ViewBag.currentUser = currentUser;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
@page
|
||||
@model RPS.Web.Pages.BacklogModel
|
||||
@page "/Backlog/{Preset?}"
|
||||
@model RPS.Web.Pages.Backlog.ItemsModel
|
||||
|
||||
|
||||
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3">
|
||||
|
@ -13,6 +13,8 @@
|
|||
|
||||
<div class="btn-group mr-2">
|
||||
<button onclick="location.href = '@(Url.Action("Create", "Backlog"))'">Add</button>
|
||||
<button asp-action="OnGet">On get</button>
|
||||
<a class="btn btn-secondary">On get ach</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -34,7 +36,7 @@
|
|||
<tbody>
|
||||
@foreach (var item in Model.Items)
|
||||
{
|
||||
<tr class="pt-table-row" onclick="location.href = '@(Url.Action("Details", new { id = item.Id }))'">
|
||||
<tr class="pt-table-row" onclick="location.href = '/@item.Id/Details'">
|
||||
|
||||
<td>
|
||||
<item-type-indicator item-type="@item.Type" class="backlog-icon"></item-type-indicator>
|
||||
|
@ -62,4 +64,3 @@
|
|||
<link href="~/css/backlog.css" rel="stylesheet" />
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using RPS.Core.Models;
|
||||
using RPS.Data;
|
||||
using RPS.Web.Models.Routing;
|
||||
|
||||
namespace RPS.Web.Pages.Backlog
|
||||
{
|
||||
public class ItemsModel : PageModel
|
||||
{
|
||||
private const int CURRENT_USER_ID = 21; //Fake user id for demo
|
||||
|
||||
private readonly IPtItemsRepository rpsItemsRepo;
|
||||
|
||||
public List<PtItem> Items { get; set; }
|
||||
|
||||
[BindProperty(SupportsGet = true)]
|
||||
public PresetEnum? Preset { get; set; }
|
||||
|
||||
public ItemsModel(
|
||||
IPtItemsRepository rpsItemsData
|
||||
)
|
||||
{
|
||||
rpsItemsRepo = rpsItemsData;
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
IEnumerable<PtItem> items = null;
|
||||
switch (Preset)
|
||||
{
|
||||
case PresetEnum.My:
|
||||
items = rpsItemsRepo.GetUserItems(CURRENT_USER_ID);
|
||||
break;
|
||||
case PresetEnum.Open:
|
||||
items = rpsItemsRepo.GetOpenItems();
|
||||
break;
|
||||
case PresetEnum.Closed:
|
||||
items = rpsItemsRepo.GetClosedItems();
|
||||
break;
|
||||
default:
|
||||
items = rpsItemsRepo.GetOpenItems();
|
||||
break;
|
||||
}
|
||||
Items = items.ToList();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,4 +15,8 @@
|
|||
<ProjectReference Include="..\RPS.Data\RPS.Data.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Models\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace RPS.Web.TagHelpers
|
|||
cl = className;
|
||||
}
|
||||
|
||||
output.Attributes.Add("src", User.Avatar);
|
||||
output.Attributes.Add("src", "/" + User.Avatar);
|
||||
output.Attributes.Add("class", cl);
|
||||
output.Attributes.Add("alt", User.FullName);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче