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.Description
-@Model.BannerText
@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 { -- No data to display -
- } - else - { -+ No data to display +
} -- No data to display -
- } - else - { -+ No data to display +
+ } + else + { +- You are not enrolled on anything. View Available activities. -
- } - else - { -+ You are not enrolled on anything. View Available activities. +
+ } + else + { +