Skip to content

Commit bfbaffd

Browse files
authored
Причесать меню (#2833)
* Add plus to addcharacter in menu * убрать отдельный пункт меню «форумы» * Пофиксить кнопку «заявиться» в меню игрока * Причесать меню группы
1 parent 165f5ee commit bfbaffd

File tree

5 files changed

+23
-44
lines changed

5 files changed

+23
-44
lines changed

src/JoinRpg.Portal/Menu/ProjectMenuViewComponent.cs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,16 @@
1010

1111
namespace JoinRpg.Portal.Menu;
1212

13-
public class ProjectMenuViewComponent : ViewComponent
13+
public class ProjectMenuViewComponent(
14+
ICurrentUserAccessor currentUserAccessor,
15+
IProjectRepository projectRepository,
16+
ICurrentProjectAccessor currentProjectAccessor) : ViewComponent
1417
{
15-
public ProjectMenuViewComponent(ICurrentUserAccessor currentUserAccessor, IProjectRepository projectRepository, ICurrentProjectAccessor currentProjectAccessor)
16-
{
17-
CurrentUserAccessor = currentUserAccessor;
18-
ProjectRepository = projectRepository;
19-
CurrentProjectAccessor = currentProjectAccessor;
20-
}
21-
22-
private ICurrentUserAccessor CurrentUserAccessor { get; }
23-
private IProjectRepository ProjectRepository { get; }
24-
private ICurrentProjectAccessor CurrentProjectAccessor { get; }
25-
2618
public async Task<IViewComponentResult> InvokeAsync()
2719
{
28-
var project = await ProjectRepository.GetProjectAsync(CurrentProjectAccessor.ProjectId);
20+
var project = await projectRepository.GetProjectAsync(currentProjectAccessor.ProjectId);
2921

30-
var acl = project.ProjectAcls.FirstOrDefault(a => a.UserId == CurrentUserAccessor.UserIdOrDefault);
22+
var acl = project.ProjectAcls.FirstOrDefault(a => a.UserId == currentUserAccessor.UserIdOrDefault);
3123

3224
if (acl != null)
3325
{
@@ -43,7 +35,7 @@ public async Task<IViewComponentResult> InvokeAsync()
4335
{
4436
var menuModel = new PlayerMenuViewModel()
4537
{
46-
Claims = project.Claims.OfUserActive(CurrentUserAccessor.UserIdOrDefault).Select(c => new ClaimShortListItemViewModel(c)).ToArray(),
38+
Claims = project.Claims.OfUserActive(currentUserAccessor.UserIdOrDefault).Select(c => new ClaimShortListItemViewModel(c)).ToArray(),
4739
PlotPublished = project.Details.PublishPlot,
4840
};
4941
SetCommonMenuParameters(menuModel, project);
@@ -57,13 +49,12 @@ private void SetCommonMenuParameters(MenuViewModelBase menuModel, Project projec
5749
menuModel.ProjectName = project.ProjectName;
5850
//TODO[GroupsLoad]. If we not loaded groups already, that's slow
5951
menuModel.BigGroups = project.RootGroup.ChildGroups.Where(
60-
cg => !cg.IsSpecial && cg.IsActive && cg.IsVisible(CurrentUserAccessor.UserIdOrDefault))
52+
cg => !cg.IsSpecial && cg.IsActive && cg.IsVisible(currentUserAccessor.UserIdOrDefault))
6153
.Select(cg => new CharacterGroupLinkSlimViewModel(new(cg.ProjectId), cg.CharacterGroupId, cg.CharacterGroupName, cg.IsPublic, cg.IsActive)).ToList();
6254
menuModel.IsAcceptingClaims = project.IsAcceptingClaims;
6355
menuModel.IsActive = project.Active;
64-
menuModel.RootGroupId = project.RootGroup.CharacterGroupId;
6556
menuModel.EnableAccommodation = project.Details.EnableAccommodation;
66-
menuModel.IsAdmin = CurrentUserAccessor.IsAdmin;
57+
menuModel.IsAdmin = currentUserAccessor.IsAdmin;
6758
menuModel.ShowSchedule = project.Details.ScheduleEnabled;
6859
}
6960
}

src/JoinRpg.Portal/Views/Shared/Components/ProjectMenu/MasterMenu.cshtml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
@Html.ActionLink("Удаленные персонажи", "Deleted", "CharacterList", new { Model.ProjectId }, null)
8181
</li>
8282
<li>
83-
<a asp-controller="Character" asp-action="Create" asp-route-projectId="@Model.ProjectId">Добавить персонажа</a>
83+
<a asp-controller="Character" asp-action="Create" asp-route-projectId="@Model.ProjectId"><i class="glyphicon glyphicon-plus"></i>Добавить персонажа</a>
8484
</li>
8585

8686
@if (Model.BigGroups.Any())
@@ -125,13 +125,6 @@
125125
}
126126
</ul>
127127
</li>
128-
<li class="dropdown">
129-
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Форумы<span class="caret"></span></a>
130-
131-
<ul class="dropdown-menu">
132-
<li>@Html.ActionLink("Все активные", "ListThreads", "Forum", new { Model.ProjectId }, null)</li>
133-
</ul>
134-
</li>
135128
<li class="dropdown">
136129
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Финансы/АХЧ<span class="caret"></span></a>
137130
<ul class="dropdown-menu">
@@ -162,7 +155,7 @@
162155
<ul class="dropdown-menu">
163156
<li>@Html.ActionLink("Встроить ролевку на сайт", "Apis", "GameTools", new { Model.ProjectId }, null)</li>
164157
<li>@Html.ActionLink("Распечатки", "Index", "Print", new { Model.ProjectId }, null)</li>
165-
158+
<li>@Html.ActionLink("Форумы", "ListThreads", "Forum", new { Model.ProjectId }, null)</li>
166159
<li>@Html.ActionLink("Поля персонажа / заявки", "Index", "GameField", new { Model.ProjectId }, null)</li>
167160
<li>@Html.ActionLink("Мастера", "Index", "Acl", new { Model.ProjectId }, null)</li>
168161
<li><a asp-page="/GamePages/ResponsibleMasterRules" asp-route-projectId="@Model.ProjectId">

src/JoinRpg.Portal/Views/Shared/Components/ProjectMenu/PlayerMenu.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@
6262
</ul>
6363
</li>
6464
}
65-
else if (Model.RootGroupId != null)
65+
else
6666
{
6767
<li>
68-
@Html.ActionLink("Заявиться", "AddForGroup", "Claim", new { Model.ProjectId, CharacterGroupId = Model.RootGroupId }, null)
68+
@Html.ActionLink("Заявиться", "AddForGroup", "Claim", new { Model.ProjectId}, null)
6969
</li>
7070
}
7171

src/JoinRpg.Portal/Views/Shared/DisplayTemplates/CharacterGroupDetailsViewModel.cshtml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@
4545
asp-route-charactergroupid="@Model.CharacterGroupId">
4646
Обсуждаемые
4747
</nav-link>
48-
<nav-link
49-
asp-controller="ClaimList"
50-
asp-action="ListForGroupDirect"
51-
asp-route-projectid="@Model.ProjectId"
52-
asp-route-charactergroupid="@Model.CharacterGroupId">
53-
Заявки в группу
54-
</nav-link>
48+
@if (Model.IsAcceptingClaims || Model.ActiveClaimsCount > 0)
49+
{
50+
<nav-link
51+
asp-controller="ClaimList"
52+
asp-action="ListForGroupDirect"
53+
asp-route-projectid="@Model.ProjectId"
54+
asp-route-charactergroupid="@Model.CharacterGroupId">
55+
Заявки в группу
56+
</nav-link>
57+
}
5558
}
5659
<nav-link
5760
asp-controller="CharacterList"
@@ -78,13 +81,6 @@
7881
</nav-link>
7982
}
8083
}
81-
<nav-link
82-
asp-controller="Forum"
83-
asp-action="ListThreadsByGroup"
84-
asp-route-projectid="@Model.ProjectId"
85-
asp-route-charactergroupid="@Model.CharacterGroupId">
86-
Форумы
87-
</nav-link>
8884
</ul>
8985

9086
</div>

src/JoinRpg.WebPortal.Models/MasterMenuViewModel.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public class MenuViewModelBase
1212
public bool IsActive { get; set; }
1313
public bool IsAcceptingClaims { get; set; }
1414
public bool EnableAccommodation { get; set; }
15-
public int? RootGroupId { get; set; }
1615
public IEnumerable<CharacterGroupLinkSlimViewModel> BigGroups { get; set; } = null!;
1716
public bool IsAdmin { get; set; }
1817
public bool ShowSchedule { get; set; }

0 commit comments

Comments
 (0)