Skip to content

Commit

Permalink
feat: Added 'Deprecation' content to header component banner based on…
Browse files Browse the repository at this point in the history
… values set in configuration
  • Loading branch information
WolfyUK committed Oct 23, 2024
1 parent 53bb2e1 commit 5dfd76b
Show file tree
Hide file tree
Showing 9 changed files with 2,543 additions and 2,332 deletions.
Binary file modified .nvmrc
Binary file not shown.
4,802 changes: 2,482 additions & 2,320 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,17 @@
"@ngx-config/core": "^9.0.0",
"@ngx-config/http-loader": "^9.0.0",
"bootstrap": "^4.4.1",
"express": "^4.15.2",
"express": "^4.21.1",
"govuk-frontend": "^3.15.0",
"html2canvas": "1.0.0-alpha.10",
"jquery": "^3.4.1",
"jspdf": "^2.1.1",
"jquery": "^3.7.1",
"jspdf": "^2.5.2",
"leaflet": "^1.6.0",
"leaflet-fullscreen": "^1.0.2",
"leaflet.markercluster": "^1.4.1",
"ng-bootstrap-form-validation": "^9.0.1",
"ngx-bootstrap": "^6.2.0",
"ngx-markdown": "^10.1.0",
"popper.js": "^1.16.1",
"pptxgenjs": "^2.6.0",
"rxjs": "~6.5.4",
Expand Down
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { SidebysideFormatBreadcrumbsComponent } from './sidebyside-format/sideby
import { SidebysideFormatComponent } from './sidebyside-format/sidebyside-format.component';
import { GlobalErrorHandler } from '@core/error-handling/GlobalErrorHandler';
import { CurrencyPipe } from '@angular/common';
import { MarkdownModule } from 'ngx-markdown';

@NgModule({
declarations: [
Expand Down Expand Up @@ -67,7 +68,8 @@ import { CurrencyPipe } from '@angular/common';
CoreModule.forRoot(),
GovUkLayoutModule,
AppRoutingModule,
ModalModule.forRoot()
ModalModule.forRoot(),
MarkdownModule.forRoot()
],
providers: [{provide: ErrorHandler, useClass: GlobalErrorHandler}, CurrencyPipe],
bootstrap: [AppComponent]
Expand Down
9 changes: 9 additions & 0 deletions src/app/core/config/settings/app-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ export class AppSettings {
version: string;
demo: boolean;
logo: string;
deprecationInformation?: Partial<DeprecationInformationSettings>
}

interface DeprecationInformationSettings {
enabled: boolean;
title: string;
body: string;
newServiceUrl: string;
oldServiceLinkText: string;
}

export let appSettings = new InjectionToken<AppSettings>('AppSettings');
19 changes: 19 additions & 0 deletions src/app/layouts/gov-uk-layout/gov-uk-layout.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
<app-cookie-banner></app-cookie-banner>
<app-header></app-header>

<div *ngIf="settings.deprecationInformation?.enabled" class="govuk-width-container govuk-!-margin-top-3" id="deprecation-notification">
<div class="govuk-notification-banner govuk-!-margin-bottom-3" role="region" aria-labelledby="govuk-notification-banner-title" data-module="govuk-notification-banner">
<div class="govuk-notification-banner__header">
<h2 class="govuk-notification-banner__title" id="govuk-notification-banner-title">
Important
</h2>
</div>
<div class="govuk-notification-banner__content">
<h3 class="govuk-notification-banner__heading" style="max-width: 100%">
{{settings.deprecationInformation?.title}}
</h3>
<div class="govuk-body" style="max-width: 100%">
<markdown [data]="settings.deprecationInformation?.body?.replace('{.govuk-notification-banner__link}','')"></markdown>
</div>
</div>
</div>
</div>

<div class="govuk-width-container app-width-container--wide">

<a *ngIf="isInEditMode()" (click)='onBack()' href="javascript:void(0)" class="govuk-back-link">Back</a>
Expand Down
8 changes: 6 additions & 2 deletions src/app/layouts/gov-uk-layout/gov-uk-layout.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Location } from '@angular/common';
import { Component, OnInit, Inject } from '@angular/core';
import { appSettings, AppSettings } from '@core/config/settings/app-settings';
import { ViewModeService } from 'app/services/viewMode.service';
import { MarkdownService } from 'ngx-markdown';

@Component({
selector: 'app-gov-uk-layout',
Expand All @@ -14,10 +15,13 @@ export class GovUkLayoutComponent implements OnInit {
constructor(
@Inject(appSettings) public settings: AppSettings,
private location: Location,
private viewModeService: ViewModeService) { }
private viewModeService: ViewModeService,
private markdownService: MarkdownService) { }

ngOnInit() {

this.markdownService.renderer.link = (href: string | null, _title: string | null, text: string) => {
return `<a href="${href}" class="govuk-notification-banner__link">${text}</a>`;
}
}

onBack() {
Expand Down
15 changes: 11 additions & 4 deletions src/assets/configuration/config.dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@
"author": "Department of Education",
"robots": "index, follow"
},
"sfbDomain": "http://localhost",
"sfbDomain": "http://localhost:51350",
"apiDomain": "https://aa-t1dv-sfb.azurewebsites.net/api",
"cookieDomain": "localhost",
"customErrorPage": true,
"consoleErrors": true,
"logExceptions": true
"consoleErrors": true,
"logExceptions": true,
"deprecationInformation": {
"enabled": true,
"title": "Schools financial benchmarking will no longer be updated with new data",
"body": "Find the latest data on the new [Financial Benchmarking and Insights Tool](https://financial-benchmarking-and-insights-tool.education.gov.uk/).\nThis will include 2023-24 data for maintained schools.\n\nThis service will include all previous financial data available too.",
"newServiceUrl": "https://financial-benchmarking-and-insights-tool.education.gov.uk/",
"oldServiceLinkText": "Continue to schools financial benchmarking (legacy service)"
}
}
}
}
11 changes: 9 additions & 2 deletions src/assets/configuration/config.prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@
"cookieDomain": "as-t1stg-sfb-sa.azurewebsites.net",
"customErrorPage": true,
"consoleErrors": false,
"logExceptions": true
"logExceptions": true,
"deprecationInformation": {
"enabled": true,
"title": "Schools financial benchmarking will no longer be updated with new data",
"body": "Find the latest data on the new [Financial Benchmarking and Insights Tool](https://financial-benchmarking-and-insights-tool.education.gov.uk/).\nThis will include 2023-24 data for maintained schools.\n\nThis service will include all previous financial data available too.",
"newServiceUrl": "https://financial-benchmarking-and-insights-tool.education.gov.uk/",
"oldServiceLinkText": "Continue to schools financial benchmarking (legacy service)"
}
}
}
}

0 comments on commit 5dfd76b

Please sign in to comment.