Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions LearningHub.Nhs.WebUI/Models/NavigationModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,10 @@ public class NavigationModel
/// Gets or sets a value indicating whether to show Browse Catalogues.
/// </summary>
public bool ShowBrowseCatalogues { get; set; }

/// <summary>
/// Gets or sets a value indicating whether ShowHome.
/// </summary>
public bool ShowHome { get; set; }
}
}
35 changes: 21 additions & 14 deletions LearningHub.Nhs.WebUI/Services/NavigationPermissionService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public NavigationModel NotAuthenticated()
{
return new NavigationModel()
{
ShowHome = false,
ShowMyContributions = false,
ShowMyLearning = false,
ShowMyBookmarks = false,
Expand All @@ -98,15 +99,16 @@ private NavigationModel AuthenticatedAdministrator(string controllerName)
{
return new NavigationModel()
{
ShowHome = true,
ShowMyContributions = true,
ShowMyLearning = true,
ShowMyBookmarks = true,
ShowMyBookmarks = false,
ShowSearch = controllerName != "search" && controllerName != string.Empty,
ShowAdmin = true,
ShowForums = true,
ShowHelp = true,
ShowHelp = false,
ShowMyRecords = true,
ShowNotifications = true,
ShowNotifications = false,
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = true,
Expand All @@ -123,15 +125,16 @@ private async Task<NavigationModel> AuthenticatedBlueUser(string controllerName)
{
return new NavigationModel()
{
ShowHome = true,
ShowMyContributions = await this.userGroupService.UserHasCatalogueContributionPermission(),
ShowMyLearning = true,
ShowMyBookmarks = true,
ShowMyBookmarks = false,
ShowSearch = controllerName != "search" && controllerName != string.Empty,
ShowAdmin = false,
ShowForums = true,
ShowHelp = true,
ShowHelp = false,
ShowMyRecords = true,
ShowNotifications = true,
ShowNotifications = false,
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = true,
Expand All @@ -147,13 +150,14 @@ private NavigationModel AuthenticatedGuest()
{
return new NavigationModel()
{
ShowHome = true,
ShowMyContributions = false,
ShowMyLearning = false,
ShowMyBookmarks = false,
ShowSearch = false,
ShowAdmin = false,
ShowForums = false,
ShowHelp = true,
ShowHelp = false,
ShowMyRecords = false,
ShowNotifications = false,
ShowRegister = false,
Expand All @@ -172,15 +176,16 @@ private async Task<NavigationModel> AuthenticatedReadOnly(string controllerName)
{
return new NavigationModel()
{
ShowHome = true,
ShowMyContributions = await this.resourceService.UserHasPublishedResourcesAsync(),
ShowMyLearning = true,
ShowMyBookmarks = true,
ShowMyBookmarks = false,
ShowSearch = controllerName != "search" && controllerName != string.Empty,
ShowAdmin = false,
ShowForums = true,
ShowHelp = true,
ShowHelp = false,
ShowMyRecords = true,
ShowNotifications = true,
ShowNotifications = false,
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = false,
Expand All @@ -196,15 +201,16 @@ private async Task<NavigationModel> AuthenticatedBasicUserOnly()
{
return new NavigationModel()
{
ShowHome = true,
ShowMyContributions = await this.resourceService.UserHasPublishedResourcesAsync(),
ShowMyLearning = true,
ShowMyBookmarks = true,
ShowMyBookmarks = false,
ShowSearch = true,
ShowAdmin = false,
ShowForums = true,
ShowHelp = true,
ShowHelp = false,
ShowMyRecords = true,
ShowNotifications = true,
ShowNotifications = false,
ShowRegister = false,
ShowSignOut = true,
ShowMyAccount = true,
Expand All @@ -220,13 +226,14 @@ private NavigationModel InLoginWizard()
{
return new NavigationModel()
{
ShowHome = true,
ShowMyContributions = false,
ShowMyLearning = false,
ShowMyBookmarks = false,
ShowSearch = false,
ShowAdmin = false,
ShowForums = false,
ShowHelp = true,
ShowHelp = false,
ShowMyRecords = false,
ShowNotifications = false,
ShowRegister = false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,113 +12,124 @@
}

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

@if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline())
{
@if (Model.ShowBrowseCatalogues)
{
<li class="nhsuk-header__navigation-item @Html.IsSelected("Catalogue")">
<a class="nhsuk-header__navigation-link" href="/allcatalogue">
Browse catalogues

</a>
</li>
}
@if (Model.ShowMyLearning)
{
@if (Model.ShowHome)
{
<li class="nhsuk-header__navigation-item @Html.IsSelected("Home")">
<a class="nhsuk-header__navigation-link" href="/">
Home
</a>
</li>
}
@if (Model.ShowMyLearning)
{
<li class="nhsuk-header__navigation-item @Html.IsSelected("MyLearning")">
<a class="nhsuk-header__navigation-link" href="/MyLearning">
My learning
</a>
</li>
}
@if (Model.ShowMyContributions)
{
<a class="nhsuk-header__navigation-link" href="/MyLearning">
My learning activity

</a>
</li>
}
@if (Model.ShowMyContributions)
{
<li class="nhsuk-header__navigation-item @Html.IsSelected("Contribute,ContributeResource")">
<a class="nhsuk-header__navigation-link" href="/my-contributions">
My contributions

</a>
</li>
}

@if (Model.ShowMyBookmarks)
{
<a class="nhsuk-header__navigation-link" href="/my-contributions">
My contributions

</a>
</li>
}
@if (Model.ShowBrowseCatalogues)
{
<li class="nhsuk-header__navigation-item @Html.IsSelected("Catalogue")">
<a class="nhsuk-header__navigation-link" href="/allcatalogue">
Browse catalogues

</a>
</li>
}

@if (Model.ShowMyBookmarks)
{
<li class="nhsuk-header__navigation-item @Html.IsSelected("Bookmark")">
<a class="nhsuk-header__navigation-link" href="/bookmark">
My bookmarks
</a>
</li>
}

@if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline())
{
@if (Model.ShowHelp)
{
<a class="nhsuk-header__navigation-link" href="/bookmark">
My bookmarks

</a>
</li>
}

@if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline())
{
@if (Model.ShowHelp)
{
<li class="nhsuk-header__navigation-item">
<a class="nhsuk-header__navigation-link" href="@(settings.Value.SupportUrls.SupportSite)" target="_blank">
Help
</a>
</li>
}
@if (Model.ShowNotifications)
{
<a class="nhsuk-header__navigation-link" href="@(settings.Value.SupportUrls.SupportSite)" target="_blank">
Help

</a>
</li>
}
@if (Model.ShowNotifications)
{
<li class="nhsuk-header__navigation-item @Html.IsSelected("Notification")">
<a class="nhsuk-header__navigation-link" asp-area="" asp-controller="Notification" asp-action="Index">
Notifications
@if (Model.NotificationCount > 0) {
<div class="nhsuk-header__notification-dot">@NotificationDisplay()</div>

}
</a>
</li>
@* - below contains notification number code to be implemented & styled as appropriate. See Helpers\UtilityHelper.cs FormatUnreadNotificationCount()
<a class="nhsuk-header__navigation-link" asp-area="" asp-controller="Notification" asp-action="Index">
Notifications
@if (Model.NotificationCount > 0)
{
<div class="nhsuk-header__notification-dot">@NotificationDisplay()</div>

}
</a>
</li>
@* - below contains notification number code to be implemented & styled as appropriate. See Helpers\UtilityHelper.cs FormatUnreadNotificationCount()
*@
}
@if (Model.ShowAdmin)
{
}
@if (Model.ShowAdmin)
{
<li class="nhsuk-header__navigation-item">
<a class="nhsuk-header__navigation-link" href="@(settings.Value.LearningHubAdminUrl)Home/Login" target="_blank">
Admin
</a>
</li>
}
}
@if (Model.ShowRegister)
{
@* can likely remove this condition as Register functionality removed from menu and only shown in main content window. see \Services\NavigationPermissionService.cs *@
<a class="nhsuk-header__navigation-link" href="@(settings.Value.LearningHubAdminUrl)Home/Login" target="_blank">
Admin

</a>
</li>
}
}
@if (Model.ShowRegister)
{
@* can likely remove this condition as Register functionality removed from menu and only shown in main content window. see \Services\NavigationPermissionService.cs *@
<li class="nhsuk-header__navigation-item @Html.IsSelected("Account")">
<a class="nhsuk-header__navigation-link" href="/create-an-account">
Create an account
</a>
</li>
}
}
<a class="nhsuk-header__navigation-link" href="/create-an-account">
Create an account
</a>
</li>
}
}

<!-- end default navigation -->

@functions{
@functions {
public bool SystemOffline()
{
return ViewContext.RouteData.Values["controller"].ToString() == "Offline"; ;
}

public string NotificationDisplay() {
if (Model.NotificationCount < 1) {
return "";
}

var returnString = Model.NotificationCount.ToString();

if (Model.NotificationCount > 9) {
returnString = "9+";
}

return returnString;

public string NotificationDisplay()
{
if (Model.NotificationCount < 1)
{
return "";
}

var returnString = Model.NotificationCount.ToString();

if (Model.NotificationCount > 9)
{
returnString = "9+";
}

return returnString;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
@model NavigationModel

<!-- start Mobile nav -->
@if (!Model.ShowHelp)
@* @if (!Model.ShowHelp)
{
<a class="nhsuk-account__login--link" href="@(settings.Value.SupportUrls.SupportSite)" target="_blank">Help</a>
}
}

else
{
{*@
@if (Model.ShowMyAccount)
{
<a class="nhsuk-account__login--link" asp-controller="Myaccount" asp-action="Index">My account</a>
Expand All @@ -31,6 +31,6 @@ else
<span class="nhsuk-u-visually-hidden">Search</span>
</button>
}
}
@* } *@

<!-- end Mobile nav -->
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
{
<a class="nhsuk-account__login--link" asp-controller="Home" asp-action="Logout">Log out</a>
}
@if (!Model.ShowHelp)
@* @if (!Model.ShowHelp)
{
<a class="nhsuk-account__login--link" href="@(settings.Value.SupportUrls.SupportSite)" target="_blank">Help</a>
}
} *@

<!-- end Topnav -->
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,10 @@ public class NavigationModel
/// Gets or sets a value indicating whether to show Browse Catalogues.
/// </summary>
public bool ShowBrowseCatalogues { get; set; }

/// <summary>
/// Gets or sets a value indicating whether to show home.
/// </summary>
public bool ShowHome { get; set; }
}
}
Loading
Loading