Skip to content

Commit

Permalink
Merge pull request #690 from DFE-Digital/sources-and-updates-iteration
Browse files Browse the repository at this point in the history
Sources and updates design update
  • Loading branch information
dynamictulip authored Jan 17, 2025
2 parents 205c841 + 05f0abd commit e655ab9
Show file tree
Hide file tree
Showing 67 changed files with 976 additions and 588 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Fix Privacy page having incorrect width
- Update name of cookie consent cookie to be consistent with application name and what is displayed in the Cookie UI
- Switched to using the MIS tables to the MIS_MSTR tables
- Updated the design of the source and updates panel

## [Release-18][release-18] (production-2024-12-19.4567)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ public static partial class StringExtensions
[GeneratedRegex("-+", RegexOptions.Compiled)]
private static partial Regex DashesRegex();

[GeneratedRegex(@"[^-\w]|_+", RegexOptions.Compiled)]
private static partial Regex NonDashPunctuationRegex();

public static string Kebabify(this string text)
{
var transformedText = text.Trim();

transformedText = BracketedDigitsRegex().Replace(transformedText, "-");
transformedText = SpacesRegex().Replace(transformedText, "-");
transformedText = NonDashPunctuationRegex().Replace(transformedText, "");
transformedText = DashesRegex().Replace(transformedText, "-");

transformedText = transformedText.Trim('-');
Expand All @@ -31,7 +35,7 @@ public static string Kebabify(this string text)
public static string ToTitleCase(this string text)
{
var textInfo = CultureInfo.CurrentCulture.TextInfo;

if (string.IsNullOrWhiteSpace(text)) return string.Empty;

return textInfo.ToTitleCase(textInfo.ToLower(text));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using DfE.FindInformationAcademiesTrusts.Data;
using DfE.FindInformationAcademiesTrusts.Data.Enums;
using DfE.FindInformationAcademiesTrusts.Services.DataSource;
using DfE.FindInformationAcademiesTrusts.Services.Export;
using DfE.FindInformationAcademiesTrusts.Services.Trust;
Expand All @@ -14,10 +15,35 @@ public abstract class AcademiesPageModel(
IDateTimeProvider dateTimeProvider
) : TrustsAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with { PageName = "Academies" };
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { PageName = ViewConstants.AcademiesPageName };

protected IExportService ExportService { get; } = exportService;
public IDateTimeProvider DateTimeProvider { get; } = dateTimeProvider;

public override async Task<IActionResult> OnGetAsync()
{
var pageResult = await base.OnGetAsync();
if (pageResult is NotFoundResult) return pageResult;

var giasDataSource = await DataSourceService.GetAsync(Source.Gias);
var eesDataSource = await DataSourceService.GetAsync(Source.ExploreEducationStatistics);

DataSourcesPerPage.AddRange([
new DataSourcePageListEntry(ViewConstants.AcademiesDetailsPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.AcademiesPupilNumbersPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.AcademiesFreeSchoolMealsPageName, [
new DataSourceListEntry(giasDataSource, "Pupils eligible for free school meals"),
new DataSourceListEntry(eesDataSource, "Local authority average 2023/24"),
new DataSourceListEntry(eesDataSource, "National average 2023/24")
])
]);

return pageResult;
}

public virtual async Task<IActionResult> OnGetExportAsync(string uid)
{
var trustSummary = await TrustService.GetTrustSummaryAsync(uid);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DfE.FindInformationAcademiesTrusts.Data;
using DfE.FindInformationAcademiesTrusts.Data.Enums;
using DfE.FindInformationAcademiesTrusts.Services.Academy;
using DfE.FindInformationAcademiesTrusts.Services.DataSource;
using DfE.FindInformationAcademiesTrusts.Services.Export;
Expand All @@ -19,20 +18,19 @@ public class AcademiesDetailsModel(
: AcademiesPageModel(dataSourceService, trustService, exportService, logger,
dateTimeProvider)
{
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with { TabName = "Details" };
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { TabName = ViewConstants.AcademiesDetailsPageName };

public AcademyDetailsServiceModel[] Academies { get; set; } = default!;
public IOtherServicesLinkBuilder LinkBuilder { get; } = linkBuilder;

public override async Task<IActionResult> OnGetAsync()
{
var pageResult = await base.OnGetAsync();

if (pageResult.GetType() == typeof(NotFoundResult)) return pageResult;
if (pageResult is NotFoundResult) return pageResult;

Academies = await academyService.GetAcademiesInTrustDetailsAsync(Uid);

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias), ["Details"]));

return pageResult;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DfE.FindInformationAcademiesTrusts.Data;
using DfE.FindInformationAcademiesTrusts.Data.Enums;
using DfE.FindInformationAcademiesTrusts.Services.Academy;
using DfE.FindInformationAcademiesTrusts.Services.DataSource;
using DfE.FindInformationAcademiesTrusts.Services.Export;
Expand All @@ -18,23 +17,17 @@ public class FreeSchoolMealsModel(
: AcademiesPageModel(dataSourceService, trustService, exportService, logger, dateTimeProvider)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { TabName = "Free school meals" };
base.TrustPageMetadata with { TabName = ViewConstants.AcademiesFreeSchoolMealsPageName };

public AcademyFreeSchoolMealsServiceModel[] Academies { get; set; } = default!;

public override async Task<IActionResult> OnGetAsync()
{
var pageResult = await base.OnGetAsync();

if (pageResult.GetType() == typeof(NotFoundResult)) return pageResult;
if (pageResult is NotFoundResult) return pageResult;

Academies = await academyService.GetAcademiesInTrustFreeSchoolMealsAsync(Uid);

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias),
["Pupils eligible for free school meals"]));

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.ExploreEducationStatistics),
["Local authority average 2023/24", "National average 2023/24"]));

return pageResult;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using DfE.FindInformationAcademiesTrusts.Data;
using DfE.FindInformationAcademiesTrusts.Data.Enums;
using DfE.FindInformationAcademiesTrusts.Services.Academy;
using DfE.FindInformationAcademiesTrusts.Services.DataSource;
using DfE.FindInformationAcademiesTrusts.Services.Export;
Expand All @@ -17,19 +16,20 @@ public class PupilNumbersModel(
IDateTimeProvider dateTimeProvider)
: AcademiesPageModel(dataSourceService, trustService, exportService, logger, dateTimeProvider)
{
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with { TabName = "Pupil numbers" };
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with
{
TabName = ViewConstants.AcademiesPupilNumbersPageName
};

public AcademyPupilNumbersServiceModel[] Academies { get; set; } = default!;

public override async Task<IActionResult> OnGetAsync()
{
var pageResult = await base.OnGetAsync();

if (pageResult.GetType() == typeof(NotFoundResult)) return pageResult;
if (pageResult is NotFoundResult) return pageResult;

Academies = await academyService.GetAcademiesInTrustPupilNumbersAsync(Uid);

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias), ["Pupil numbers"]));

return pageResult;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@
Contents
</h2>
<ul class="govuk-tabs__list">
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf("Details")">
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf(ViewConstants.AcademiesDetailsPageName)">
<a id="academies-details-link" class="govuk-tabs__tab" asp-page="./Details" asp-route-uid="@Model.TrustSummary.Uid">
<span class="govuk-visually-hidden">Academies </span>Details
</a>
</li>
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf("Pupil numbers")">
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf(ViewConstants.AcademiesPupilNumbersPageName)">
<a id="academies-pupil-numbers-link" class="govuk-tabs__tab" asp-page="./PupilNumbers" asp-route-uid="@Model.TrustSummary.Uid">
<span class="govuk-visually-hidden">Academies </span>Pupil numbers
</a>
</li>
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf("Free school meals")">
<li class="govuk-tabs__list-item @GetCurrentlySelectedClassIf(ViewConstants.AcademiesFreeSchoolMealsPageName)">
<a id="free-school-meals-link" class="govuk-tabs__tab" asp-page="./FreeSchoolMeals" asp-route-uid="@Model.TrustSummary.Uid">
<span class="govuk-visually-hidden">Academies </span>Free school meals
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ ILogger<ContactsAreaModel> logger
)
: TrustsAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with { PageName = "Contacts" };
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { PageName = ViewConstants.ContactsPageName };

public Person? ChairOfTrustees { get; set; }
public Person? AccountingOfficer { get; set; }
public Person? ChiefFinancialOfficer { get; set; }
Expand All @@ -29,32 +31,40 @@ public override async Task<IActionResult> OnGetAsync()

SubNavigationLinks =
[
new TrustSubNavigationLinkModel("In DfE", "./InDfE", Uid, TrustPageMetadata.PageName!, this is InDfeModel),
new TrustSubNavigationLinkModel(ViewConstants.ContactsInDfePageName, "./InDfE", Uid,
TrustPageMetadata.PageName!, this is InDfeModel),
new TrustSubNavigationLinkModel("In the trust", "./InTrust", Uid, TrustPageMetadata.PageName!,
this is InTrustModel)
];

(TrustRelationshipManager, SfsoLead, AccountingOfficer, ChairOfTrustees, ChiefFinancialOfficer) =
await TrustService.GetTrustContactsAsync(Uid);

DataSources.Add(new DataSourceListEntry(
new DataSourceServiceModel(Source.FiatDb, TrustRelationshipManager?.LastModifiedAtTime, null,
TrustRelationshipManager?.LastModifiedByEmail),
new List<string>
{ ContactRole.TrustRelationshipManager.MapRoleToViewString() }));

DataSources.Add(new DataSourceListEntry(
new DataSourceServiceModel(Source.FiatDb, SfsoLead?.LastModifiedAtTime, null,
SfsoLead?.LastModifiedByEmail),
new List<string>
{ ContactRole.SfsoLead.MapRoleToViewString() }));

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias), new List<string>
{ "Accounting officer name", "Chief financial officer name", "Chair of trustees name" }));
// Add data sources
var giasDataSource = await DataSourceService.GetAsync(Source.Gias);
var mstrDataSource = await DataSourceService.GetAsync(Source.Mstr);

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Mstr),
new List<string>
{ "Accounting officer email", "Chief financial officer email", "Chair of trustees email" }));
DataSourcesPerPage.AddRange([
new DataSourcePageListEntry(ViewConstants.ContactsInDfePageName, [
new DataSourceListEntry(new DataSourceServiceModel(Source.FiatDb,
TrustRelationshipManager?.LastModifiedAtTime, null,
TrustRelationshipManager?.LastModifiedByEmail),
ContactRole.TrustRelationshipManager.MapRoleToViewString()),
new DataSourceListEntry(new DataSourceServiceModel(Source.FiatDb, SfsoLead?.LastModifiedAtTime,
null,
SfsoLead?.LastModifiedByEmail), ContactRole.SfsoLead.MapRoleToViewString())
]
),
new DataSourcePageListEntry("In the trust", [
new DataSourceListEntry(giasDataSource, "Accounting officer name"),
new DataSourceListEntry(giasDataSource, "Chief financial officer name"),
new DataSourceListEntry(giasDataSource, "Chair of trustees name"),
new DataSourceListEntry(mstrDataSource, "Accounting officer email"),
new DataSourceListEntry(mstrDataSource, "Chief financial officer email"),
new DataSourceListEntry(mstrDataSource, "Chair of trustees email")
]
)
]);

return pageResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class EditContactModel(
public override TrustPageMetadata TrustPageMetadata => base.TrustPageMetadata with
{
SubPageName = $"Edit {role.MapRoleToViewString()} details",
PageName = "Contacts"
PageName = ViewConstants.ContactsPageName
};

public const string NameField = "Name";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class InDfeModel(
: ContactsAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "In DfE" };
base.TrustPageMetadata with { SubPageName = ViewConstants.ContactsInDfePageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class GovernanceAreaModel(
: TrustsAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { PageName = "Governance" };
base.TrustPageMetadata with { PageName = ViewConstants.GovernancePageName };

public TrustGovernanceServiceModel TrustGovernance { get; set; } = default!;

Expand All @@ -26,18 +26,35 @@ public override async Task<IActionResult> OnGetAsync()

SubNavigationLinks =
[
new TrustSubNavigationLinkModel($"Trust leadership ({TrustGovernance.CurrentTrustLeadership.Length})",
new TrustSubNavigationLinkModel(
$"{ViewConstants.GovernanceTrustLeadershipPageName} ({TrustGovernance.CurrentTrustLeadership.Length})",
"./TrustLeadership", Uid, TrustPageMetadata.PageName!, this is TrustLeadershipModel),
new TrustSubNavigationLinkModel($"Trustees ({TrustGovernance.CurrentTrustees.Length})", "./Trustees", Uid,
new TrustSubNavigationLinkModel(
$"{ViewConstants.GovernanceTrusteesPageName} ({TrustGovernance.CurrentTrustees.Length})", "./Trustees",
Uid,
TrustPageMetadata.PageName!, this is TrusteesModel),
new TrustSubNavigationLinkModel($"Members ({TrustGovernance.CurrentMembers.Length})", "./Members", Uid,
new TrustSubNavigationLinkModel(
$"{ViewConstants.GovernanceMembersPageName} ({TrustGovernance.CurrentMembers.Length})", "./Members",
Uid,
TrustPageMetadata.PageName!, this is MembersModel),
new TrustSubNavigationLinkModel($"Historic members ({TrustGovernance.HistoricMembers.Length})",
new TrustSubNavigationLinkModel(
$"{ViewConstants.GovernanceHistoricMembersPageName} ({TrustGovernance.HistoricMembers.Length})",
"./HistoricMembers", Uid, TrustPageMetadata.PageName!, this is HistoricMembersModel)
];

DataSources.Add(new DataSourceListEntry(await DataSourceService.GetAsync(Source.Gias),
new List<string> { "Governance" }));
// Add data sources
var giasDataSource = await DataSourceService.GetAsync(Source.Gias);

DataSourcesPerPage.AddRange([
new DataSourcePageListEntry(ViewConstants.GovernanceTrustLeadershipPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.GovernanceTrusteesPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.GovernanceMembersPageName,
[new DataSourceListEntry(giasDataSource)]),
new DataSourcePageListEntry(ViewConstants.GovernanceHistoricMembersPageName,
[new DataSourceListEntry(giasDataSource)])
]);

return pageResult;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class HistoricMembersModel(
: GovernanceAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Historic members" };
base.TrustPageMetadata with { SubPageName = ViewConstants.GovernanceHistoricMembersPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class MembersModel(
: GovernanceAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Members" };
base.TrustPageMetadata with { SubPageName = ViewConstants.GovernanceMembersPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class TrustLeadershipModel(
: GovernanceAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Trust leadership" };
base.TrustPageMetadata with { SubPageName = ViewConstants.GovernanceTrustLeadershipPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class TrusteesModel(
: GovernanceAreaModel(dataSourceService, trustService, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Trustees" };
base.TrustPageMetadata with { SubPageName = ViewConstants.GovernanceTrusteesPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface ITrustsAreaModel
{
TrustSummaryServiceModel TrustSummary { get; }

List<DataSourceListEntry> DataSources { get; }
List<DataSourcePageListEntry> DataSourcesPerPage { get; }

TrustPageMetadata TrustPageMetadata { get; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ public class CurrentRatingsModel(
academyService, exportService, dateTimeProvider, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Current ratings" };
base.TrustPageMetadata with { SubPageName = ViewConstants.OfstedCurrentRatingsPageName };
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ public class ImportantDatesModel(
academyService, exportService, dateTimeProvider, logger)
{
public override TrustPageMetadata TrustPageMetadata =>
base.TrustPageMetadata with { SubPageName = "Important dates" };
base.TrustPageMetadata with { SubPageName = ViewConstants.OfstedImportantDatesPageName };
}
Loading

0 comments on commit e655ab9

Please sign in to comment.