Skip to content

Commit d1a41de

Browse files
committed
TD_5434 code changes for the new way for showing the banner text in the footer using view component, removing the banner text from the supervisor module and adding the centre information to the footer there.
1 parent 05b7dbf commit d1a41de

File tree

5 files changed

+58
-20
lines changed

5 files changed

+58
-20
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using DigitalLearningSolutions.Web.ViewModels.Common.ViewComponents;
2+
using Microsoft.AspNetCore.Mvc;
3+
4+
namespace DigitalLearningSolutions.Web.ViewComponents
5+
{
6+
public class DlsFooterBannerTextViewComponent : ViewComponent
7+
{
8+
public IViewComponentResult Invoke(string centreName)
9+
{
10+
var model = new DlsFooterBannerTextViewModel(centreName);
11+
return View(model);
12+
}
13+
}
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace DigitalLearningSolutions.Web.ViewModels.Common.ViewComponents
2+
{
3+
public class DlsFooterBannerTextViewModel
4+
{
5+
public readonly string? CentreName;
6+
7+
public DlsFooterBannerTextViewModel(string centreName)
8+
{
9+
CentreName = centreName;
10+
}
11+
12+
}
13+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@using DigitalLearningSolutions.Web.ViewModels.Common.ViewComponents
2+
@model DlsFooterBannerTextViewModel
3+
@{
4+
var currentApplication = ViewData["Application"]?.ToString();
5+
}
6+
@{
7+
if (!String.IsNullOrEmpty(currentApplication) && (currentApplication.Contains("Learning Portal") || currentApplication.Contains("Supervisor")))
8+
{
9+
<h2 class="nhsuk-heading-xs nhsuk-u-margin-bottom-2 nhsuk-u-secondary-text-color">Need help?</h2>
10+
<div class="nhsuk-footer nhsuk-u-font-size-16 nhsuk-u-secondary-text-color">
11+
<ul class="nhsuk-footer__list">
12+
<li class="nhsuk-footer__list-item">
13+
<span>Centre contact information:</span> <span>@Model.CentreName</span>
14+
</li>
15+
</ul>
16+
</div>
17+
// <hr class="nhsuk-footer-centre-banner-separator" />
18+
}
19+
}
20+
21+
@* <style type="text/css">
22+
.nhsuk-footer-centre-banner-separator {
23+
display: block;
24+
border: 0;
25+
border-bottom: 1px solid black;
26+
margin-top: 1%;
27+
}
28+
</style> *@

DigitalLearningSolutions.Web/Views/Shared/_DlsFooter.cshtml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,10 @@
11
@{
2-
var currentPath = Context.Request.Path.ToString();
2+
33
}
44
<footer role="contentinfo">
55
<div class="nhsuk-footer-container">
66
<div class="nhsuk-width-container">
7-
@{
8-
if (currentPath.Contains("/LearningPortal/Current") || currentPath.Contains("/LearningPortal/Completed") || currentPath.Contains("/LearningPortal/Available"))
9-
{
10-
<h2 class="nhsuk-heading-xs nhsuk-u-margin-bottom-2 nhsuk-u-secondary-text-color">Need help?</h2>
11-
<div class="nhsuk-footer nhsuk-u-font-size-16 nhsuk-u-secondary-text-color">
12-
<ul class="nhsuk-footer__list">
13-
<li class="nhsuk-footer__list-item">
14-
<span>Centre contact information:</span> <span>@ViewData["BannerText"]</span>
15-
</li>
16-
</ul>
17-
</div>
18-
}
19-
}
20-
</div>
21-
<div class="nhsuk-width-container">
7+
@await Component.InvokeAsync("DlsFooterBannerText", new { centreName = ViewData["BannerText"] })
228
<h2 class="nhsuk-u-visually-hidden">Support links</h2>
239
<div class="nhsuk-footer">
2410
<ul class="nhsuk-footer__list">

DigitalLearningSolutions.Web/Views/Supervisor/Index.cshtml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,7 @@ else
5151
{
5252
<p>There are no tasks requiring your attention.</p>
5353
}
54-
@if (Model.BannerText != null)
55-
{
56-
<h2 class="page-subheading word-break">@Model.BannerText</h2>
57-
}
54+
5855
<ul class="nhsuk-grid-row nhsuk-card-group">
5956

6057
<feature name="@(FeatureFlags.SupervisorProfileAssessmentInterface)">

0 commit comments

Comments
 (0)