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

445 unify html tags #566

Merged
merged 9 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
24 changes: 12 additions & 12 deletions R/FilterState.R
Original file line number Diff line number Diff line change
Expand Up @@ -296,16 +296,16 @@ FilterState <- R6::R6Class( # nolint
### Title consists of conditional icon, varname, conditional varlabel, and controls, arranged in a row.
### Summary consists of value and controls, arranged in a row.

div(
shiny::tags$div(
id = id,
class = "panel filter-card",
include_js_files("count-bar-labels.js"),
div(
shiny::tags$div(
class = "filter-card-header",
`data-toggle` = "collapse",
`data-bs-toggle` = "collapse",
href = paste0("#", ns("body")),
div(
shiny::tags$div(
class = "filter-card-title",
if (private$is_anchored() && private$is_fixed()) {
icon("anchor-lock", class = "filter-card-icon")
Expand All @@ -314,9 +314,9 @@ FilterState <- R6::R6Class( # nolint
} else if (!private$is_anchored() && private$is_fixed()) {
icon("lock", class = "filter-card-icon")
},
div(class = "filter-card-varname", strong(private$get_varname())),
div(class = "filter-card-varlabel", private$get_varlabel()),
div(
shiny::tags$div(class = "filter-card-varname", shiny::tags$strong(private$get_varname())),
shiny::tags$div(class = "filter-card-varlabel", private$get_varlabel()),
shiny::tags$div(
class = "filter-card-controls",
# Suppress toggling body when clicking on this div.
# This is for bootstrap 3 and 4. Causes page to scroll to top, prevented by setting href on buttons.
Expand Down Expand Up @@ -354,14 +354,14 @@ FilterState <- R6::R6Class( # nolint
}
)
),
div(class = "filter-card-summary", private$ui_summary(ns("summary")))
shiny::tags$div(class = "filter-card-summary", private$ui_summary(ns("summary")))
),
div(
shiny::tags$div(
id = ns("body"),
class = "collapse out",
`data-parent` = paste0("#", parent_id),
`data-bs-parent` = paste0("#", parent_id),
div(
shiny::tags$div(
class = "filter-card-body",
if (private$is_fixed()) {
private$ui_inputs_fixed(ns("inputs"))
Expand Down Expand Up @@ -692,7 +692,7 @@ FilterState <- R6::R6Class( # nolint
# @param id (`character(1)`) `shiny` module instance id.
ui_inputs_fixed = function(id) {
ns <- NS(id)
div(
shiny::tags$div(
class = "choices_state",
uiOutput(ns("selection"))
)
Expand All @@ -717,7 +717,7 @@ FilterState <- R6::R6Class( # nolint
countnow <- private$filtered_na_count()
ui_input <- checkboxInput(
inputId = ns("value"),
label = span(
label = shiny::tags$span(
id = ns("count_label"),
make_count_text(
label = "Keep NA",
Expand All @@ -727,7 +727,7 @@ FilterState <- R6::R6Class( # nolint
),
value = private$get_keep_na()
)
div(
shiny::tags$div(
uiOutput(ns("trigger_visible"), inline = TRUE),
ui_input
)
Expand Down
42 changes: 21 additions & 21 deletions R/FilterStateChoices.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,25 +46,25 @@
#' useShinyjs(),
#' include_css_files(pattern = "filter-panel"),
#' include_js_files(pattern = "count-bar-labels"),
#' column(4, div(
#' h4("ChoicesFilterState"),
#' column(4, shiny::tags$div(
#' shiny::tags$h4("ChoicesFilterState"),
#' fs$ui("fs")
#' )),
#' column(4, div(
#' h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_choices"), br(),
#' h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_choices"), br(),
#' h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_choices"), br()
#' column(4, shiny::tags$div(
#' shiny::tags$h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_choices"), shiny::tags$br(),
#' shiny::tags$h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_choices"), shiny::tags$br(),
#' shiny::tags$h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_choices"), shiny::tags$br()
#' )),
#' column(4, div(
#' h4("Programmatic filter control"),
#' actionButton("button1_choices", "set drop NA", width = "100%"), br(),
#' actionButton("button2_choices", "set keep NA", width = "100%"), br(),
#' actionButton("button3_choices", "set selection: a, b", width = "100%"), br(),
#' actionButton("button4_choices", "deselect all", width = "100%"), br(),
#' actionButton("button0_choices", "set initial state", width = "100%"), br()
#' column(4, shiny::tags$div(
#' shiny::tags$h4("Programmatic filter control"),
#' actionButton("button1_choices", "set drop NA", width = "100%"), shiny::tags$br(),
#' actionButton("button2_choices", "set keep NA", width = "100%"), shiny::tags$br(),
#' actionButton("button3_choices", "set selection: a, b", width = "100%"), shiny::tags$br(),
#' actionButton("button4_choices", "deselect all", width = "100%"), shiny::tags$br(),
#' actionButton("button0_choices", "set initial state", width = "100%"), shiny::tags$br()
#' ))
#' )
#'
Expand Down Expand Up @@ -374,7 +374,7 @@ ChoicesFilterState <- R6::R6Class( # nolint
countsnow = countsnow,
countsmax = countsmax
)
div(
shiny::tags$div(
class = "choices_state",
if (private$is_multiple()) {
checkboxGroupInput(
Expand Down Expand Up @@ -416,7 +416,7 @@ ChoicesFilterState <- R6::R6Class( # nolint
)
)
}
div(
shiny::tags$div(
uiOutput(ns("trigger_visible")),
ui_input,
private$keep_na_ui(ns("keep_na"))
Expand Down Expand Up @@ -603,14 +603,14 @@ ChoicesFilterState <- R6::R6Class( # nolint
}
}
tagList(
tags$span(
shiny::tags$span(
class = "filter-card-summary-value",
selected_text
),
tags$span(
shiny::tags$span(
class = "filter-card-summary-controls",
if (private$na_count > 0) {
tags$span("NA", if (isTRUE(private$get_keep_na())) icon("check") else icon("xmark"))
shiny::tags$span("NA", if (isTRUE(private$get_keep_na())) icon("check") else icon("xmark"))
}
)
)
Expand Down
50 changes: 25 additions & 25 deletions R/FilterStateDate.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,26 @@
#' useShinyjs(),
#' include_css_files(pattern = "filter-panel"),
#' include_js_files(pattern = "count-bar-labels"),
#' column(4, div(
#' h4("DateFilterState"),
#' column(4, shiny::tags$div(
#' shiny::tags$h4("DateFilterState"),
#' fs$ui("fs")
#' )),
#' column(4, div(
#' column(4, shiny::tags$div(
#' id = "outputs", # div id is needed for toggling the element
#' h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_date"), br(),
#' h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_date"), br(),
#' h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_date"), br()
#' shiny::tags$h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_date"), shiny::tags$br(),
#' shiny::tags$h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_date"), shiny::tags$br(),
#' shiny::tags$h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_date"), shiny::tags$br()
#' )),
#' column(4, div(
#' h4("Programmatic filter control"),
#' actionButton("button1_date", "set drop NA", width = "100%"), br(),
#' actionButton("button2_date", "set keep NA", width = "100%"), br(),
#' actionButton("button3_date", "set a range", width = "100%"), br(),
#' actionButton("button4_date", "set full range", width = "100%"), br(),
#' actionButton("button0_date", "set initial state", width = "100%"), br()
#' column(4, shiny::tags$div(
#' shiny::tags$h4("Programmatic filter control"),
#' actionButton("button1_date", "set drop NA", width = "100%"), shiny::tags$br(),
#' actionButton("button2_date", "set keep NA", width = "100%"), shiny::tags$br(),
#' actionButton("button3_date", "set a range", width = "100%"), shiny::tags$br(),
#' actionButton("button4_date", "set full range", width = "100%"), shiny::tags$br(),
#' actionButton("button0_date", "set initial state", width = "100%"), shiny::tags$br()
#' ))
#' )
#'
Expand Down Expand Up @@ -278,16 +278,16 @@ DateFilterState <- R6::R6Class( # nolint
ui_inputs = function(id) {
ns <- NS(id)
isolate({
div(
div(
shiny::tags$div(
shiny::tags$div(
class = "flex",
actionButton(
class = "date_reset_button",
inputId = ns("start_date_reset"),
label = NULL,
icon = icon("fas fa-undo")
),
div(
shiny::tags$div(
class = "w-80 filter_datelike_input",
dateRangeInput(
inputId = ns("selection"),
Expand Down Expand Up @@ -402,9 +402,9 @@ DateFilterState <- R6::R6Class( # nolint

output$selection <- renderUI({
vals <- format(private$get_selected(), nsmall = 3)
div(
div(icon("calendar-days"), vals[1]),
div(span(" - "), icon("calendar-days"), vals[2])
shiny::tags$div(
shiny::tags$div(icon("calendar-days"), vals[1]),
shiny::tags$div(span(" - "), icon("calendar-days"), vals[2])
)
})

Expand All @@ -423,14 +423,14 @@ DateFilterState <- R6::R6Class( # nolint
min <- selected[1]
max <- selected[2]
tagList(
tags$span(
shiny::tags$span(
class = "filter-card-summary-value",
HTML(min, "&ndash;", max)
),
tags$span(
shiny::tags$span(
class = "filter-card-summary-controls",
if (private$na_count > 0) {
tags$span("NA", if (isTRUE(private$get_keep_na())) icon("check") else icon("xmark"))
shiny::tags$span("NA", if (isTRUE(private$get_keep_na())) icon("check") else icon("xmark"))
}
)
)
Expand Down
58 changes: 29 additions & 29 deletions R/FilterStateDatettime.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,26 @@
#' useShinyjs(),
#' include_css_files(pattern = "filter-panel"),
#' include_js_files(pattern = "count-bar-labels"),
#' column(4, div(
#' h4("DatetimeFilterState"),
#' column(4, shiny::tags$div(
#' shiny::tags$h4("DatetimeFilterState"),
#' fs$ui("fs")
#' )),
#' column(4, div(
#' column(4, shiny::tags$div(
#' id = "outputs", # div id is needed for toggling the element
#' h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_datetime"), br(),
#' h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_datetime"), br(),
#' h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_datetime"), br()
#' shiny::tags$h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_datetime"), shiny::tags$br(),
#' shiny::tags$h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_datetime"), shiny::tags$br(),
#' shiny::tags$h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_datetime"), shiny::tags$br()
#' )),
#' column(4, div(
#' h4("Programmatic filter control"),
#' actionButton("button1_datetime", "set drop NA", width = "100%"), br(),
#' actionButton("button2_datetime", "set keep NA", width = "100%"), br(),
#' actionButton("button3_datetime", "set a range", width = "100%"), br(),
#' actionButton("button4_datetime", "set full range", width = "100%"), br(),
#' actionButton("button0_datetime", "set initial state", width = "100%"), br()
#' column(4, shiny::tags$div(
#' shiny::tags$h4("Programmatic filter control"),
#' actionButton("button1_datetime", "set drop NA", width = "100%"), shiny::tags$br(),
#' actionButton("button2_datetime", "set keep NA", width = "100%"), shiny::tags$br(),
#' actionButton("button3_datetime", "set a range", width = "100%"), shiny::tags$br(),
#' actionButton("button4_datetime", "set full range", width = "100%"), shiny::tags$br(),
#' actionButton("button0_datetime", "set initial state", width = "100%"), shiny::tags$br()
#' ))
#' )
#'
Expand Down Expand Up @@ -355,19 +355,19 @@ DatetimeFilterState <- R6::R6Class( # nolint
ui_input_1$children[[2]]$attribs <- c(ui_input_1$children[[2]]$attribs, list(class = "input-sm"))
ui_input_2$children[[2]]$attribs <- c(ui_input_2$children[[2]]$attribs, list(class = "input-sm"))

div(
div(
shiny::tags$div(
shiny::tags$div(
class = "flex",
ui_reset_1,
div(
shiny::tags$div(
class = "flex w-80 filter_datelike_input",
div(class = "w-45 text-center", ui_input_1),
span(
shiny::tags$div(class = "w-45 text-center", ui_input_1),
shiny::tags$span(
class = "input-group-addon w-10",
span(class = "input-group-text w-100 justify-content-center", "to"),
shiny::tags$span(class = "input-group-text w-100 justify-content-center", "to"),
title = "Times are displayed in the local timezone and are converted to UTC in the analysis"
),
div(class = "w-45 text-center", ui_input_2)
shiny::tags$div(class = "w-45 text-center", ui_input_2)
),
ui_reset_2
),
Expand Down Expand Up @@ -515,9 +515,9 @@ DatetimeFilterState <- R6::R6Class( # nolint

output$selection <- renderUI({
vals <- format(private$get_selected(), usetz = TRUE, nsmall = 3)
div(
div(icon("clock"), vals[1]),
div(span(" - "), icon("clock"), vals[2])
shiny::tags$div(
shiny::tags$div(icon("clock"), vals[1]),
shiny::tags$div(span(" - "), icon("clock"), vals[2])
)
})

Expand All @@ -536,14 +536,14 @@ DatetimeFilterState <- R6::R6Class( # nolint
min <- selected[1]
max <- selected[2]
tagList(
tags$span(
shiny::tags$span(
class = "filter-card-summary-value",
HTML(min, "&ndash;", max)
),
tags$span(
shiny::tags$span(
class = "filter-card-summary-controls",
if (private$na_count > 0) {
tags$span("NA", if (isTRUE(private$get_keep_na())) icon("check") else icon("xmark"))
shiny::tags$span("NA", if (isTRUE(private$get_keep_na())) icon("check") else icon("xmark"))
}
)
)
Expand Down
8 changes: 4 additions & 4 deletions R/FilterStateEmpty.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ EmptyFilterState <- R6::R6Class( # nolint
ui_inputs = function(id) {
ns <- NS(id)
isolate({
div(
tags$span("Variable contains missing values only"),
shiny::tags$div(
shiny::tags$span("Variable contains missing values only"),
private$keep_na_ui(ns("keep_na"))
)
})
Expand All @@ -155,7 +155,7 @@ EmptyFilterState <- R6::R6Class( # nolint
id = id,
function(input, output, session) {
output$selection <- renderUI({
tags$span("Variable contains missing values only")
shiny::tags$span("Variable contains missing values only")
})
NULL
}
Expand All @@ -166,7 +166,7 @@ EmptyFilterState <- R6::R6Class( # nolint
# Server module to display filter summary
# Doesn't render anything
content_summary = function(id) {
tags$span("All empty")
shiny::tags$span("All empty")
}
)
)
Loading
Loading