diff --git a/LearningHub.Nhs.WebUI/Models/NavigationModel.cs b/LearningHub.Nhs.WebUI/Models/NavigationModel.cs index 950343bde..25b51671c 100644 --- a/LearningHub.Nhs.WebUI/Models/NavigationModel.cs +++ b/LearningHub.Nhs.WebUI/Models/NavigationModel.cs @@ -74,5 +74,10 @@ public class NavigationModel /// Gets or sets a value indicating whether to show Browse Catalogues. /// public bool ShowBrowseCatalogues { get; set; } + + /// + /// Gets or sets a value indicating whether ShowHome. + /// + public bool ShowHome { get; set; } } } diff --git a/LearningHub.Nhs.WebUI/Services/NavigationPermissionService.cs b/LearningHub.Nhs.WebUI/Services/NavigationPermissionService.cs index e381b0403..7c357ada6 100644 --- a/LearningHub.Nhs.WebUI/Services/NavigationPermissionService.cs +++ b/LearningHub.Nhs.WebUI/Services/NavigationPermissionService.cs @@ -73,6 +73,7 @@ public NavigationModel NotAuthenticated() { return new NavigationModel() { + ShowHome = false, ShowMyContributions = false, ShowMyLearning = false, ShowMyBookmarks = false, @@ -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, @@ -123,15 +125,16 @@ private async Task 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, @@ -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, @@ -172,15 +176,16 @@ private async Task 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, @@ -196,15 +201,16 @@ private async Task 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, @@ -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, diff --git a/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Default.cshtml b/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Default.cshtml index 4f27477d5..43881e477 100644 --- a/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Default.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Default.cshtml @@ -12,113 +12,124 @@ } +@if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline()) +{ - @if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline()) - { - @if (Model.ShowBrowseCatalogues) - { -
  • - - Browse catalogues - - -
  • - } - @if (Model.ShowMyLearning) - { + @if (Model.ShowHome) + { +
  • + + Home + +
  • + } + @if (Model.ShowMyLearning) + {
  • - - My learning - - -
  • - } - @if (Model.ShowMyContributions) - { + + My learning activity + + + + } + @if (Model.ShowMyContributions) + {
  • - - My contributions - - -
  • - } - - @if (Model.ShowMyBookmarks) - { + + My contributions + + + + } + @if (Model.ShowBrowseCatalogues) + { +
  • + + Browse catalogues + + +
  • + } + + @if (Model.ShowMyBookmarks) + {
  • - - My bookmarks - - -
  • - } - - @if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline()) - { - @if (Model.ShowHelp) - { + + My bookmarks + + + + } + + @if (Context.Request.Path.Value != "/Home/Error" && !SystemOffline()) + { + @if (Model.ShowHelp) + {
  • - - Help - - -
  • - } - @if (Model.ShowNotifications) - { + + Help + + + + } + @if (Model.ShowNotifications) + {
  • - - Notifications - @if (Model.NotificationCount > 0) { -
    @NotificationDisplay()
    - - } -
    -
  • - @* - below contains notification number code to be implemented & styled as appropriate. See Helpers\UtilityHelper.cs FormatUnreadNotificationCount() + + Notifications + @if (Model.NotificationCount > 0) + { +
    @NotificationDisplay()
    + + } +
    + + @* - below contains notification number code to be implemented & styled as appropriate. See Helpers\UtilityHelper.cs FormatUnreadNotificationCount() *@ - } - @if (Model.ShowAdmin) - { + } + @if (Model.ShowAdmin) + {
  • - - Admin - - -
  • - } - } - @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 *@ + + Admin + + + + } + } + @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 *@
  • - - Create an account - -
  • - } - } + + Create an account + + + } +} - -@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; + } } \ No newline at end of file diff --git a/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/MobileTopRightNav.cshtml b/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/MobileTopRightNav.cshtml index 3ced465bc..45b09743d 100644 --- a/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/MobileTopRightNav.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/MobileTopRightNav.cshtml @@ -6,13 +6,13 @@ @model NavigationModel -@if (!Model.ShowHelp) +@* @if (!Model.ShowHelp) { -} +} else -{ +{*@ @if (Model.ShowMyAccount) { @@ -31,6 +31,6 @@ else Search } -} +@* } *@ diff --git a/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Topnav.cshtml b/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Topnav.cshtml index 3288a1a0f..fae78987b 100644 --- a/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Topnav.cshtml +++ b/LearningHub.Nhs.WebUI/Views/Shared/Components/NavigationItems/Topnav.cshtml @@ -14,9 +14,9 @@ { } -@if (!Model.ShowHelp) +@* @if (!Model.ShowHelp) { -} +} *@ diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Models/ViewModels/NavigationModel.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Models/ViewModels/NavigationModel.cs index 81f599c3f..912d99cae 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Models/ViewModels/NavigationModel.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Models/ViewModels/NavigationModel.cs @@ -74,5 +74,10 @@ public class NavigationModel /// Gets or sets a value indicating whether to show Browse Catalogues. /// public bool ShowBrowseCatalogues { get; set; } + + /// + /// Gets or sets a value indicating whether to show home. + /// + public bool ShowHome { get; set; } } } diff --git a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/NavigationPermissionService.cs b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/NavigationPermissionService.cs index e0bef0a1d..bd4cb5e16 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/NavigationPermissionService.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi.Services/Services/NavigationPermissionService.cs @@ -99,13 +99,13 @@ private NavigationModel AuthenticatedAdministrator(string controllerName) { 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, @@ -125,13 +125,13 @@ private async Task AuthenticatedBlueUser(string controllerName, { ShowMyContributions = await this.userGroupService.UserHasCatalogueContributionPermission(userId), 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, @@ -153,7 +153,7 @@ private NavigationModel AuthenticatedGuest() ShowSearch = false, ShowAdmin = false, ShowForums = false, - ShowHelp = true, + ShowHelp = false, ShowMyRecords = false, ShowNotifications = false, ShowRegister = false, @@ -174,13 +174,13 @@ private async Task AuthenticatedReadOnly(string controllerName, { ShowMyContributions = await resourceService.HasPublishedResourcesAsync(userId), 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, @@ -198,13 +198,13 @@ private async Task AuthenticatedBasicUserOnly(int userId) { ShowMyContributions = await resourceService.HasPublishedResourcesAsync(userId), 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, @@ -226,7 +226,7 @@ private NavigationModel InLoginWizard() ShowSearch = false, ShowAdmin = false, ShowForums = false, - ShowHelp = true, + ShowHelp = false, ShowMyRecords = false, ShowNotifications = false, ShowRegister = false, diff --git a/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/UserController.cs b/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/UserController.cs index 3dac1615d..166879ee3 100644 --- a/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/UserController.cs +++ b/OpenAPI/LearningHub.Nhs.OpenApi/Controllers/UserController.cs @@ -358,52 +358,37 @@ private List> MenuItems(NavigationModel model) { var menu = new List> { - new Dictionary + new Dictionary { - { "title", "Browse catalogues" }, - { "url", this.learningHubConfig.BrowseCataloguesUrl }, - { "visible", model.ShowBrowseCatalogues }, + { "title", "Home" }, + { "url", this.learningHubConfig.BaseUrl }, + { "visible", model.ShowMyLearning }, }, - new Dictionary + new Dictionary { - { "title", "My learning" }, + { "title", "My learning activity" }, { "url", this.learningHubConfig.MyLearningUrl }, { "visible", model.ShowMyLearning }, }, - new Dictionary + new Dictionary { { "title", "My contributions" }, { "url", this.learningHubConfig.MyContributionsUrl }, { "visible", model.ShowMyContributions }, }, - new Dictionary + new Dictionary { - { "title", "My bookmarks" }, - { "url", this.learningHubConfig.MyBookmarksUrl }, - { "visible", model.ShowMyBookmarks }, - }, - new Dictionary - { - { "title", "Help" }, - { "url", this.learningHubConfig.HelpUrl }, - { "visible", model.ShowHelp }, - { "openInNewTab", true }, - }, - new Dictionary - { - { "title", "Notifications" }, - { "url", this.learningHubConfig.NotificationsUrl }, - { "visible", model.ShowNotifications }, - { "hasNotification", model.NotificationCount > 0 }, - { "notificationCount", model.NotificationCount }, + { "title", "Browse catalogues" }, + { "url", this.learningHubConfig.BrowseCataloguesUrl }, + { "visible", model.ShowBrowseCatalogues }, }, - new Dictionary + new Dictionary { { "title", "Admin" }, { "url", this.learningHubConfig.AdminUrl }, { "visible", model.ShowAdmin }, }, - new Dictionary + new Dictionary { { "title", "Sign Out" }, { "url", this.learningHubConfig.SignOutUrl }, @@ -411,8 +396,6 @@ private List> MenuItems(NavigationModel model) }, }; return menu; - } - } } \ No newline at end of file