-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HEEDLS-465 - Implemented basic support page #419
Merged
AlexJacksonDS
merged 13 commits into
master
from
HEEDLS-465-TrackingSystem-GenericSupportPage
Jun 28, 2021
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
abc4a47
HEEDLS-465 - Implemented basic support page
DanBloxham-sw c7a133a
HEEDLS-465 - Moved LearningSolutionController into new folder and cle…
DanBloxham-sw 34202ff
HEEDLS-465 - correcting some spacing.
DanBloxham-sw 503fcbe
HEEDLS-465 - refactor to use new application type enumeration
DanBloxham-sw 219de76
Merge branch 'master' into HEEDLS-465-TrackingSystem-GenericSupportPage
DanBloxham-sw 190b453
HEEDLS-465 - added new NavMenuItems required for main application
DanBloxham-sw df50926
HEEDLS-465 - refactored support page to use new enum bindings.
DanBloxham-sw d5aa838
HEEDLS-465 - Merge master into branch
DanBloxham-sw 0a43bd6
HEEDLS-465 - fix merge and minor review markups
DanBloxham-sw f94bda5
HEEDLS-465 - correct basic enumeration to fix test
DanBloxham-sw 9321702
HEEDLS-465 - Move accessibility test for support page to match new au…
DanBloxham-sw 6e6f365
HEEDLS-465 Move SupportController and related items to Support folders
AlexJacksonDS ccaea64
HEEDLS-465 Change logical OR to conditional logical OR
AlexJacksonDS File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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> | ||
|
||
@{ | ||
stellake marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be "||"?