Skip to content

Commit

Permalink
Merge pull request #1026 from DFE-Digital/bugfix/committee-spelling-fix
Browse files Browse the repository at this point in the history
Spelling fix and maintenance mode flag
  • Loading branch information
paullocknimble authored Apr 2, 2024
2 parents 56ceddf + 331b89f commit aae8a41
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@using Dfe.PrepareConversions.Data.Models.AcademyConversion
@model Dfe.PrepareConversions.Pages.TaskList.LegalRequirements.LegalGoverningBodyModel
@{
ViewData["Title"] = "Management commitee resolution";
ViewData["Title"] = "Management committee resolution";
}

@section BeforeMain
Expand All @@ -15,7 +15,7 @@
<form method="post">
<input hidden="" type="text" name="returnToSummary" value="no">
<span class="govuk-caption-l" data-cy="select-schoolname">@Model.SchoolName</span>
<h1 class="govuk-heading-l" data-cy="select-heading">Has the school provided a management commitee resolution?</h1>
<h1 class="govuk-heading-l" data-cy="select-heading">Has the school provided a management committee resolution?</h1>

<div class="govuk-form-group">
<div class="govuk-radios">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<dl class="govuk-summary-list">
<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">
Management commitee resolution
Management committee resolution
</dt>
<dd class="govuk-summary-list__value">
@if (Model.Requirements.GoverningBodyApproved.HasValue)
Expand All @@ -32,7 +32,7 @@
</dd>
<dd class="govuk-summary-list__actions">
<a asp-page="@Links.LegalRequirements.GoverningBodyResolution.Page" asp-route-id="@Model.Id" class="govuk-link" data-cy="select-legal-summary-governingbody-change">
Change<span class="govuk-visually-hidden"> management commitee resolution</span>
Change<span class="govuk-visually-hidden"> management committee resolution</span>
</a>
</dd>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
</header>
<div class="app-summary-card__body">
<dl class="govuk-summary-list">
<govuk-summary-list-row name="governing-body-resolution" label="Management Commitee Resolution" asp-route-id="@Model.Project.Id" value="@Model.Project.GoverningBodyResolution.SplitPascalCase()" asp-page="@Links.LegalRequirements.GoverningBodyResolution.Page" hidden-text="governing-body-resolution"/>
<govuk-summary-list-row name="governing-body-resolution" label="Management Committee Resolution" asp-route-id="@Model.Project.Id" value="@Model.Project.GoverningBodyResolution.SplitPascalCase()" asp-page="@Links.LegalRequirements.GoverningBodyResolution.Page" hidden-text="governing-body-resolution" />
<govuk-summary-list-row name="consultation" label="Consultation" asp-route-id="@Model.Project.Id" value="@Model.Project.Consultation.SplitPascalCase()" asp-page="@Links.LegalRequirements.Consultation.Page" hidden-text="consultation"/>
<govuk-summary-list-row name="diocesan-consent" label="Diocesan Consent" asp-route-id="@Model.Project.Id" value="@Model.Project.DiocesanConsent.SplitPascalCase()" asp-page="@Links.LegalRequirements.DiocesanConsent.Page" hidden-text="diocesan-consent"/>
<govuk-summary-list-row name="foundation-consent" label="Foundation Consent" asp-route-id="@Model.Project.Id" value="@Model.Project.FoundationConsent.SplitPascalCase()" asp-page="@Links.LegalRequirements.FoundationConsent.Page" hidden-text="foundation-consent"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Primitives;
using System.Threading.Tasks;

namespace Dfe.PrepareConversions.Routing
{
public class MaintenancePageFilter : IAsyncPageFilter
{
private readonly IConfiguration _config;

public MaintenancePageFilter(IConfiguration config)
{
_config = config;
}

public Task OnPageHandlerSelectionAsync(PageHandlerSelectedContext context)
{
return Task.CompletedTask;
}

public async Task OnPageHandlerExecutionAsync(PageHandlerExecutingContext context,
PageHandlerExecutionDelegate next)
{
bool maintenanceMode = bool.Parse(_config["MaintenanceMode"]);

if (maintenanceMode && !context.ActionDescriptor.DisplayName.Contains("Maintenance"))
{
context.Result = new RedirectToPageResult("/public/maintenance");
return;
}

// Do post work.
await next.Invoke();
}
}
}
5 changes: 5 additions & 0 deletions Dfe.PrepareConversions/Dfe.PrepareConversions/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Dfe.PrepareConversions.Data.Services.AzureAd;
using Dfe.PrepareConversions.Data.Services.Interfaces;
using Dfe.PrepareConversions.Models;
using Dfe.PrepareConversions.Routing;
using Dfe.PrepareConversions.Security;
using Dfe.PrepareConversions.Services;
using Microsoft.AspNetCore.Authentication.Cookies;
Expand Down Expand Up @@ -68,6 +69,10 @@ public void ConfigureServices(IServiceCollection services)
.AddViewOptions(options =>
{
options.HtmlHelperOptions.ClientValidationEnabled = false;
}).AddMvcOptions(options =>
{
options.MaxModelValidationErrors = 50;
options.Filters.Add(new MaintenancePageFilter(Configuration));
});

services.AddControllersWithViews()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@
"FeatureManagement": {
"UseAcademisationApplication": true,
"ShowDirectedAcademyOrders": true
}
},
"MaintenanceMode": false
}

0 comments on commit aae8a41

Please sign in to comment.