Skip to content

Commit

Permalink
Merge pull request #97 from dfe-analytical-services/panel_scripts
Browse files Browse the repository at this point in the history
Updating dashboard to current DfE styling standards
  • Loading branch information
rmbielby authored Nov 20, 2024
2 parents 7f1c98c + f82a9c3 commit 2c138a1
Show file tree
Hide file tree
Showing 167 changed files with 183,866 additions and 24,720 deletions.
43 changes: 19 additions & 24 deletions .github/workflows/deploy-shiny.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,37 @@ on:
push:
branches:
- main

- development
pull_request:
branches:
- main
- development

name: deploy-shiny

jobs:
deployShiny:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
# Running on mac as it's quicker to build
- {os: macOS-latest, r: 'release'}
runs-on: macOS-latest

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
RENV_PATHS_ROOT: ~/.local/share/renv
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
r-version: 4.4.0
r-version: 4.4.1
use-public-rspm: true

- name: Set env vars (dev)
if: endsWith(github.ref, '/development')
run: |
echo "SHINYAPP_NAME='dev-leo-graduate-industry-dashboard'" >> $GITHUB_ENV
- name: Set env vars (prod)
if: endsWith(github.ref, '/main')
run: |
echo "SHINYAPP_NAME='leo-graduate-industry-dashboard'">> $GITHUB_ENV
- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
Expand All @@ -39,14 +41,6 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Cache renv packages
uses: actions/cache@v1
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Restore renv snapshot
shell: Rscript {0}
run: |
Expand All @@ -59,7 +53,8 @@ jobs:
install.packages("rsconnect")
- name: Push to shiny.io
if: github.event_name != 'pull_request'
run: >
Rscript
-e "rsconnect::setAccountInfo(name = 'department-for-education', token = '${{secrets.SHINYAPPS_TOKEN}}', secret = '${{secrets.SHINYAPPS_SECRET}}')"
-e "rsconnect::deployApp(forceUpdate=TRUE)"
-e "rsconnect::deployApp(appName=${{env.SHINYAPP_NAME}}, forceUpdate = TRUE)"
8 changes: 0 additions & 8 deletions .github/workflows/shiny-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Cache renv packages
uses: actions/cache@v1
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Restore renv snapshot
shell: Rscript {0}
run: |
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows/tidyCode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Cache renv packages
uses: actions/cache@v1
with:
path: ${{ env.RENV_PATHS_ROOT }}
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- name: Restore renv snapshot
shell: Rscript {0}
run: |
Expand Down
25 changes: 12 additions & 13 deletions .hooks/pre-commit.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env Rscript
cat("Running commit hooks...",fill=TRUE)
cat("Running commit hooks...", fill = TRUE)
shhh <- suppressPackageStartupMessages # It's a library, so shhh!
shhh(library(dplyr))
shhh(library(xfun))
Expand All @@ -16,12 +16,12 @@ cat("Contents of the .gitignore file:")
print(ign_files)

# Run a pass through the .gitignore files and look for any issues
if(ncol(ign_files)>1){
if (ncol(ign_files) > 1) {
cat("ERROR: It looks like you've got commas in the .gitignore. Please correct the .gitignore file and try again.")
error_flag <- TRUE
} else {
for(i in 1:nrow(ign_files)){
if(grepl(' ',ign_files$filename[i])){
for (i in 1:nrow(ign_files)) {
if (grepl(" ", ign_files$filename[i])) {
cat("ERROR: It looks like you've got spaces in filenames in the .gitignore. Please rename your files if they contain spaces and update the .gitignore file accordingly.")
error_flag <- TRUE
}
Expand All @@ -41,25 +41,24 @@ for (file in current_files$files) {
} else {
file_status <- (log_files %>% filter(filename == file))$status
if (!file_status %in% c("published", "Published", "reference", "Reference", "dummy", "Dummy")) {
if (!file %in% ign_files$filename & !grepl("unpublished",file)) {
if (!file %in% ign_files$filename & !grepl("unpublished", file)) {
cat("Error:", file, "is not logged as published or reference data in datafiles_log.csv and is not found in .gitignore.\n\n")
cat("If the file contains published or reference data then update its entry in datafiles_log.csv.\n\n")
cat("If the file contains unpublished data then add it to the .gitignore file.\n\n")
error_flag <- TRUE
}
else {
cat(file,"is recorded in the logfile as unpublished data and in .gitignore and so will not be included as part of the commit.\n\n")
} else {
cat(file, "is recorded in the logfile as unpublished data and in .gitignore and so will not be included as part of the commit.\n\n")
}
}
}
}

if(grepl('G-Z967JJVQQX', htmltools::includeHTML(("google-analytics.html"))) &
!(toupper(Sys.getenv("USERNAME")) %in% c("CFOSTER4", "CRACE", "LSELBY","RBIELBY", "JMACHIN"))){
cat("Cleaning out the template's Google Analytics tag.",fill=TRUE)
if (grepl("G-Z967JJVQQX", htmltools::includeHTML(("google-analytics.html"))) &
!(toupper(Sys.getenv("USERNAME")) %in% c("CFOSTER4", "CRACE", "LSELBY", "RBIELBY", "JMACHIN"))) {
cat("Cleaning out the template's Google Analytics tag.", fill = TRUE)
gsub_file("google-analytics.html", pattern = "G-Z967JJVQQX", replacement = "G-XXXXXXXXXX")
gsub_file("ui.R", pattern = "Z967JJVQQX", replacement = "XXXXXXXXXX")
system2(command = "git", args=c("add","google-analytics.html"))
system2(command = "git", args = c("add", "google-analytics.html"))
}

if (error_flag) {
Expand All @@ -68,7 +67,7 @@ if (error_flag) {
}

tidy_output <- tidy_code()
if(any(tidy_output)){
if (any(tidy_output)) {
error_flag <- TRUE
}

Expand Down
47 changes: 0 additions & 47 deletions R/accessibility_statement.R

This file was deleted.

155 changes: 155 additions & 0 deletions R/accessibility_statement_function.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
a11y_panel <- function() {
tabPanel(
"Accessibility",
gov_main_layout(
gov_row(
column(
width = 12,
h1(paste0("Accessibility statement for ", dashboard_title)),
tags$p(
"This accessibility statement applies to the",
dashboard_link,
"website. This website is run by the ",
external_link(
href = "https://www.gov.uk/government/organisations/department-for-education",
"Department for Education (DfE)"
),
".",
"This statement does not cover any other services run by the Department for Education (DfE) or GOV.UK."
),
h2("How you should be able to use this website"),
tags$p("We want as many people as possible to be able to use this website. You should be able to:"),
tags$div(tags$ul(
tags$li("change colours, contrast levels and fonts using browser or device settings"),
tags$li("zoom in up to 400% without the text spilling off the screen"),
tags$li("navigate most of the website using a keyboard or speech recognition software"),
tags$li("listen to most of the website using a screen reader
(including the most recent versions of JAWS, NVDA and VoiceOver)")
)),
tags$p("We’ve also made the website text as simple as possible to understand."),
tags$p(
external_link(href = "https://mcmw.abilitynet.org.uk/", "AbilityNet"),
" has advice on making your device easier to use if you have a disability."
),
h2("How accessible this website is"),
tags$p("We know some parts of this website are not fully accessible:"),
tags$div(tags$ul(
tags$li("Keyboard navigation through the interactive charts is currently limited, and some features are unavailable for keyboard only users"),
tags$li("Alternative text in interactive charts is limited to titles and could be more descriptive (although this data is available in csv format)")
)), # TODO
h2("Feedback and contact information"),
tags$p(
"If you need information on this website in a different format please see the parent",
"publications",
external_link(
href = "https://explore-education-statistics.service.gov.uk/find-statistics",
"on Explore education statistics"
),
", as detailed on the data sources page of this service.",
". More details are available on that service for alternative formats of this data.",
),
tags$p("We’re always looking to improve the accessibility of this website.
If you find any problems not listed on this page or think we’re not meeting
accessibility requirements, contact us:"),
tags$ul(tags$li(
a(
href = "mailto:[email protected]",
"[email protected]"
)
)),
h2("Enforcement procedure"),
tags$p("The Equality and Human Rights Commission (EHRC) is responsible for enforcing the Public Sector Bodies
(Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018
(the ‘accessibility regulations’)."),
tags$p(
"If you are not happy with how we respond to your complaint, ",
external_link(
href = "https://www.equalityadvisoryservice.com/",
"contact the Equality Advisory and Support Service (EASS)"
),
"."
),
h2("Technical information about this website's accessibility"),
tags$p("The Department for Education (DfE) is committed to making its website accessible, in accordance with the
Public Sector Bodies (Websites and Mobile Applications) (No. 2) Accessibility Regulations 2018."),
h3("Compliance status"),
tags$p(
"This website is partially compliant with the ",
external_link(
href = "https://www.w3.org/TR/WCAG22/",
"Web Content Accessibility Guidelines version 2.2 AA standard"
),
" due to the non-compliances listed below."
),
h3("Non accessible content"),
tags$p("The content listed below is non-accessible for the following reasons.
We will address these issues to ensure our content is accessible."),
tags$div(tags$ul(
tags$li("Charts have non-accessible components that are inaccessible for keyboard users."),
tags$li("Chart tooltips are not compativle with screen reader use."),
tags$li("Some decorative images are not labelled appropriately as yet."),
tags$li("Some links are not appropriately labelled.")
)),
h3("Disproportionate burden"),
tags$p("Not applicable."),
h2("How we tested this website"),
tags$p(
"The template used for this website was last tested on 12 March 2024 against ",
external_link(
href = "https://www.w3.org/TR/WCAG22/",
"Accessibility Guidelines WCAG2.2"
),
". The test was carried out by the ",
external_link(
href = "https://digitalaccessibilitycentre.org/",
"Digital accessibility centre (DAC)"
),
"."
),
tags$p("DAC tested a sample of pages to cover the core functionality of the service including:"),
tags$div(tags$ul(
tags$li("navigation"),
tags$li("interactive dropdown selections"),
tags$li("charts, maps, and tables")
)),
tags$p(
"This specific website was was last tested on 8th October 2024 against ",
external_link(
href = "https://www.w3.org/TR/WCAG22/",
"Accessibility Guidelines WCAG2.2"
),
". The test was carried out by the ",
external_link(
href = "https://www.gov.uk/government/organisations/department-for-education",
"Department for Education (DfE)"
),
"."
),
h2("What we're doing to improve accessibility"),
tags$p("We plan to continually test the service for accessibility issues, and are working through a prioritised
list of issues to resolve."),
tags$p(
"Our current list of issues to be resolved is available on our ",
external_link(
href = paste0(public_repo_link, "/issues"),
"GitHub issues page"
),
"."
),
h2("Preparation of this accessibility statement"),
tags$p("This statement was prepared on 1st July 2024. It was last reviewed on 8th October 2024."),
tags$p(
"The template used for this website was last tested in March 2024 against the WCAG 2.2 AA standard.
This test of a representative sample of pages was carried out by the ",
external_link(
href = "https://digitalaccessibilitycentre.org/",
"Digital accessibility centre (DAC)"
),
"."
),
tags$p("We also used findings from our own testing when preparing this accessibility statement.")
)
)
)
)
}
Loading

0 comments on commit 2c138a1

Please sign in to comment.