-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #419 from TechnologyEnhancedLearning/HEEDLS-465-Tr…
…ackingSystem-GenericSupportPage HEEDLS-465 - Implemented basic support page
- Loading branch information
Showing
49 changed files
with
718 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
DigitalLearningSolutions.Web.Tests/Controllers/Support/SupportControllerTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace DigitalLearningSolutions.Web.Tests.Controllers.Support | ||
{ | ||
using DigitalLearningSolutions.Web.Controllers.Support; | ||
using FluentAssertions.AspNetCore.Mvc; | ||
using NUnit.Framework; | ||
|
||
public class SupportControllerTests | ||
{ | ||
private SupportController controller = null!; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
controller = new SupportController(); | ||
} | ||
|
||
[TestCase("TrackingSystem")] | ||
[TestCase("Frameworks")] | ||
public void Support_page_should_be_shown_for_valid_application_names(string applicationName) | ||
{ | ||
// When | ||
var result = controller.Index(applicationName); | ||
|
||
// Then | ||
result.Should().BeViewResult().WithViewName("Support"); | ||
} | ||
|
||
[Test] | ||
public void Invalid_application_name_should_redirect_to_404_page() | ||
{ | ||
// When | ||
var result = controller.Index("Main"); | ||
|
||
// Then | ||
result.Should().BeNotFoundResult(); | ||
} | ||
} | ||
} |
3 changes: 1 addition & 2 deletions
3
...ontrollers/LearningSolutionsController.cs → ...gSolutions/LearningSolutionsController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
DigitalLearningSolutions.Web/Controllers/Support/SupportController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace DigitalLearningSolutions.Web.Controllers.Support | ||
{ | ||
using DigitalLearningSolutions.Web.Helpers; | ||
using DigitalLearningSolutions.Web.Models.Enums; | ||
using DigitalLearningSolutions.Web.ViewModels.Support; | ||
using Microsoft.AspNetCore.Authorization; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
public class SupportController : Controller | ||
{ | ||
[Route("/{application}/Support")] | ||
[Authorize(Policy = CustomPolicies.UserCentreAdminOrFrameworksAdmin)] | ||
public IActionResult Index(ApplicationType application) | ||
{ | ||
if (ApplicationType.TrackingSystem.Equals(application) || | ||
ApplicationType.Frameworks.Equals(application)) | ||
{ | ||
var model = new SupportViewModel(application, SupportPage.Support); | ||
return View("Support", model); | ||
} | ||
|
||
return NotFound(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
DigitalLearningSolutions.Web/Models/Enums/ApplicationType.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace DigitalLearningSolutions.Web.Models.Enums | ||
{ | ||
using System; | ||
using DigitalLearningSolutions.Data.Enums; | ||
using DigitalLearningSolutions.Web.Helpers; | ||
|
||
public class ApplicationType : Enumeration | ||
{ | ||
public static readonly ApplicationType TrackingSystem = new ApplicationType(0, nameof(TrackingSystem), "Tracking System"); | ||
public static readonly ApplicationType Frameworks = new ApplicationType(1, nameof(Frameworks), "Frameworks"); | ||
public static readonly ApplicationType Main = new ApplicationType(2, nameof(Main), "Main"); | ||
|
||
private ApplicationType(int id, string name, string applicationName) : base(id, name) | ||
{ | ||
ApplicationName = applicationName; | ||
|
||
HeaderPath = name.Equals("TrackingSystem") | ||
? $"{ConfigHelper.GetAppConfig()["AppRootPath"]}/TrackingSystem/Centre/Dashboard" | ||
: null; | ||
} | ||
|
||
public readonly string ApplicationName; | ||
public readonly string? HeaderPath; | ||
|
||
public static implicit operator ApplicationType(string value) | ||
{ | ||
try | ||
{ | ||
return FromName<ApplicationType>(value); | ||
} | ||
catch (InvalidOperationException e) | ||
{ | ||
throw new InvalidCastException(e.Message); | ||
} | ||
} | ||
|
||
public static implicit operator string(ApplicationType applicationType) => applicationType.Name; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace DigitalLearningSolutions.Web.Models.Enums | ||
{ | ||
public enum SupportPage | ||
{ | ||
Support, | ||
HelpDocumentation, | ||
Faqs, | ||
Resources, | ||
SupportTickets, | ||
ChangeRequests | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import "~nhsuk-frontend/packages/core/all"; | ||
|
||
ol>li { | ||
@include nhsuk-responsive-margin(5, "bottom"); | ||
} |
17 changes: 17 additions & 0 deletions
17
DigitalLearningSolutions.Web/ViewModels/Support/SupportViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace DigitalLearningSolutions.Web.ViewModels.Support | ||
{ | ||
using DigitalLearningSolutions.Web.Models.Enums; | ||
|
||
public class SupportViewModel | ||
{ | ||
public SupportViewModel(ApplicationType application, SupportPage currentPage) | ||
{ | ||
CurrentPage = currentPage; | ||
|
||
Application = application; | ||
} | ||
|
||
public SupportPage CurrentPage { get; set; } | ||
public ApplicationType Application { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 17 additions & 15 deletions
32
DigitalLearningSolutions.Web/Views/ForgotPassword/Confirm.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,17 @@ | ||
@using DigitalLearningSolutions.Web.Helpers | ||
@{ | ||
ViewData["Title"] = "Password Reset Email Sent"; | ||
} | ||
|
||
<div class="nhsuk-grid-row"> | ||
<div class="nhsuk-grid-column-full"> | ||
<h1 id="page-heading" class="nhsuk-heading-xl nhsuk-u-margin-bottom-6">Password reset email sent</h1> | ||
<p>An email has been sent to you giving details of how to reset your password.</p> | ||
<p>The link provided in that email will expire in two hours.</p> | ||
<p>If you have not received an email, please contact your centre administrator.</p> | ||
<p>To find out your administrator details, <a asp-controller="FindYourCentre" asp-action="Index">search for your centre here</a>.</p> | ||
</div> | ||
</div> | ||
|
||
@{ | ||
ViewData["Title"] = "Password Reset Email Sent"; | ||
} | ||
|
||
@section NavMenuItems { | ||
<partial name="_NavMenuItems" /> | ||
} | ||
|
||
<div class="nhsuk-grid-row"> | ||
<div class="nhsuk-grid-column-full"> | ||
<h1 id="page-heading" class="nhsuk-heading-xl nhsuk-u-margin-bottom-6">Password reset email sent</h1> | ||
<p>An email has been sent to you giving details of how to reset your password.</p> | ||
<p>The link provided in that email will expire in two hours.</p> | ||
<p>If you have not received an email, please contact your centre administrator.</p> | ||
<p>To find out your administrator details, <a asp-controller="FindYourCentre" asp-action="Index">search for your centre here</a>.</p> | ||
</div> | ||
</div> |
Oops, something went wrong.