Skip to content

Commit 2a2e600

Browse files
Merge pull request #1370 from TechnologyEnhancedLearning/Develop/Task/TD-5714-Implement-new-header
TD-5714: Implement new header
2 parents 8c63beb + bb4f2ff commit 2a2e600

File tree

8 files changed

+167
-156
lines changed

8 files changed

+167
-156
lines changed

LearningHub.Nhs.WebUI/Models/NavigationModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,10 @@ public class NavigationModel
7474
/// Gets or sets a value indicating whether to show Browse Catalogues.
7575
/// </summary>
7676
public bool ShowBrowseCatalogues { get; set; }
77+
78+
/// <summary>
79+
/// Gets or sets a value indicating whether ShowHome.
80+
/// </summary>
81+
public bool ShowHome { get; set; }
7782
}
7883
}

LearningHub.Nhs.WebUI/Services/NavigationPermissionService.cs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public NavigationModel NotAuthenticated()
7373
{
7474
return new NavigationModel()
7575
{
76+
ShowHome = false,
7677
ShowMyContributions = false,
7778
ShowMyLearning = false,
7879
ShowMyBookmarks = false,
@@ -98,15 +99,16 @@ private NavigationModel AuthenticatedAdministrator(string controllerName)
9899
{
99100
return new NavigationModel()
100101
{
102+
ShowHome = true,
101103
ShowMyContributions = true,
102104
ShowMyLearning = true,
103-
ShowMyBookmarks = true,
105+
ShowMyBookmarks = false,
104106
ShowSearch = controllerName != "search" && controllerName != string.Empty,
105107
ShowAdmin = true,
106108
ShowForums = true,
107-
ShowHelp = true,
109+
ShowHelp = false,
108110
ShowMyRecords = true,
109-
ShowNotifications = true,
111+
ShowNotifications = false,
110112
ShowRegister = false,
111113
ShowSignOut = true,
112114
ShowMyAccount = true,
@@ -123,15 +125,16 @@ private async Task<NavigationModel> AuthenticatedBlueUser(string controllerName)
123125
{
124126
return new NavigationModel()
125127
{
128+
ShowHome = true,
126129
ShowMyContributions = await this.userGroupService.UserHasCatalogueContributionPermission(),
127130
ShowMyLearning = true,
128-
ShowMyBookmarks = true,
131+
ShowMyBookmarks = false,
129132
ShowSearch = controllerName != "search" && controllerName != string.Empty,
130133
ShowAdmin = false,
131134
ShowForums = true,
132-
ShowHelp = true,
135+
ShowHelp = false,
133136
ShowMyRecords = true,
134-
ShowNotifications = true,
137+
ShowNotifications = false,
135138
ShowRegister = false,
136139
ShowSignOut = true,
137140
ShowMyAccount = true,
@@ -147,13 +150,14 @@ private NavigationModel AuthenticatedGuest()
147150
{
148151
return new NavigationModel()
149152
{
153+
ShowHome = true,
150154
ShowMyContributions = false,
151155
ShowMyLearning = false,
152156
ShowMyBookmarks = false,
153157
ShowSearch = false,
154158
ShowAdmin = false,
155159
ShowForums = false,
156-
ShowHelp = true,
160+
ShowHelp = false,
157161
ShowMyRecords = false,
158162
ShowNotifications = false,
159163
ShowRegister = false,
@@ -172,15 +176,16 @@ private async Task<NavigationModel> AuthenticatedReadOnly(string controllerName)
172176
{
173177
return new NavigationModel()
174178
{
179+
ShowHome = true,
175180
ShowMyContributions = await this.resourceService.UserHasPublishedResourcesAsync(),
176181
ShowMyLearning = true,
177-
ShowMyBookmarks = true,
182+
ShowMyBookmarks = false,
178183
ShowSearch = controllerName != "search" && controllerName != string.Empty,
179184
ShowAdmin = false,
180185
ShowForums = true,
181-
ShowHelp = true,
186+
ShowHelp = false,
182187
ShowMyRecords = true,
183-
ShowNotifications = true,
188+
ShowNotifications = false,
184189
ShowRegister = false,
185190
ShowSignOut = true,
186191
ShowMyAccount = false,
@@ -196,15 +201,16 @@ private async Task<NavigationModel> AuthenticatedBasicUserOnly()
196201
{
197202
return new NavigationModel()
198203
{
204+
ShowHome = true,
199205
ShowMyContributions = await this.resourceService.UserHasPublishedResourcesAsync(),
200206
ShowMyLearning = true,
201-
ShowMyBookmarks = true,
207+
ShowMyBookmarks = false,
202208
ShowSearch = true,
203209
ShowAdmin = false,
204210
ShowForums = true,
205-
ShowHelp = true,
211+
ShowHelp = false,
206212
ShowMyRecords = true,
207-
ShowNotifications = true,
213+
ShowNotifications = false,
208214
ShowRegister = false,
209215
ShowSignOut = true,
210216
ShowMyAccount = true,
@@ -220,13 +226,14 @@ private NavigationModel InLoginWizard()
220226
{
221227
return new NavigationModel()
222228
{
229+
ShowHome = true,
223230
ShowMyContributions = false,
224231
ShowMyLearning = false,
225232
ShowMyBookmarks = false,
226233
ShowSearch = false,
227234
ShowAdmin = false,
228235
ShowForums = false,
229-
ShowHelp = true,
236+
ShowHelp = false,
230237
ShowMyRecords = false,
231238
ShowNotifications = false,
232239
ShowRegister = false,

LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Default.cshtml

Lines changed: 103 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -12,113 +12,124 @@
1212
}
1313

1414
<!-- start default navigation -->
15+
@if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline())
16+
{
1517

16-
@if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline())
17-
{
18-
@if (Model.ShowBrowseCatalogues)
19-
{
20-
<li class="nhsuk-header__navigation-item @Html.IsSelected("Catalogue")">
21-
<a class="nhsuk-header__navigation-link" href="/allcatalogue">
22-
Browse catalogues
23-
24-
</a>
25-
</li>
26-
}
27-
@if (Model.ShowMyLearning)
28-
{
18+
@if (Model.ShowHome)
19+
{
20+
<li class="nhsuk-header__navigation-item @Html.IsSelected("Home")">
21+
<a class="nhsuk-header__navigation-link" href="/">
22+
Home
23+
</a>
24+
</li>
25+
}
26+
@if (Model.ShowMyLearning)
27+
{
2928
<li class="nhsuk-header__navigation-item @Html.IsSelected("MyLearning")">
30-
<a class="nhsuk-header__navigation-link" href="/MyLearning">
31-
My learning
32-
33-
</a>
34-
</li>
35-
}
36-
@if (Model.ShowMyContributions)
37-
{
29+
<a class="nhsuk-header__navigation-link" href="/MyLearning">
30+
My learning activity
31+
32+
</a>
33+
</li>
34+
}
35+
@if (Model.ShowMyContributions)
36+
{
3837
<li class="nhsuk-header__navigation-item @Html.IsSelected("Contribute,ContributeResource")">
39-
<a class="nhsuk-header__navigation-link" href="/my-contributions">
40-
My contributions
41-
42-
</a>
43-
</li>
44-
}
45-
46-
@if (Model.ShowMyBookmarks)
47-
{
38+
<a class="nhsuk-header__navigation-link" href="/my-contributions">
39+
My contributions
40+
41+
</a>
42+
</li>
43+
}
44+
@if (Model.ShowBrowseCatalogues)
45+
{
46+
<li class="nhsuk-header__navigation-item @Html.IsSelected("Catalogue")">
47+
<a class="nhsuk-header__navigation-link" href="/allcatalogue">
48+
Browse catalogues
49+
50+
</a>
51+
</li>
52+
}
53+
54+
@if (Model.ShowMyBookmarks)
55+
{
4856
<li class="nhsuk-header__navigation-item @Html.IsSelected("Bookmark")">
49-
<a class="nhsuk-header__navigation-link" href="/bookmark">
50-
My bookmarks
51-
52-
</a>
53-
</li>
54-
}
55-
56-
@if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline())
57-
{
58-
@if (Model.ShowHelp)
59-
{
57+
<a class="nhsuk-header__navigation-link" href="/bookmark">
58+
My bookmarks
59+
60+
</a>
61+
</li>
62+
}
63+
64+
@if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline())
65+
{
66+
@if (Model.ShowHelp)
67+
{
6068
<li class="nhsuk-header__navigation-item">
61-
<a class="nhsuk-header__navigation-link" href="@(settings.Value.SupportUrls.SupportSite)" target="_blank">
62-
Help
63-
64-
</a>
65-
</li>
66-
}
67-
@if (Model.ShowNotifications)
68-
{
69+
<a class="nhsuk-header__navigation-link" href="@(settings.Value.SupportUrls.SupportSite)" target="_blank">
70+
Help
71+
72+
</a>
73+
</li>
74+
}
75+
@if (Model.ShowNotifications)
76+
{
6977
<li class="nhsuk-header__navigation-item @Html.IsSelected("Notification")">
70-
<a class="nhsuk-header__navigation-link" asp-area="" asp-controller="Notification" asp-action="Index">
71-
Notifications
72-
@if (Model.NotificationCount > 0) {
73-
<div class="nhsuk-header__notification-dot">@NotificationDisplay()</div>
74-
75-
}
76-
</a>
77-
</li>
78-
@* - below contains notification number code to be implemented & styled as appropriate. See Helpers\UtilityHelper.cs FormatUnreadNotificationCount()
78+
<a class="nhsuk-header__navigation-link" asp-area="" asp-controller="Notification" asp-action="Index">
79+
Notifications
80+
@if (Model.NotificationCount > 0)
81+
{
82+
<div class="nhsuk-header__notification-dot">@NotificationDisplay()</div>
83+
84+
}
85+
</a>
86+
</li>
87+
@* - below contains notification number code to be implemented & styled as appropriate. See Helpers\UtilityHelper.cs FormatUnreadNotificationCount()
7988
*@
80-
}
81-
@if (Model.ShowAdmin)
82-
{
89+
}
90+
@if (Model.ShowAdmin)
91+
{
8392
<li class="nhsuk-header__navigation-item">
84-
<a class="nhsuk-header__navigation-link" href="@(settings.Value.LearningHubAdminUrl)Home/Login" target="_blank">
85-
Admin
86-
87-
</a>
88-
</li>
89-
}
90-
}
91-
@if (Model.ShowRegister)
92-
{
93-
@* can likely remove this condition as Register functionality removed from menu and only shown in main content window. see \Services\NavigationPermissionService.cs *@
93+
<a class="nhsuk-header__navigation-link" href="@(settings.Value.LearningHubAdminUrl)Home/Login" target="_blank">
94+
Admin
95+
96+
</a>
97+
</li>
98+
}
99+
}
100+
@if (Model.ShowRegister)
101+
{
102+
@* can likely remove this condition as Register functionality removed from menu and only shown in main content window. see \Services\NavigationPermissionService.cs *@
94103
<li class="nhsuk-header__navigation-item @Html.IsSelected("Account")">
95-
<a class="nhsuk-header__navigation-link" href="/create-an-account">
96-
Create an account
97-
</a>
98-
</li>
99-
}
100-
}
104+
<a class="nhsuk-header__navigation-link" href="/create-an-account">
105+
Create an account
106+
</a>
107+
</li>
108+
}
109+
}
101110

102111
<!-- end default navigation -->
103-
104-
@functions{
112+
@functions {
105113
public bool SystemOffline()
106114
{
107115
return ViewContext.RouteData.Values["controller"].ToString() == "Offline"; ;
108116
}
109117

110-
public string NotificationDisplay() {
111-
if (Model.NotificationCount < 1) {
112-
return "";
113-
}
114-
115-
var returnString = Model.NotificationCount.ToString();
116-
117-
if (Model.NotificationCount > 9) {
118-
returnString = "9+";
119-
}
120-
121-
return returnString;
122-
118+
public string NotificationDisplay()
119+
{
120+
if (Model.NotificationCount < 1)
121+
{
122+
return "";
123+
}
124+
125+
var returnString = Model.NotificationCount.ToString();
126+
127+
if (Model.NotificationCount > 9)
128+
{
129+
returnString = "9+";
130+
}
131+
132+
return returnString;
133+
123134
}
124135
}

LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/MobileTopRightNav.cshtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
@model NavigationModel
77

88
<!-- start Mobile nav -->
9-
@if (!Model.ShowHelp)
9+
@* @if (!Model.ShowHelp)
1010
{
1111
<a class="nhsuk-account__login--link" href="@(settings.Value.SupportUrls.SupportSite)" target="_blank">Help</a>
12-
}
12+
}
1313
1414
else
15-
{
15+
{*@
1616
@if (Model.ShowMyAccount)
1717
{
1818
<a class="nhsuk-account__login--link" asp-controller="Myaccount" asp-action="Index">My account</a>
@@ -31,6 +31,6 @@ else
3131
<span class="nhsuk-u-visually-hidden">Search</span>
3232
</button>
3333
}
34-
}
34+
@* } *@
3535

3636
<!-- end Mobile nav -->

LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Topnav.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
{
1515
<a class="nhsuk-account__login--link" asp-controller="Home" asp-action="Logout">Log out</a>
1616
}
17-
@if (!Model.ShowHelp)
17+
@* @if (!Model.ShowHelp)
1818
{
1919
<a class="nhsuk-account__login--link" href="@(settings.Value.SupportUrls.SupportSite)" target="_blank">Help</a>
20-
}
20+
} *@
2121

2222
<!-- end Topnav -->

OpenAPI/LearningHub.Nhs.OpenApi.Models/ViewModels/NavigationModel.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,10 @@ public class NavigationModel
7474
/// Gets or sets a value indicating whether to show Browse Catalogues.
7575
/// </summary>
7676
public bool ShowBrowseCatalogues { get; set; }
77+
78+
/// <summary>
79+
/// Gets or sets a value indicating whether to show home.
80+
/// </summary>
81+
public bool ShowHome { get; set; }
7782
}
7883
}

0 commit comments

Comments
 (0)