Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

26 add text review workflow #27

Merged
merged 34 commits into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fb342ef
Add missing fields to LICENSE
MarkMc1089 Oct 27, 2023
6e70e8e
Add new markdown pages + modified namespaces in modules
MarkMc1089 Oct 27, 2023
dbc50eb
Add markdown + JS for internal links
MarkMc1089 Oct 27, 2023
fab6847
Add new module for additional markdown page
MarkMc1089 Oct 27, 2023
6888c21
No intentional change, cannot see that anything has...
MarkMc1089 Oct 27, 2023
d291e6a
Bump version
MarkMc1089 Oct 27, 2023
617545f
Remove div wrapper from nhs_card_tabstop; it was preventing the chart…
MarkMc1089 Oct 27, 2023
f651b51
Tidy up markdown examples + remove any not compatible syntax
MarkMc1089 Oct 27, 2023
390ea08
Add further Suggests
MarkMc1089 Oct 27, 2023
83fd329
Add review folder and code
MarkMc1089 Oct 27, 2023
2538cdf
Shorten long mod name + move comment on inline code out of code itself
MarkMc1089 Oct 31, 2023
81e71e4
Add vignette + rewording + small changes + update DESCRIPTION
MarkMc1089 Oct 31, 2023
9a25dbb
Build vignette + trying to fix GHA error
MarkMc1089 Nov 1, 2023
0fd3bff
Rename header args to heading in utils_accessibility + use tagQuery t…
MarkMc1089 Nov 3, 2023
f200a35
Swap ... and tabindex args to allow for easier usage
MarkMc1089 Nov 3, 2023
778da87
Add H1 + create temp folder if needed + add section markers in test file
MarkMc1089 Nov 6, 2023
9f75fa9
WIP
MarkMc1089 Nov 15, 2023
0f12c8d
Pull review scripts into functions, with tests
MarkMc1089 Nov 17, 2023
65ea8a7
Merge branch 'main' into 26-add-text-review-workflow
MarkMc1089 Nov 17, 2023
8164424
Handle lints + attempt to get temp files from R CMD check GHA
MarkMc1089 Nov 17, 2023
6e73051
Merge branch '26-add-text-review-workflow' of https://github.com/nhsb…
MarkMc1089 Nov 17, 2023
9b23ffb
Remove step from GHA, unnecessary
MarkMc1089 Nov 17, 2023
2cb1fa1
Use Windows for R CMD check GHA
MarkMc1089 Nov 20, 2023
d26b647
Include pandoc in R CMD check GHA
MarkMc1089 Nov 20, 2023
da300a3
Temporarily save generated Word doc for troubleshooting GHA
MarkMc1089 Nov 20, 2023
c68d015
Try using Word doc generated by GHA to compare against
MarkMc1089 Nov 20, 2023
2564a32
Use better starting text for styles doc
MarkMc1089 Nov 20, 2023
bb61aca
Most functionality present and tested + vignette almost complete
MarkMc1089 Nov 21, 2023
3e5c70e
Amend test to account for differences between local and CI env
MarkMc1089 Nov 22, 2023
c251549
TEMP: print for verification of testthat:::on_ci
MarkMc1089 Nov 22, 2023
36992b6
Raise expected_differences for CI
MarkMc1089 Nov 22, 2023
729bd88
Everything documented
MarkMc1089 Nov 22, 2023
be5ff68
Updated following code review + update README
MarkMc1089 Jan 15, 2024
2b96291
Add section on installing from repo to README
MarkMc1089 Jan 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@
^gitleaks.toml$
^\.github$
^\.lintr$
^review$
^doc$
^Meta$
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
.DS_Store
rsconnect
.Renviron
/doc/
/Meta/
16 changes: 14 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: nhsbsaShinyR
Title: Template for NHSBSA {shiny} apps
Version: 0.0.0.9002
Version: 0.0.0.9003
Authors@R:
c(person(given = "DALL",
family = "",
Expand Down Expand Up @@ -40,11 +40,23 @@ Imports:
shiny,
shinyjs
Suggests:
knitr,
officedown,
officer,
pkgload,
usethis
purrr,
markdown,
rmarkdown,
rprojroot,
testthat,
tidyr,
usethis,
withr,
xml2
kygoffe marked this conversation as resolved.
Show resolved Hide resolved
Remotes:
nhsbsa-data-analytics/nhsbsaR,
statistiekcbs/scrollytell
Encoding: UTF-8
LazyData: true
RoxygenNote: 7.2.3
VignetteBuilder: knitr
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ recommend that a file or class name and description of purpose be included on
the same “printed page” as the copyright notice for easier identification within
third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2023 Data Science & Advanced Analytics, NHS BSA

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
5 changes: 2 additions & 3 deletions R/app_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#' @noRd
app_server <- function(input, output, session) {
# Your application server logic
mod_markdown_example_server("markdown_example_ui_1")
mod_chart_example_server("chart_example_ui_1")
mod_scrollytell_example_server("scrollytell_example_1")
mod_chart_example_server("chart_example")
mod_scrollytell_example_server("scrollytell_example")
kygoffe marked this conversation as resolved.
Show resolved Hide resolved
}
12 changes: 8 additions & 4 deletions R/app_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@ app_ui <- function(request) {
well = FALSE,
widths = c(3, 9),
tabPanel(
title = "Introduction",
mod_markdown_example_ui("markdown_example_ui_1")
title = "Markdown cheat sheet",
mod_markdown_example_ui("markdown_cheat_sheet_example")
),
tabPanel(
title = "Another markdown page",
mod_internal_link_example_ui("internal_link_example")
),
tabPanel(
title = "Charts",
mod_chart_example_ui("chart_example_ui_1")
mod_chart_example_ui("chart_example")
),
tabPanel(
title = "Scrolly example",
mod_scrollytell_example_ui("scrollytell_example_1")
mod_scrollytell_example_ui("scrollytell_example")
)
)
)
Expand Down
1 change: 1 addition & 0 deletions R/mod_chart_example.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mod_chart_example_ui <- function(id) {
h2_tabstop("Second level"),
nhs_card_tabstop(
heading = "example chart title",
tabindex = 0,
kygoffe marked this conversation as resolved.
Show resolved Hide resolved
nhs_selectInput(
inputId = ns("bins"),
label = "Number of bins:",
Expand Down
22 changes: 22 additions & 0 deletions R/mod_internal_link_example.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#' internal_link_example UI Function
#'
#' @description A shiny Module.
#'
#' @param id,input,output,session Internal parameters for {shiny}.
#'
#' @noRd
mod_internal_link_example_ui <- function(id) {
ns <- NS(id)
tagList(
includeMarkdown("inst/app/www/assets/markdown/mod_internal_link_example.md")
)
}

#' internal_link_example Server Function
#'
#' @noRd
mod_internal_link_example_server <- function(id) { # Exclude Linting
moduleServer(id, function(input, output, session) {
ns <- session$ns
})
}
71 changes: 37 additions & 34 deletions R/utils_accessibility.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#' h1_tabstop
#'
#' @param header Heading text
#' @param heading Heading text
MarkMc1089 marked this conversation as resolved.
Show resolved Hide resolved
#' @param tabindex Number for tabindex, default 0
#' @inheritDotParams shiny::h1
#'
Expand All @@ -9,16 +9,16 @@
#'
#' @examples
#' h1_tabstop("Heading")
h1_tabstop <- function(header, tabindex = 0, ...) {
# create header as typical header plus tabindex attribute
# ensures header will be stopped at when pressing keyboard tab
h1_tabstop <- h1(header, ...) %>%
h1_tabstop <- function(heading, tabindex = 0, ...) {
# create heading as typical heading plus tabindex attribute
# ensures heading will be stopped at when pressing keyboard tab
h1_tabstop <- h1(heading, ...) %>%
htmltools::tagAppendAttributes(`tabindex` = tabindex)
}

#' h2_tabstop
#'
#' @param header Heading text
#' @param heading Heading text
#' @param tabindex Number for tabindex, default 0
#' @inheritDotParams shiny::h2
#'
Expand All @@ -27,16 +27,16 @@ h1_tabstop <- function(header, tabindex = 0, ...) {
#'
#' @examples
#' h2_tabstop("Heading")
h2_tabstop <- function(header, tabindex = 0, ...) {
# create header as typical header plus tabindex attribute
# ensures header will be stopped at when pressing keyboard tab
h2_tabstop <- h2(header, ...) %>%
h2_tabstop <- function(heading, tabindex = 0, ...) {
# create heading as typical heading plus tabindex attribute
# ensures heading will be stopped at when pressing keyboard tab
h2_tabstop <- h2(heading, ...) %>%
htmltools::tagAppendAttributes(`tabindex` = tabindex)
}

#' h3_tabstop
#'
#' @param header Heading text
#' @param heading Heading text
#' @param tabindex Number for tabindex, default 0
#' @inheritDotParams shiny::h3
#'
Expand All @@ -45,16 +45,16 @@ h2_tabstop <- function(header, tabindex = 0, ...) {
#'
#' @examples
#' h3_tabstop("Heading")
h3_tabstop <- function(header, tabindex = 0, ...) {
# create header as typical header plus tabindex attribute
# ensures header will be stopped at when pressing keyboard tab
h3_tabstop <- h3(header, ...) %>%
h3_tabstop <- function(heading, tabindex = 0, ...) {
# create heading as typical heading plus tabindex attribute
# ensures heading will be stopped at when pressing keyboard tab
h3_tabstop <- h3(heading, ...) %>%
htmltools::tagAppendAttributes(`tabindex` = tabindex)
}

#' h4_tabstop
#'
#' @param header Heading text
#' @param heading Heading text
#' @param tabindex Number for tabindex, default 0
#' @inheritDotParams shiny::h4
#'
Expand All @@ -63,16 +63,16 @@ h3_tabstop <- function(header, tabindex = 0, ...) {
#'
#' @examples
#' h4_tabstop("Heading")
h4_tabstop <- function(header, tabindex = 0, ...) {
# create header as typical header plus tabindex attribute
# ensures header will be stopped at when pressing keyboard tab
h4_tabstop <- h4(header, ...) %>%
h4_tabstop <- function(heading, tabindex = 0, ...) {
# create heading as typical heading plus tabindex attribute
# ensures heading will be stopped at when pressing keyboard tab
h4_tabstop <- h4(heading, ...) %>%
htmltools::tagAppendAttributes(`tabindex` = tabindex)
}

#' h5_tabstop
#'
#' @param header Heading text
#' @param heading Heading text
#' @param tabindex Number for tabindex, default 0
#' @inheritDotParams shiny::h5
#'
Expand All @@ -81,16 +81,16 @@ h4_tabstop <- function(header, tabindex = 0, ...) {
#'
#' @examples
#' h5_tabstop("Heading")
h5_tabstop <- function(header, tabindex = 0, ...) {
# create header as typical header plus tabindex attribute
# ensures header will be stopped at when pressing keyboard tab
h5_tabstop <- h5(header, ...) %>%
h5_tabstop <- function(heading, tabindex = 0, ...) {
# create heading as typical heading plus tabindex attribute
# ensures heading will be stopped at when pressing keyboard tab
h5_tabstop <- h5(heading, ...) %>%
htmltools::tagAppendAttributes(`tabindex` = tabindex)
}

#' h6_tabstop
#'
#' @param header Heading text
#' @param heading Heading text
#' @param tabindex Number for tabindex, default 0
#' @inheritDotParams shiny::h6
#'
Expand All @@ -99,17 +99,17 @@ h5_tabstop <- function(header, tabindex = 0, ...) {
#'
#' @examples
#' h6_tabstop("Heading")
h6_tabstop <- function(header, tabindex = 0, ...) {
# create header as typical header plus tabindex attribute
# ensures header will be stopped at when pressing keyboard tab
h6_tabstop <- h6(header, ...) %>%
h6_tabstop <- function(heading, tabindex = 0, ...) {
# create heading as typical heading plus tabindex attribute
# ensures heading will be stopped at when pressing keyboard tab
h6_tabstop <- h6(heading, ...) %>%
htmltools::tagAppendAttributes(`tabindex` = tabindex)
}


#' nhs_card_tabstop
#'
#' @param header Card title
#' @param heading Card title
#' @param tabindex Number for tabindex, default 0
#' @param ... Card content
#'
Expand All @@ -118,9 +118,12 @@ h6_tabstop <- function(header, tabindex = 0, ...) {
#'
#' @examples
#' nhs_card_tabstop("A card", shiny::p("Some content"))
nhs_card_tabstop <- function(header, tabindex = 0, ...) {
nhs_card_tabstop <- function(heading, tabindex = 0, ...) {
# create nhs_card as typical nhs_card plus tabindex attribute
# ensures nhs_card will be stopped at when pressing keyboard tab
nhs_card_tabstop <- div(nhs_card(header, ...)) %>%
htmltools::tagAppendAttributes(`tabindex` = tabindex)
htmltools::tagQuery(nhs_card(heading, ...))$
find(".nhsuk-card__heading")$
removeAttr("tabindex")$
addAttr("tabindex" = tabindex)$
allTags() # Exclude Linting
kygoffe marked this conversation as resolved.
Show resolved Hide resolved
}
25 changes: 25 additions & 0 deletions inst/app/www/assets/markdown/mod_internal_link_example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Another markdown page

This page is linked to from the Markdown cheat sheet page. There is a heading below the fake latin for demonstration of internal links. If you got here by clicking the link, the back button on the browser will be enabled to take you back.

---

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi vel erat ac ante aliquet pellentesque. Phasellus consectetur euismod purus, eu convallis erat malesuada eget. In tristique risus neque. Sed nulla felis, dignissim ut tortor ac, volutpat elementum ex. Fusce efficitur ante vel erat commodo, vel sodales odio sollicitudin. Nulla molestie odio id pretium cursus. Phasellus ornare quam eget metus vehicula vulputate.

In dignissim semper dignissim. Maecenas libero mi, fermentum at diam sed, aliquam tincidunt tellus. Donec sollicitudin ullamcorper justo. Duis tincidunt urna sapien, a ornare ligula maximus id. Aliquam placerat turpis non ligula suscipit luctus. Fusce pellentesque accumsan placerat. Donec at mauris eu diam semper tempor.

Vivamus augue magna, congue at molestie in, vulputate ut lacus. Donec sagittis tortor sit amet ex gravida, sed ullamcorper ex pretium. Sed at tincidunt metus. Maecenas luctus nec eros ullamcorper scelerisque. Fusce eget dolor eu dolor sodales lacinia. Quisque iaculis lacus in bibendum fermentum. Donec porta mauris quis eros posuere fringilla.

Nulla molestie nibh egestas euismod imperdiet. Proin congue faucibus enim, ac condimentum diam fringilla id. In ac auctor odio. Sed eu magna a velit accumsan ornare vitae a dolor. Vestibulum laoreet eu ex nec vulputate. Nullam rutrum imperdiet mauris, a ullamcorper erat efficitur ac. Vestibulum ut gravida turpis. Donec at venenatis mi. Maecenas a velit lorem. Vivamus quis efficitur urna. Aliquam erat volutpat. Phasellus pretium est tellus, in accumsan orci laoreet quis. Cras fermentum, libero nec elementum egestas, quam mi tincidunt ligula, eu efficitur metus justo non felis.

Suspendisse nec consequat nulla, ac posuere velit. Integer interdum commodo lorem, sit amet luctus felis tincidunt varius. Donec id tortor quis orci bibendum congue sit amet eu velit. Aenean sapien nulla, congue sed aliquam eget, porttitor non nibh. Sed tincidunt sit amet sem ac pulvinar. Phasellus non ligula volutpat, tincidunt lectus pulvinar, pretium tortor. Integer non mattis nisl. Etiam eget nisl elementum, auctor libero vitae, ornare est. Morbi orci lorem, consequat id semper venenatis, lacinia nec ipsum.

---

### Linked heading

Headings will automatically be assigned an id created from the heading text. Only alphanumeric characters will be retained, and they will be made lower-case and separated by dashes. So the above heading will be, in HTML

`<h3 id="linked-heading">Linked heading</h3>`

If you got here by clicking the link, the back button on the browser will be enabled to take you back.
Loading