From f9887d7881e1b5996b6ca51ce59f586ae5a311fd Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Mon, 30 Sep 2024 13:24:34 +0100 Subject: [PATCH 1/3] Replaced all tags links in support panel with dfeshiny::external_link() --- R/support_panel.R | 42 +++++++++++++++++++----------------------- www/cookie-consent.js | 24 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 23 deletions(-) create mode 100644 www/cookie-consent.js diff --git a/R/support_panel.R b/R/support_panel.R index 51df9fd..294b9ab 100644 --- a/R/support_panel.R +++ b/R/support_panel.R @@ -103,10 +103,9 @@ support_panel <- function( "This dashboard is a new service that we are developing. If you have any feedback or suggestions for improvements, please submit them using our ", - shiny::tags$a( + dfeshiny::external_link( href = form_url, - "feedback form", - .noWS = c("after") + link_text = "feedback form" ) ) } else { @@ -124,10 +123,10 @@ support_panel <- function( "f you spot any errors or bugs while using this dashboard, please screenshot and email them to " ), - shiny::tags$a( + dfeshiny::external_link( href = paste0("mailto:", team_email), - team_email, - .noWS = c("after") + link_text = team_email, + add_warning = FALSE ), "." ), shiny::tags$h2("Find more information on the data"), @@ -136,35 +135,32 @@ support_panel <- function( "The parent statistical release of this dashboard, along with methodological information, is available at the following link: ", - shiny::tags$a( + dfeshiny::external_link( href = paste0( "https://explore-education-statistics.service.gov.uk/find-statistics/", # nolint: [line_length_linter] publication_slug ), - ifelse( + link_text = ifelse( !is.null(publication_name), publication_name, "Explore Education Statistics" - ), - .noWS = c("after") + ) ), ". The statistical release provides additional ", - shiny::tags$a( + dfeshiny::external_link( href = paste0( "https://explore-education-statistics.service.gov.uk/find-statistics/", # nolint: [line_length_linter] publication_slug, "/data-guidance" ), - "data guidance", - .noWS = c("after") + link_text = "data guidance" ), " and ", - shiny::tags$a( + dfeshiny::external_link( href = paste0( "https://explore-education-statistics.service.gov.uk/find-statistics/", # nolint: [line_length_linter] publication_slug, "#explore-data-and-files" ), - "tools to access and interogate the underling data", - .noWS = c("after") + link_text = "tools to access and interogate the underling data" ), " contained in this dashboard." ) @@ -173,10 +169,9 @@ support_panel <- function( "The parent statistical release of this dashboard, along with methodological information, is available at the following link: ", - shiny::tags$a( + dfeshiny::external_link( href = alt_href, - publication_name, - .noWS = c("after") + link_text = publication_name ) ) }, @@ -184,19 +179,20 @@ support_panel <- function( shiny::tags$p( "If you have questions about the dashboard or data within it, please contact us at ", - shiny::tags$a( + dfeshiny::external_link( href = paste0("mailto:", team_email), - team_email, .noWS = c("after") + link_text = team_email, + add_warning = FALSE ) ), shiny::tags$h2("See the source code"), shiny::tags$p( "The source code for this dashboard is available in our ", - shiny::tags$a( + dfeshiny::external_link( href = paste0( repo_name ), - "GitHub repository", .noWS = c("after") + link_text = "GitHub repository" ), "." ) diff --git a/www/cookie-consent.js b/www/cookie-consent.js new file mode 100644 index 0000000..85ca118 --- /dev/null +++ b/www/cookie-consent.js @@ -0,0 +1,24 @@ +function getCookies(){ + var res = Cookies.get(); + Shiny.setInputValue('cookies', res); +} + +Shiny.addCustomMessageHandler('cookie-set', function(msg){ + Cookies.set(msg.name, msg.value); + getCookies(); +}) + +Shiny.addCustomMessageHandler('cookie-clear', function(msg){ + Cookies.remove(msg.name); + getCookies(); +}) + +$(document).on('shiny:connected', function(ev){ + getCookies(); +}) + +Shiny.addCustomMessageHandler('analytics-consent', function(msg){ + gtag('consent', 'update', { + 'analytics_storage': msg.value + }); +}) From 07dde568e02f9aa0d9421dc2a8948e8f0e2ee627 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Mon, 30 Sep 2024 13:39:20 +0100 Subject: [PATCH 2/3] Increment version number to 0.4.2 --- DESCRIPTION | 2 +- NEWS.md | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index caefff6..8c1ed12 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: dfeshiny Title: DfE R Shiny Standards -Version: 0.4.1.9000 +Version: 0.4.2 Authors@R: c( person("Rich", "Bielby", , "richard.bielby@education.gov.uk", role = c("aut", "cre"), comment = c(ORCID = "0000-0001-9070-9969")), diff --git a/NEWS.md b/NEWS.md index 2c28295..2dfa712 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,6 @@ -# dfeshiny (development version) +# dfeshiny 0.4.2 + +* Applied use of `external_link()` to `support_panel()` # dfeshiny 0.4.1 From 922addfe1904b0da2e35bea6f4558d2a0a7a8ad2 Mon Sep 17 00:00:00 2001 From: Rich Bielby Date: Tue, 1 Oct 2024 09:33:59 +0100 Subject: [PATCH 3/3] Text changes to support panel based on PR comments --- .gitignore | 1 + R/support_panel.R | 17 ++++++++++------- www/cookie-consent.js | 24 ------------------------ 3 files changed, 11 insertions(+), 31 deletions(-) delete mode 100644 www/cookie-consent.js diff --git a/.gitignore b/.gitignore index 4841380..0368268 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ google-analytics.html tests/testthat/google-analytics.html docs inst/doc +www diff --git a/R/support_panel.R b/R/support_panel.R index 294b9ab..5f32e97 100644 --- a/R/support_panel.R +++ b/R/support_panel.R @@ -106,7 +106,8 @@ support_panel <- function( dfeshiny::external_link( href = form_url, link_text = "feedback form" - ) + ), + "." ) } else { shiny::tags$p( @@ -134,7 +135,7 @@ support_panel <- function( shiny::tags$p( "The parent statistical release of this dashboard, along with methodological information, - is available at the following link: ", + is available at ", dfeshiny::external_link( href = paste0( "https://explore-education-statistics.service.gov.uk/find-statistics/", # nolint: [line_length_linter] @@ -143,7 +144,7 @@ support_panel <- function( link_text = ifelse( !is.null(publication_name), publication_name, - "Explore Education Statistics" + "explore education statistics" ) ), ". The statistical release provides additional ", @@ -160,7 +161,7 @@ support_panel <- function( "https://explore-education-statistics.service.gov.uk/find-statistics/", # nolint: [line_length_linter] publication_slug, "#explore-data-and-files" ), - link_text = "tools to access and interogate the underling data" + link_text = "tools to access and interrogate the underlying data" ), " contained in this dashboard." ) @@ -168,11 +169,12 @@ support_panel <- function( shiny::tags$p( "The parent statistical release of this dashboard, along with methodological information, - is available at the following link: ", + is available at ", dfeshiny::external_link( href = alt_href, link_text = publication_name - ) + ), + "." ) }, shiny::tags$h2("Contact us"), @@ -183,7 +185,8 @@ support_panel <- function( href = paste0("mailto:", team_email), link_text = team_email, add_warning = FALSE - ) + ), + "." ), shiny::tags$h2("See the source code"), shiny::tags$p( diff --git a/www/cookie-consent.js b/www/cookie-consent.js deleted file mode 100644 index 85ca118..0000000 --- a/www/cookie-consent.js +++ /dev/null @@ -1,24 +0,0 @@ -function getCookies(){ - var res = Cookies.get(); - Shiny.setInputValue('cookies', res); -} - -Shiny.addCustomMessageHandler('cookie-set', function(msg){ - Cookies.set(msg.name, msg.value); - getCookies(); -}) - -Shiny.addCustomMessageHandler('cookie-clear', function(msg){ - Cookies.remove(msg.name); - getCookies(); -}) - -$(document).on('shiny:connected', function(ev){ - getCookies(); -}) - -Shiny.addCustomMessageHandler('analytics-consent', function(msg){ - gtag('consent', 'update', { - 'analytics_storage': msg.value - }); -})