diff --git a/DigitalLearningSolutions.Web/ViewComponents/DlsFooterBannerTextViewComponent.cs b/DigitalLearningSolutions.Web/ViewComponents/DlsFooterBannerTextViewComponent.cs new file mode 100644 index 0000000000..bf484f426e --- /dev/null +++ b/DigitalLearningSolutions.Web/ViewComponents/DlsFooterBannerTextViewComponent.cs @@ -0,0 +1,34 @@ +using System.Security.Claims; +using DigitalLearningSolutions.Data.DataServices; +using DigitalLearningSolutions.Web.Helpers; +using Microsoft.AspNetCore.Mvc; +using DigitalLearningSolutions.Web.ViewModels.Common.ViewComponents; +using DigitalLearningSolutions.Web.Services; +using System; +using System.Threading.Tasks; + +namespace DigitalLearningSolutions.Web.ViewComponents +{ + public class DlsFooterBannerTextViewComponent : ViewComponent + { + private readonly ICentresService centresService; + + public DlsFooterBannerTextViewComponent(ICentresService centresService) + { + this.centresService = centresService; + } + + public IViewComponentResult Invoke() + { + var centreId = ((ClaimsPrincipal)User).GetCustomClaimAsInt(CustomClaimTypes.UserCentreId); + if (centreId == null) + { + return View(new DlsFooterBannerTextViewModel(null)); + } + + var bannerText = centresService.GetBannerText(Convert.ToInt32(centreId)); + var model = new DlsFooterBannerTextViewModel(bannerText); + return View(model); + } + } +} diff --git a/DigitalLearningSolutions.Web/ViewModels/Common/ViewComponents/DlsFooterBannerTextViewModel.cs b/DigitalLearningSolutions.Web/ViewModels/Common/ViewComponents/DlsFooterBannerTextViewModel.cs new file mode 100644 index 0000000000..3a0fdcdd92 --- /dev/null +++ b/DigitalLearningSolutions.Web/ViewModels/Common/ViewComponents/DlsFooterBannerTextViewModel.cs @@ -0,0 +1,13 @@ +namespace DigitalLearningSolutions.Web.ViewModels.Common.ViewComponents +{ + public class DlsFooterBannerTextViewModel + { + public readonly string? BannerText; + + public DlsFooterBannerTextViewModel(string bannerText) + { + BannerText = bannerText; + } + + } +} diff --git a/DigitalLearningSolutions.Web/Views/LearningMenu/CoursePassword.cshtml b/DigitalLearningSolutions.Web/Views/LearningMenu/CoursePassword.cshtml index 2699f054e9..7f892b6015 100644 --- a/DigitalLearningSolutions.Web/Views/LearningMenu/CoursePassword.cshtml +++ b/DigitalLearningSolutions.Web/Views/LearningMenu/CoursePassword.cshtml @@ -36,7 +36,6 @@

@Model.Title

@Model.Description

-

@Model.BannerText

diff --git a/DigitalLearningSolutions.Web/Views/LearningMenu/Index.cshtml b/DigitalLearningSolutions.Web/Views/LearningMenu/Index.cshtml index eadf1f5d7b..a01dc12393 100644 --- a/DigitalLearningSolutions.Web/Views/LearningMenu/Index.cshtml +++ b/DigitalLearningSolutions.Web/Views/LearningMenu/Index.cshtml @@ -42,7 +42,6 @@ }

@Model.CentreName

-

@Model.BannerText

diff --git a/DigitalLearningSolutions.Web/Views/LearningPortal/Available/Available.cshtml b/DigitalLearningSolutions.Web/Views/LearningPortal/Available/Available.cshtml index 5fc25aa747..dcb270c4a7 100644 --- a/DigitalLearningSolutions.Web/Views/LearningPortal/Available/Available.cshtml +++ b/DigitalLearningSolutions.Web/Views/LearningPortal/Available/Available.cshtml @@ -6,58 +6,54 @@ @{ - ViewData["Application"] = "Learning Portal"; - ViewData["Title"] = "Available Activities"; - ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Available"; - ViewData["HeaderPathName"] = "Learning Portal"; + ViewData["Application"] = "Learning Portal"; + ViewData["Title"] = "Available Activities"; + ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Available"; + ViewData["HeaderPathName"] = "Learning Portal"; } @section NavMenuItems { - + } - @if (Model.JavascriptSearchSortFilterPaginateEnabled) +@if (Model.JavascriptSearchSortFilterPaginateEnabled) { - + }
-
-

Available Activities

- @if (Model.BannerText != null) - { -

@Model.BannerText

- } +
+

Available Activities

- + -
- @if (Model.NoDataFound) - { - - } - else - { - - - - -
- @foreach (var availableCourse in Model.AvailableCourses) +
+ @if (Model.NoDataFound) { - + } -
- } - -
+ else + { + + + + +
+ @foreach (var availableCourse in Model.AvailableCourses) + { + + } +
+ } + +
@if (Model.JavascriptSearchSortFilterPaginateEnabled) { - @section scripts { - -} + @section scripts { + + } } diff --git a/DigitalLearningSolutions.Web/Views/LearningPortal/Completed/Completed.cshtml b/DigitalLearningSolutions.Web/Views/LearningPortal/Completed/Completed.cshtml index 034b347511..bd2e5ae5af 100644 --- a/DigitalLearningSolutions.Web/Views/LearningPortal/Completed/Completed.cshtml +++ b/DigitalLearningSolutions.Web/Views/LearningPortal/Completed/Completed.cshtml @@ -6,67 +6,63 @@ @{ - ViewData["Application"] = "Learning Portal"; - ViewData["Title"] = "My Completed Activities"; - ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Completed"; - ViewData["HeaderPathName"] = "Learning Portal"; + ViewData["Application"] = "Learning Portal"; + ViewData["Title"] = "My Completed Activities"; + ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Completed"; + ViewData["HeaderPathName"] = "Learning Portal"; } @if (Model.JavascriptSearchSortFilterPaginateEnabled) { - + }
-
-

My Completed Activities

- @if (Model.BannerText != null) - { -

@Model.BannerText

- } - - @if (!Model.ApiIsAccessible) - { - - } +
+

My Completed Activities

- + @if (!Model.ApiIsAccessible) + { + + } -
- @if (Model.NoDataFound) - { - - } - else - { - - - + -
- @foreach (var completedLearningItem in Model.CompletedActivities) +
+ @if (Model.NoDataFound) { - if (completedLearningItem is CompletedCourseViewModel) - { - - } - else - { - - } + + } + else + { + + + + +
+ @foreach (var completedLearningItem in Model.CompletedActivities) + { + if (completedLearningItem is CompletedCourseViewModel) + { + + } + else + { + + } + } +
} -
- } - -
+ +
@if (Model.JavascriptSearchSortFilterPaginateEnabled) { - @section scripts { - -} + @section scripts { + + } } diff --git a/DigitalLearningSolutions.Web/Views/LearningPortal/Current/Current.cshtml b/DigitalLearningSolutions.Web/Views/LearningPortal/Current/Current.cshtml index 4a13b7b85a..8f1366568c 100644 --- a/DigitalLearningSolutions.Web/Views/LearningPortal/Current/Current.cshtml +++ b/DigitalLearningSolutions.Web/Views/LearningPortal/Current/Current.cshtml @@ -8,75 +8,71 @@ @{ - ViewData["Application"] = "Learning Portal"; - ViewData["Title"] = "My Current Activities"; - ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Current"; - ViewData["HeaderPathName"] = "Learning Portal"; + ViewData["Application"] = "Learning Portal"; + ViewData["Title"] = "My Current Activities"; + ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Current"; + ViewData["HeaderPathName"] = "Learning Portal"; } @section NavMenuItems { - + } - @if (Model.JavascriptSearchSortFilterPaginateEnabled) +@if (Model.JavascriptSearchSortFilterPaginateEnabled) { - + }
-
-

My Current Activities

- @if (Model.BannerText != null) - { -

@Model.BannerText

- } - - @if (!Model.ApiIsAccessible) - { - - } +
+

My Current Activities

- + @if (!Model.ApiIsAccessible) + { + + } - @if (Model.NoDataFound) - { - - } - else - { -
- - - + -
- @foreach (var currentLearningItem in Model.CurrentActivities) + @if (Model.NoDataFound) { - if (currentLearningItem is SelfAssessmentCardViewModel) - { - - } - else if (currentLearningItem is CurrentLearningResourceViewModel) - { - - } - else - { - - } + + } + else + { +
+ + + + +
+ @foreach (var currentLearningItem in Model.CurrentActivities) + { + if (currentLearningItem is SelfAssessmentCardViewModel) + { + + } + else if (currentLearningItem is CurrentLearningResourceViewModel) + { + + } + else + { + + } + } +
} -
- } - -
+ +
@if (Model.JavascriptSearchSortFilterPaginateEnabled) { - @section scripts { - -} + @section scripts { + + } } diff --git a/DigitalLearningSolutions.Web/Views/Shared/Components/DlsFooterBannerText/Default.cshtml b/DigitalLearningSolutions.Web/Views/Shared/Components/DlsFooterBannerText/Default.cshtml new file mode 100644 index 0000000000..c6ae013148 --- /dev/null +++ b/DigitalLearningSolutions.Web/Views/Shared/Components/DlsFooterBannerText/Default.cshtml @@ -0,0 +1,16 @@ +@using DigitalLearningSolutions.Web.ViewModels.Common.ViewComponents +@model DlsFooterBannerTextViewModel +@{ + if (!String.IsNullOrEmpty(Model.BannerText)) + { +

Need help?

+ + } +} + diff --git a/DigitalLearningSolutions.Web/Views/Shared/_DlsFooter.cshtml b/DigitalLearningSolutions.Web/Views/Shared/_DlsFooter.cshtml index e6247132a5..ce244973fa 100644 --- a/DigitalLearningSolutions.Web/Views/Shared/_DlsFooter.cshtml +++ b/DigitalLearningSolutions.Web/Views/Shared/_DlsFooter.cshtml @@ -1,6 +1,7 @@