diff --git a/.hooks/pre-commit.R b/.hooks/pre-commit.R index 338e609..25ece32 100644 --- a/.hooks/pre-commit.R +++ b/.hooks/pre-commit.R @@ -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)) @@ -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 } @@ -43,25 +43,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) { @@ -70,7 +69,7 @@ if (error_flag) { } tidy_output <- tidy_code() -if(any(tidy_output)){ +if (any(tidy_output)) { error_flag <- TRUE } diff --git a/R/industry_by_subject.R b/R/industry_by_subject.R index d995edb..2912079 100644 --- a/R/industry_by_subject.R +++ b/R/industry_by_subject.R @@ -75,16 +75,13 @@ industry_by_subject_panel <- function() { choices = NULL ), # Add a button to download data as a csv - tags$button( - type = "button", + downloadButton( + "downloadIndSub", class = "govuk-button govuk-button--inverse", `data-module` = "govuk-button", - download_link( - "downloadIndSub", - link_text = "Download this table", - file_size = "maximum 5 KB" - ) - ), + label = "Download this table (maximum 5 KB)", + icon = NULL + ) ) # Right column of filter options - end ) ) diff --git a/R/subject_by_industry.R b/R/subject_by_industry.R index d8f9a0c..d631e47 100644 --- a/R/subject_by_industry.R +++ b/R/subject_by_industry.R @@ -63,16 +63,13 @@ subject_by_industry_panel <- function() { ) ), # Add a button to download data as a csv - tags$button( - type = "button", + downloadButton( + "downloadSubInd", class = "govuk-button govuk-button--inverse", `data-module` = "govuk-button", - download_link( - "downloadSubInd", - link_text = "Download this table", - file_size = "maximum 13 KB" - ) - ), + label = "Download this table (maximum 13 KB)", + icon = NULL + ) ) # Right column of filter options - end ) )