Skip to content

Commit b7cb8b4

Browse files
committed
conflicts resolved
2 parents 3ec58f6 + f66a70e commit b7cb8b4

File tree

12 files changed

+76
-53
lines changed

12 files changed

+76
-53
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ jobs:
2323
- name: Use NuGet 5.8
2424
uses: nuget/setup-nuget@v1
2525

26-
- name: Use Node 12.9.1
26+
- name: Use Node 12.19
2727
uses: actions/setup-node@v4
2828
with:
29-
node-version: '12.9.1'
30-
29+
node-version: '18'
30+
3131
- name: Install dependencies
3232
run: |
3333
cd ./Auth/LearningHub.Nhs.Auth
34-
npm install -f
34+
yarn install
3535
3636
- name: Run Webpack build
3737
run: |
3838
cd ./Auth/LearningHub.Nhs.Auth
39-
npm run build
39+
yarn build:webpack
4040
4141
- name: Setup MSBuild
4242
uses: microsoft/[email protected]

Auth/LearningHub.Nhs.Auth/Controllers/AccountController.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ private async Task<LoginViewModel> BuildLoginViewModelAsync(LoginInputModel mode
427427
{
428428
var vm = await this.BuildLoginViewModelAsync(model.ReturnUrl);
429429
vm.Username = model.Username;
430+
vm.Password = model.Password;
430431
vm.RememberLogin = model.RememberLogin;
431432
return vm;
432433
}

Auth/LearningHub.Nhs.Auth/LearningHub.Nhs.Auth.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.0" />
113113
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.0" />
114114
<PackageReference Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
115-
<PackageReference Include="NHSUKViewComponents.Web" Version="1.0.23" />
115+
<PackageReference Include="NHSUKViewComponents.Web" Version="1.0.27" />
116116
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
117117
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
118118
<PrivateAssets>all</PrivateAssets>

Auth/LearningHub.Nhs.Auth/Views/Account/LHLogin.cshtml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
@{
33
ViewData["Title"] = "Login";
44
ViewData["Layout"] = "learninghub/_Layout";
5+
ViewData["DisableValidation"] = true;
56
// OpenAthens url needs to makes sure that the return to WebUI first hits the authorisationrequired endpoint,
67
// which contains it's own redirect to within the UI.
78
// If a return url is specified we want to use it for the authorisationrequired original url
@@ -54,7 +55,7 @@
5455

5556
<vc:text-input asp-for="Username"
5657
label="Enter your username"
57-
populate-with-current-value="false"
58+
populate-with-current-value="true"
5859
type="text"
5960
spell-check="false"
6061
hint-text="A username is different to an email address"
@@ -65,7 +66,7 @@
6566

6667
<vc:text-input asp-for="Password"
6768
label="Enter your password"
68-
populate-with-current-value="false"
69+
populate-with-current-value="true"
6970
type="password"
7071
spell-check="false"
7172
hint-text=""

Auth/LearningHub.Nhs.Auth/Views/Shared/Components/DateInput/Default.cshtml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
var yearErrorCss = Model.HasYearError ? "nhsuk-input--error" : "";
99
var hintTextLine = string.Empty;
1010
}
11-
11+
@* Removed pattern property *@
1212
<div class="@Model.CssClass @errorCss" id="@Model.Id">
1313
<fieldset class="nhsuk-fieldset" aria-describedby="@Model.Id-hint" role="group">
1414
<legend class="nhsuk-fieldset__legend nhsuk-label">
@@ -54,12 +54,12 @@
5454
id="@Model.DayId"
5555
name="@Model.DayId"
5656
value="@Model.DayValue"
57-
type="number"
58-
pattern="[0-9]*"
57+
type="text"
5958
min="1"
6059
max="31"
6160
step="1"
62-
inputmode="numeric" />
61+
inputmode="numeric"
62+
aria-describedby="date-error" aria-invalid="false" />
6363
</div>
6464
</div>
6565
<div class="nhsuk-date-input__item">
@@ -69,12 +69,12 @@
6969
id="@Model.MonthId"
7070
name="@Model.MonthId"
7171
value="@Model.MonthValue"
72-
type="number"
73-
pattern="[0-9]*"
72+
type="text"
7473
min="1"
7574
max="12"
7675
step="1"
77-
inputmode="numeric" />
76+
inputmode="numeric"
77+
aria-describedby="date-error" aria-invalid="false" />
7878
</div>
7979
</div>
8080
<div class="nhsuk-date-input__item">
@@ -84,12 +84,12 @@
8484
id="@Model.YearId"
8585
name="@Model.YearId"
8686
value="@Model.YearValue"
87-
type="number"
88-
pattern="[0-9]*"
87+
type="text"
8988
min="1900"
9089
max="9999"
9190
step="1"
92-
inputmode="numeric" />
91+
inputmode="numeric"
92+
aria-describedby="date-error" aria-invalid="false" />
9393
</div>
9494
</div>
9595
</div>

Auth/LearningHub.Nhs.Auth/Views/Shared/Components/ErrorSummary/Default.cshtml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
</ul>
2222
</div>
2323
</div>
24+
<script>
25+
const errorSummary = document.querySelector("#error-summary-title").parentElement;
26+
errorSummary.focus();
27+
</script>
2428
}
2529
else
2630
{

Auth/LearningHub.Nhs.Auth/Views/Shared/Components/RadioList/Default.cshtml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<div class="nhsuk-form-group @(Model.HasError ? "nhsuk-form-group--error" : "")">
1111

12-
<fieldset class="nhsuk-fieldset" aria-describedby="@(!string.IsNullOrEmpty(Model.HintText) ? $"{Model.Label.RemoveWhitespace()}-hint" : string.Empty)">
12+
<fieldset id="@Model.AspFor" class="nhsuk-fieldset" aria-describedby="@(!string.IsNullOrEmpty(Model.HintText) ? $"{Model.Label.RemoveWhitespace()}-hint" : string.Empty)">
1313
<legend class="nhsuk-fieldset__legend nhsuk-fieldset__legend--m">
1414
@if (Model.IsPageHeading.GetValueOrDefault() == true)
1515
{
@@ -44,7 +44,7 @@
4444

4545
@if (Model.Required && !Model.HasError)
4646
{
47-
<div data-valmsg-for="@Model.AspFor" data-valmsg-replace="true" class="error-message--margin-bottom-1 nhsuk-error-message field-validation-valid nhsuk-u-padding-top-1 nhsuk-u-padding-bottom-3">
47+
<div data-valmsg-for="@Model.AspFor" data-valmsg-replace="true" class="error-message--margin-bottom-1 nhsuk-error-message field-validation-valid nhsuk-u-padding-top-1 nhsuk-u-padding-bottom-3" aria-live="assertive" role="alert">
4848
</div>
4949
}
5050

@@ -131,5 +131,4 @@
131131

132132
</div>
133133
</fieldset>
134-
135134
</div>

Auth/LearningHub.Nhs.Auth/Views/Shared/Components/TextInput/Default.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
@using NHSUKViewComponents.Web.Helpers
33
@model TextInputViewModel
44
<div class="nhsuk-form-group @(Model.HasError ? "nhsuk-form-group--error" : "")">
5-
<label class="nhsuk-label" for="@Model.Name">
6-
@Model.Label
5+
<label class="nhsuk-label @(string.IsNullOrWhiteSpace(Model.Label) ? "nhsuk-u-visually-hidden" : "")" for="@Model.Name">
6+
@(string.IsNullOrWhiteSpace(Model.Label) ? "N/A" : @Model.Label)
77
</label>
88
@if (Model.HintText != null)
99
{

Auth/LearningHub.Nhs.Auth/Views/Shared/LearningHub/_Layout.cshtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
}
99
}
1010
<!DOCTYPE html>
11-
<html>
11+
<html lang="en">
1212
<head>
1313
<meta charset="utf-8" />
1414
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Lines changed: 45 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
<environment include="Development">
2-
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
3-
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
4-
</environment>
5-
<environment exclude="Development">
1+
@if (!ViewData["DisableValidation"]?.Equals(true) ?? true)
2+
{
3+
<environment include="Development">
4+
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
5+
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
6+
</environment>
7+
<environment exclude="Development">
68
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.min.js"
79
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
810
asp-fallback-test="window.jQuery && window.jQuery.validator"
@@ -15,32 +17,48 @@
1517
crossorigin="anonymous"
1618
integrity="sha256-9GycpJnliUjJDVDqP0UEu/bsm9U+3dnQUH8+3W10vkY=">
1719
</script>
18-
</environment>
20+
</environment>
21+
}
1922
<script type="text/javascript">
20-
// Add/remove class 'input-validation-error' to the div containing the control with error
21-
$(function () {
22-
$('form').each(function () {
23-
if ($(this).data("validator")) {
24-
var valSettings = $(this).data("validator").settings
25-
valSettings.highlight = wrap($.validator.defaults.highlight, highlightDecorator)
26-
valSettings.unhighlight = wrap($.validator.defaults.unhighlight, unhighlightDecorator)
27-
}
23+
// Add/remove class 'input-validation-error' to the div containing the control with error.
24+
25+
let errorElements = [];
26+
let submitAttempted = false;
27+
document.querySelector('form').onsubmit = () => { submitAttempted = true; errorElements = []; }
28+
29+
$(function () {
30+
$('form').each(function () {
31+
if ($(this).data("validator")) {
32+
var valSettings = $(this).data("validator").settings;
33+
valSettings.highlight = wrap($.validator.defaults.highlight, highlightDecorator);
34+
valSettings.unhighlight = wrap($.validator.defaults.unhighlight, unhighlightDecorator);
35+
}
36+
});
2837
});
29-
});
3038
31-
function wrap(functionToWrap, beforeFunction) {
32-
return function () {
33-
var args = Array.prototype.slice.call(arguments);
34-
beforeFunction.apply(this, args);
35-
return functionToWrap.apply(this, args);
39+
function wrap(functionToWrap, beforeFunction) {
40+
return function () {
41+
var args = Array.prototype.slice.call(arguments);
42+
beforeFunction.apply(this, args);
43+
if (errorElements.length && submitAttempted) {
44+
errorElements[0]['obj'].focus();
45+
submitAttempted = false;
46+
}
47+
48+
return functionToWrap.apply(this, args);
49+
};
3650
};
37-
};
3851
39-
function highlightDecorator(element, errorClass, validClass) {
40-
$(element).closest("div").addClass(errorClass).removeClass(validClass);
41-
}
42-
function unhighlightDecorator(element, errorClass, validClass) {
43-
$(element).closest("div").addClass(validClass).removeClass(errorClass);
44-
}
52+
function highlightDecorator(element, errorClass, validClass) {
53+
$(element).closest("div").addClass(errorClass).removeClass(validClass);
54+
let itemExists = errorElements.some(obj => obj['id'] == element.id);
55+
if (!itemExists) {
56+
errorElements.push({ 'id': element.id, 'obj': element });
57+
}
58+
}
59+
function unhighlightDecorator(element, errorClass, validClass) {
60+
$(element).closest("div").addClass(validClass).removeClass(errorClass);
61+
errorElements = errorElements.filter((elm) => elm.id != element.id);
62+
}
4563
4664
</script>

0 commit comments

Comments
 (0)