File tree Expand file tree Collapse file tree 10 files changed +29
-18
lines changed
DigitalLearningSolutions.Web
ViewModels/Common/ViewComponents Expand file tree Collapse file tree 10 files changed +29
-18
lines changed Original file line number Diff line number Diff line change 1- using DigitalLearningSolutions . Web . ViewModels . Common . ViewComponents ;
1+ using System . Security . Claims ;
2+ using DigitalLearningSolutions . Data . DataServices ;
3+ using DigitalLearningSolutions . Web . Helpers ;
24using Microsoft . AspNetCore . Mvc ;
5+ using DigitalLearningSolutions . Web . ViewModels . Common . ViewComponents ;
6+ using DigitalLearningSolutions . Web . Services ;
7+ using System ;
8+ using System . Threading . Tasks ;
39
410namespace DigitalLearningSolutions . Web . ViewComponents
511{
612 public class DlsFooterBannerTextViewComponent : ViewComponent
713 {
8- public IViewComponentResult Invoke ( string centreName )
14+ private readonly ICentresService centresService ;
15+
16+ public DlsFooterBannerTextViewComponent ( ICentresService centresService )
917 {
10- var model = new DlsFooterBannerTextViewModel ( centreName ) ;
18+ this . centresService = centresService ;
19+ }
20+
21+ public IViewComponentResult Invoke ( )
22+ {
23+ var centreId = ( ( ClaimsPrincipal ) User ) . GetCustomClaimAsInt ( CustomClaimTypes . UserCentreId ) ;
24+ if ( centreId == null )
25+ {
26+ return View ( new DlsFooterBannerTextViewModel ( null ) ) ;
27+ }
28+
29+ var bannerText = centresService . GetBannerText ( Convert . ToInt32 ( centreId ) ) ;
30+ var model = new DlsFooterBannerTextViewModel ( bannerText ) ;
1131 return View ( model ) ;
1232 }
1333 }
Original file line number Diff line number Diff line change 22{
33 public class DlsFooterBannerTextViewModel
44 {
5- public readonly string ? CentreName ;
5+ public readonly string ? BannerText ;
66
7- public DlsFooterBannerTextViewModel ( string centreName )
7+ public DlsFooterBannerTextViewModel ( string bannerText )
88 {
9- CentreName = centreName ;
9+ BannerText = bannerText ;
1010 }
1111
1212 }
Original file line number Diff line number Diff line change 1212 ViewData [" CustomisationId" ] = Model .Id ;
1313 ViewData [" HeaderPath" ] = $" {Configuration [" AppRootPath" ]}/LearningMenu/{Model .Id }/Password" ;
1414 ViewData [" HeaderPathName" ] = Model .Title ;
15- ViewData [" BannerText" ] = Model .BannerText ;
1615}
1716@section NavMenuItems {
1817 <partial name =" Shared/_NavMenuItems" />
Original file line number Diff line number Diff line change 1212 ViewData [" CustomisationId" ] = Model .Id ;
1313 ViewData [" HeaderPath" ] = $" {Configuration [" AppRootPath" ]}/LearningMenu/{Model .Id }" ;
1414 ViewData [" HeaderPathName" ] = Model .Title ;
15- ViewData [" BannerText" ] = Model .BannerText ;
1615}
1716@section NavMenuItems {
1817 <partial name =" Shared/_NavMenuItems" />
Original file line number Diff line number Diff line change 1010 ViewData [" Title" ] = " Available Activities" ;
1111 ViewData [" HeaderPath" ] = $" {Configuration [" AppRootPath" ]}/LearningPortal/Available" ;
1212 ViewData [" HeaderPathName" ] = " Learning Portal" ;
13- ViewData [" BannerText" ] = Model .BannerText ;
1413}
1514
1615@section NavMenuItems {
Original file line number Diff line number Diff line change 1010 ViewData [" Title" ] = " My Completed Activities" ;
1111 ViewData [" HeaderPath" ] = $" {Configuration [" AppRootPath" ]}/LearningPortal/Completed" ;
1212 ViewData [" HeaderPathName" ] = " Learning Portal" ;
13- ViewData [" BannerText" ] = Model .BannerText ;
1413}
1514
1615@if (Model .JavascriptSearchSortFilterPaginateEnabled )
Original file line number Diff line number Diff line change 1212 ViewData [" Title" ] = " My Current Activities" ;
1313 ViewData [" HeaderPath" ] = $" {Configuration [" AppRootPath" ]}/LearningPortal/Current" ;
1414 ViewData [" HeaderPathName" ] = " Learning Portal" ;
15- ViewData [" BannerText" ] = Model .BannerText ;
1615}
1716
1817@section NavMenuItems {
Original file line number Diff line number Diff line change 11@using DigitalLearningSolutions .Web .ViewModels .Common .ViewComponents
22@model DlsFooterBannerTextViewModel
33@{
4- if (! String .IsNullOrEmpty (Model .CentreName ))
4+ if (! String .IsNullOrEmpty (Model .BannerText ))
55 {
66 < h2 class = " nhsuk-heading-xs nhsuk-u-margin-bottom-2 nhsuk-u-secondary-text-color" > Need help ? < / h2 >
77 < div class = " nhsuk-footer nhsuk-u-font-size-16 nhsuk-u-secondary-text-color" >
88 < ul class = " nhsuk-footer__list" >
99 < li class = " nhsuk-footer__list-item" >
10- < span > Centre contact information : < / span > < span > @Model .CentreName < / span >
10+ < span > Centre contact information : < / span > < span > @Model .BannerText < / span >
1111 < / li >
1212 < / ul >
1313 < / div >
Original file line number Diff line number Diff line change 1- @{
2-
3- }
41<footer role =" contentinfo" >
52 <div class =" nhsuk-footer-container" >
63 <div class =" nhsuk-width-container" >
7- @await Component.InvokeAsync("DlsFooterBannerText", new { centreName = ViewData [ " BannerText " ] } )
4+ @await Component.InvokeAsync("DlsFooterBannerText")
85 <h2 class =" nhsuk-u-visually-hidden" >Support links</h2 >
96 <div class =" nhsuk-footer" >
107 <ul class =" nhsuk-footer__list" >
Original file line number Diff line number Diff line change 66 ViewData [" Title" ] = " Dashboard" ;
77 ViewData [" Application" ] = " Supervisor" ;
88 ViewData [" HeaderPathName" ] = " Supervisor" ;
9- ViewData [" BannerText" ] = Model .BannerText ;
109}
1110<link rel =" stylesheet" href =" @Url.Content(" ~ /css /frameworks /frameworksShared.css " )" asp-append-version =" true" >
1211@section NavMenuItems {
You can’t perform that action at this time.
0 commit comments