Skip to content

Commit a961e4d

Browse files
authored
Merge pull request #3198 from TechnologyEnhancedLearning/Develop/feature/TD-5434_Move_Banner_Text_Into_Footer
TD_5434 Move the Centre Name to the top of footer across all Learning Portal Pages.
2 parents b395ce1 + 046fab2 commit a961e4d

File tree

10 files changed

+190
-143
lines changed

10 files changed

+190
-143
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using System.Security.Claims;
2+
using DigitalLearningSolutions.Data.DataServices;
3+
using DigitalLearningSolutions.Web.Helpers;
4+
using Microsoft.AspNetCore.Mvc;
5+
using DigitalLearningSolutions.Web.ViewModels.Common.ViewComponents;
6+
using DigitalLearningSolutions.Web.Services;
7+
using System;
8+
using System.Threading.Tasks;
9+
10+
namespace DigitalLearningSolutions.Web.ViewComponents
11+
{
12+
public class DlsFooterBannerTextViewComponent : ViewComponent
13+
{
14+
private readonly ICentresService centresService;
15+
16+
public DlsFooterBannerTextViewComponent(ICentresService centresService)
17+
{
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);
31+
return View(model);
32+
}
33+
}
34+
}
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? BannerText;
6+
7+
public DlsFooterBannerTextViewModel(string bannerText)
8+
{
9+
BannerText = bannerText;
10+
}
11+
12+
}
13+
}

DigitalLearningSolutions.Web/Views/LearningMenu/CoursePassword.cshtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
<div class="nhsuk-grid-column-full">
3737
<h1 id="page-heading" class="nhsuk-heading-xl">@Model.Title</h1>
3838
<p class="nhsuk-u-font-size-24">@Model.Description</p>
39-
<p class="nhsuk-u-secondary-text-color nhsuk-heading-s">@Model.BannerText</p>
4039
</div>
4140
</div>
4241

DigitalLearningSolutions.Web/Views/LearningMenu/Index.cshtml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
}
4343

4444
<p class="nhsuk-u-margin-bottom-0 nhsuk-heading-m">@Model.CentreName</p>
45-
<p class="nhsuk-u-secondary-text-color nhsuk-heading-s">@Model.BannerText</p>
4645
</div>
4746
</div>
4847

DigitalLearningSolutions.Web/Views/LearningPortal/Available/Available.cshtml

Lines changed: 33 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,58 +6,54 @@
66
<link rel="stylesheet" href="@Url.Content("~/css/learningPortal/courses.css")" asp-append-version="true">
77

88
@{
9-
ViewData["Application"] = "Learning Portal";
10-
ViewData["Title"] = "Available Activities";
11-
ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Available";
12-
ViewData["HeaderPathName"] = "Learning Portal";
9+
ViewData["Application"] = "Learning Portal";
10+
ViewData["Title"] = "Available Activities";
11+
ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Available";
12+
ViewData["HeaderPathName"] = "Learning Portal";
1313
}
1414

1515
@section NavMenuItems {
16-
<partial name="Shared/_NavMenuItems" />
16+
<partial name="Shared/_NavMenuItems" />
1717
}
1818

19-
@if (Model.JavascriptSearchSortFilterPaginateEnabled)
19+
@if (Model.JavascriptSearchSortFilterPaginateEnabled)
2020
{
21-
<vc:loading-spinner page-has-side-nav-menu="false" />
21+
<vc:loading-spinner page-has-side-nav-menu="false" />
2222
}
2323
<div class="nhsuk-grid-row" id="@(Model.JavascriptSearchSortFilterPaginateEnabled ? "js-styling-hidden-area-while-loading" : "no-js-styling")">
2424

25-
<div class="nhsuk-grid-column-full">
26-
<h1 id="page-heading">Available Activities</h1>
27-
@if (Model.BannerText != null)
28-
{
29-
<h2 class="page-subheading">@Model.BannerText</h2>
30-
}
25+
<div class="nhsuk-grid-column-full">
26+
<h1 id="page-heading">Available Activities</h1>
3127

32-
<partial name="SearchablePage/Configurations/_FullWidthSearchSortAndFilter" model="Model" />
28+
<partial name="SearchablePage/Configurations/_FullWidthSearchSortAndFilter" model="Model" />
3329

34-
<hr class="nhsuk-u-margin-top-3 nhsuk-u-margin-bottom-4" />
35-
@if (Model.NoDataFound)
36-
{
37-
<p class="nhsuk-u-margin-top-4" role="alert">
38-
<b>No data to display</b>
39-
</p>
40-
}
41-
else
42-
{
43-
<partial name="SearchablePage/_SearchResultsCount" model="Model" />
44-
<partial name="SearchablePage/_TopPagination" model="Model" />
45-
<partial name="SearchablePage/_ResultCountAndPageAlerts" model="Model" />
46-
47-
<div id="searchable-elements">
48-
@foreach (var availableCourse in Model.AvailableCourses)
30+
<hr class="nhsuk-u-margin-top-3 nhsuk-u-margin-bottom-4" />
31+
@if (Model.NoDataFound)
4932
{
50-
<partial name="Available/_AvailableCourseCard" model="availableCourse" />
33+
<p class="nhsuk-u-margin-top-4" role="alert">
34+
<b>No data to display</b>
35+
</p>
5136
}
52-
</div>
53-
}
54-
<partial name="SearchablePage/_BottomPagination" model="Model" />
55-
</div>
37+
else
38+
{
39+
<partial name="SearchablePage/_SearchResultsCount" model="Model" />
40+
<partial name="SearchablePage/_TopPagination" model="Model" />
41+
<partial name="SearchablePage/_ResultCountAndPageAlerts" model="Model" />
42+
43+
<div id="searchable-elements">
44+
@foreach (var availableCourse in Model.AvailableCourses)
45+
{
46+
<partial name="Available/_AvailableCourseCard" model="availableCourse" />
47+
}
48+
</div>
49+
}
50+
<partial name="SearchablePage/_BottomPagination" model="Model" />
51+
</div>
5652
</div>
5753

5854
@if (Model.JavascriptSearchSortFilterPaginateEnabled)
5955
{
60-
@section scripts {
61-
<script src="@Url.Content("~/js/learningPortal/available.js")" asp-append-version="true"></script>
62-
}
56+
@section scripts {
57+
<script src="@Url.Content("~/js/learningPortal/available.js")" asp-append-version="true"></script>
58+
}
6359
}

DigitalLearningSolutions.Web/Views/LearningPortal/Completed/Completed.cshtml

Lines changed: 43 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,67 +6,63 @@
66
<link rel="stylesheet" href="@Url.Content("~/css/learningPortal/completed.css")" asp-append-version="true">
77

88
@{
9-
ViewData["Application"] = "Learning Portal";
10-
ViewData["Title"] = "My Completed Activities";
11-
ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Completed";
12-
ViewData["HeaderPathName"] = "Learning Portal";
9+
ViewData["Application"] = "Learning Portal";
10+
ViewData["Title"] = "My Completed Activities";
11+
ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Completed";
12+
ViewData["HeaderPathName"] = "Learning Portal";
1313
}
1414

1515
@if (Model.JavascriptSearchSortFilterPaginateEnabled)
1616
{
17-
<vc:loading-spinner page-has-side-nav-menu="false" />
17+
<vc:loading-spinner page-has-side-nav-menu="false" />
1818
}
1919
<div class="nhsuk-grid-row" id="@(Model.JavascriptSearchSortFilterPaginateEnabled ? "js-styling-hidden-area-while-loading" : "no-js-styling")">
20-
<div class="nhsuk-grid-column-full">
21-
<h1 id="page-heading">My Completed Activities</h1>
22-
@if (Model.BannerText != null)
23-
{
24-
<h2 class="page-subheading">@Model.BannerText</h2>
25-
}
26-
27-
@if (!Model.ApiIsAccessible)
28-
{
29-
<vc:learning-resource-warning css-class="nhsuk-u-margin-bottom-4 nhsuk-u-margin-top-4"
30-
text="@LearningHubWarningTextHelper.ResourceDetailsMayBeOutOfDate" />
31-
}
20+
<div class="nhsuk-grid-column-full">
21+
<h1 id="page-heading">My Completed Activities</h1>
3222

33-
<partial name="SearchablePage/Configurations/_FullWidthSearchSortAndFilter" model="Model" />
23+
@if (!Model.ApiIsAccessible)
24+
{
25+
<vc:learning-resource-warning css-class="nhsuk-u-margin-bottom-4 nhsuk-u-margin-top-4"
26+
text="@LearningHubWarningTextHelper.ResourceDetailsMayBeOutOfDate" />
27+
}
3428

35-
<hr class="nhsuk-u-margin-top-3 nhsuk-u-margin-bottom-4" />
36-
@if (Model.NoDataFound)
37-
{
38-
<p class="nhsuk-u-margin-top-4" role="alert">
39-
<b>No data to display</b>
40-
</p>
41-
}
42-
else
43-
{
44-
<partial name="SearchablePage/_SearchResultsCount" model="Model" />
45-
<partial name="SearchablePage/_TopPagination" model="Model" />
46-
<partial name="SearchablePage/_ResultCountAndPageAlerts" model="Model" />
29+
<partial name="SearchablePage/Configurations/_FullWidthSearchSortAndFilter" model="Model" />
4730

48-
<div id="searchable-elements">
49-
@foreach (var completedLearningItem in Model.CompletedActivities)
31+
<hr class="nhsuk-u-margin-top-3 nhsuk-u-margin-bottom-4" />
32+
@if (Model.NoDataFound)
5033
{
51-
if (completedLearningItem is CompletedCourseViewModel)
52-
{
53-
<partial name="Completed/CompletedCourseCard/_CompletedCourseCard" model="completedLearningItem" />
54-
}
55-
else
56-
{
57-
<partial name="Completed/CompletedActionPlanResourceCard/_CompletedActionPlanResourceCard" model="completedLearningItem" />
58-
}
34+
<p class="nhsuk-u-margin-top-4" role="alert">
35+
<b>No data to display</b>
36+
</p>
37+
}
38+
else
39+
{
40+
<partial name="SearchablePage/_SearchResultsCount" model="Model" />
41+
<partial name="SearchablePage/_TopPagination" model="Model" />
42+
<partial name="SearchablePage/_ResultCountAndPageAlerts" model="Model" />
43+
44+
<div id="searchable-elements">
45+
@foreach (var completedLearningItem in Model.CompletedActivities)
46+
{
47+
if (completedLearningItem is CompletedCourseViewModel)
48+
{
49+
<partial name="Completed/CompletedCourseCard/_CompletedCourseCard" model="completedLearningItem" />
50+
}
51+
else
52+
{
53+
<partial name="Completed/CompletedActionPlanResourceCard/_CompletedActionPlanResourceCard" model="completedLearningItem" />
54+
}
55+
}
56+
</div>
5957
}
60-
</div>
61-
}
6258

63-
<partial name="SearchablePage/_BottomPagination" model="Model" />
64-
</div>
59+
<partial name="SearchablePage/_BottomPagination" model="Model" />
60+
</div>
6561
</div>
6662

6763
@if (Model.JavascriptSearchSortFilterPaginateEnabled)
6864
{
69-
@section scripts {
70-
<script src="@Url.Content("~/js/learningPortal/completed.js")" asp-append-version="true"></script>
71-
}
65+
@section scripts {
66+
<script src="@Url.Content("~/js/learningPortal/completed.js")" asp-append-version="true"></script>
67+
}
7268
}

DigitalLearningSolutions.Web/Views/LearningPortal/Current/Current.cshtml

Lines changed: 49 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,75 +8,71 @@
88
<link rel="stylesheet" href="@Url.Content("~/css/learningPortal/current.css")" asp-append-version="true">
99

1010
@{
11-
ViewData["Application"] = "Learning Portal";
12-
ViewData["Title"] = "My Current Activities";
13-
ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Current";
14-
ViewData["HeaderPathName"] = "Learning Portal";
11+
ViewData["Application"] = "Learning Portal";
12+
ViewData["Title"] = "My Current Activities";
13+
ViewData["HeaderPath"] = $"{Configuration["AppRootPath"]}/LearningPortal/Current";
14+
ViewData["HeaderPathName"] = "Learning Portal";
1515
}
1616

1717
@section NavMenuItems {
18-
<partial name="Shared/_NavMenuItems" />
18+
<partial name="Shared/_NavMenuItems" />
1919
}
2020

21-
@if (Model.JavascriptSearchSortFilterPaginateEnabled)
21+
@if (Model.JavascriptSearchSortFilterPaginateEnabled)
2222
{
23-
<vc:loading-spinner page-has-side-nav-menu="false" />
23+
<vc:loading-spinner page-has-side-nav-menu="false" />
2424
}
2525
<div class="nhsuk-grid-row" id="@(Model.JavascriptSearchSortFilterPaginateEnabled ? "js-styling-hidden-area-while-loading" : "no-js-styling")">
26-
<div class="nhsuk-grid-column-full">
27-
<h1 id="page-heading">My Current Activities</h1>
28-
@if (Model.BannerText != null)
29-
{
30-
<h2 class="page-subheading word-break">@Model.BannerText</h2>
31-
}
32-
33-
@if (!Model.ApiIsAccessible)
34-
{
35-
<vc:learning-resource-warning css-class="nhsuk-u-margin-bottom-4 nhsuk-u-margin-top-4"
36-
text="@LearningHubWarningTextHelper.ResourceDetailsMayBeOutOfDate" />
37-
}
26+
<div class="nhsuk-grid-column-full">
27+
<h1 id="page-heading">My Current Activities</h1>
3828

39-
<partial name="SearchablePage/Configurations/_FullWidthSearchSortAndFilter" model="Model" />
29+
@if (!Model.ApiIsAccessible)
30+
{
31+
<vc:learning-resource-warning css-class="nhsuk-u-margin-bottom-4 nhsuk-u-margin-top-4"
32+
text="@LearningHubWarningTextHelper.ResourceDetailsMayBeOutOfDate" />
33+
}
4034

41-
@if (Model.NoDataFound)
42-
{
43-
<p class="nhsuk-u-margin-top-4" role="alert">
44-
<b>You are not enrolled on anything.</b> View <a asp-action="Available">Available activities</a>.
45-
</p>
46-
}
47-
else
48-
{
49-
<hr class="nhsuk-u-margin-top-3 nhsuk-u-margin-bottom-4" />
50-
<partial name="SearchablePage/_SearchResultsCount" model="Model" />
51-
<partial name="SearchablePage/_TopPagination" model="Model" />
52-
<partial name="SearchablePage/_ResultCountAndPageAlerts" model="Model" />
35+
<partial name="SearchablePage/Configurations/_FullWidthSearchSortAndFilter" model="Model" />
5336

54-
<div id="searchable-elements">
55-
@foreach (var currentLearningItem in Model.CurrentActivities)
37+
@if (Model.NoDataFound)
5638
{
57-
if (currentLearningItem is SelfAssessmentCardViewModel)
58-
{
59-
<partial name="SelfAssessments/_SelfAssessmentCard" model="currentLearningItem" />
60-
}
61-
else if (currentLearningItem is CurrentLearningResourceViewModel)
62-
{
63-
<partial name="Current/_CurrentLearningResourceCard" model="currentLearningItem" />
64-
}
65-
else
66-
{
67-
<partial name="Current/CurrentCourseCard/_CurrentCourseCard" model="currentLearningItem" />
68-
}
39+
<p class="nhsuk-u-margin-top-4" role="alert">
40+
<b>You are not enrolled on anything.</b> View <a asp-action="Available">Available activities</a>.
41+
</p>
42+
}
43+
else
44+
{
45+
<hr class="nhsuk-u-margin-top-3 nhsuk-u-margin-bottom-4" />
46+
<partial name="SearchablePage/_SearchResultsCount" model="Model" />
47+
<partial name="SearchablePage/_TopPagination" model="Model" />
48+
<partial name="SearchablePage/_ResultCountAndPageAlerts" model="Model" />
49+
50+
<div id="searchable-elements">
51+
@foreach (var currentLearningItem in Model.CurrentActivities)
52+
{
53+
if (currentLearningItem is SelfAssessmentCardViewModel)
54+
{
55+
<partial name="SelfAssessments/_SelfAssessmentCard" model="currentLearningItem" />
56+
}
57+
else if (currentLearningItem is CurrentLearningResourceViewModel)
58+
{
59+
<partial name="Current/_CurrentLearningResourceCard" model="currentLearningItem" />
60+
}
61+
else
62+
{
63+
<partial name="Current/CurrentCourseCard/_CurrentCourseCard" model="currentLearningItem" />
64+
}
65+
}
66+
</div>
6967
}
70-
</div>
71-
}
7268

73-
<partial name="SearchablePage/_BottomPagination" model="Model" />
74-
</div>
69+
<partial name="SearchablePage/_BottomPagination" model="Model" />
70+
</div>
7571
</div>
7672

7773
@if (Model.JavascriptSearchSortFilterPaginateEnabled)
7874
{
79-
@section scripts {
80-
<script src="@Url.Content("~/js/learningPortal/current.js")" asp-append-version="true"></script>
81-
}
75+
@section scripts {
76+
<script src="@Url.Content("~/js/learningPortal/current.js")" asp-append-version="true"></script>
77+
}
8278
}

0 commit comments

Comments
 (0)