Skip to content

Commit

Permalink
445 unify html tags (#566)
Browse files Browse the repository at this point in the history
fixes #445

---------

Co-authored-by: André Veríssimo <[email protected]>
  • Loading branch information
kartikeyakirar and averissimo authored Mar 18, 2024
1 parent 53b556b commit 9f5c068
Show file tree
Hide file tree
Showing 28 changed files with 311 additions and 311 deletions.
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(
tags$div(
id = id,
class = "panel filter-card",
include_js_files("count-bar-labels.js"),
div(
tags$div(
class = "filter-card-header",
`data-toggle` = "collapse",
`data-bs-toggle` = "collapse",
href = paste0("#", ns("body")),
div(
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(
tags$div(class = "filter-card-varname", tags$strong(private$get_varname())),
tags$div(class = "filter-card-varlabel", private$get_varlabel()),
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")))
tags$div(class = "filter-card-summary", private$ui_summary(ns("summary")))
),
div(
tags$div(
id = ns("body"),
class = "collapse out",
`data-parent` = paste0("#", parent_id),
`data-bs-parent` = paste0("#", parent_id),
div(
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(
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 = 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(
tags$div(
uiOutput(ns("trigger_visible"), inline = TRUE),
ui_input
)
Expand Down
36 changes: 18 additions & 18 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, tags$div(
#' 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, tags$div(
#' tags$h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_choices"), tags$br(),
#' tags$h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_choices"), tags$br(),
#' tags$h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_choices"), 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, tags$div(
#' tags$h4("Programmatic filter control"),
#' actionButton("button1_choices", "set drop NA", width = "100%"), tags$br(),
#' actionButton("button2_choices", "set keep NA", width = "100%"), tags$br(),
#' actionButton("button3_choices", "set selection: a, b", width = "100%"), tags$br(),
#' actionButton("button4_choices", "deselect all", width = "100%"), tags$br(),
#' actionButton("button0_choices", "set initial state", width = "100%"), tags$br()
#' ))
#' )
#'
Expand Down Expand Up @@ -374,7 +374,7 @@ ChoicesFilterState <- R6::R6Class( # nolint
countsnow = countsnow,
countsmax = countsmax
)
div(
tags$div(
class = "choices_state",
if (private$is_multiple()) {
checkboxGroupInput(
Expand Down Expand Up @@ -416,7 +416,7 @@ ChoicesFilterState <- R6::R6Class( # nolint
)
)
}
div(
tags$div(
uiOutput(ns("trigger_visible")),
ui_input,
private$keep_na_ui(ns("keep_na"))
Expand Down
44 changes: 22 additions & 22 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, tags$div(
#' tags$h4("DateFilterState"),
#' fs$ui("fs")
#' )),
#' column(4, div(
#' column(4, 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()
#' tags$h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_date"), tags$br(),
#' tags$h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_date"), tags$br(),
#' tags$h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_date"), 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, tags$div(
#' tags$h4("Programmatic filter control"),
#' actionButton("button1_date", "set drop NA", width = "100%"), tags$br(),
#' actionButton("button2_date", "set keep NA", width = "100%"), tags$br(),
#' actionButton("button3_date", "set a range", width = "100%"), tags$br(),
#' actionButton("button4_date", "set full range", width = "100%"), tags$br(),
#' actionButton("button0_date", "set initial state", width = "100%"), tags$br()
#' ))
#' )
#'
Expand Down Expand Up @@ -278,16 +278,16 @@ DateFilterState <- R6::R6Class( # nolint
ui_inputs = function(id) {
ns <- NS(id)
isolate({
div(
div(
tags$div(
tags$div(
class = "flex",
actionButton(
class = "date_reset_button",
inputId = ns("start_date_reset"),
label = NULL,
icon = icon("fas fa-undo")
),
div(
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])
tags$div(
tags$div(icon("calendar-days"), vals[1]),
tags$div(span(" - "), icon("calendar-days"), vals[2])
)
})

Expand Down
52 changes: 26 additions & 26 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, tags$div(
#' tags$h4("DatetimeFilterState"),
#' fs$ui("fs")
#' )),
#' column(4, div(
#' column(4, 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()
#' tags$h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_datetime"), tags$br(),
#' tags$h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_datetime"), tags$br(),
#' tags$h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_datetime"), 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, tags$div(
#' tags$h4("Programmatic filter control"),
#' actionButton("button1_datetime", "set drop NA", width = "100%"), tags$br(),
#' actionButton("button2_datetime", "set keep NA", width = "100%"), tags$br(),
#' actionButton("button3_datetime", "set a range", width = "100%"), tags$br(),
#' actionButton("button4_datetime", "set full range", width = "100%"), tags$br(),
#' actionButton("button0_datetime", "set initial state", width = "100%"), 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(
tags$div(
tags$div(
class = "flex",
ui_reset_1,
div(
tags$div(
class = "flex w-80 filter_datelike_input",
div(class = "w-45 text-center", ui_input_1),
span(
tags$div(class = "w-45 text-center", ui_input_1),
tags$span(
class = "input-group-addon w-10",
span(class = "input-group-text w-100 justify-content-center", "to"),
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)
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])
tags$div(
tags$div(icon("clock"), vals[1]),
tags$div(span(" - "), icon("clock"), vals[2])
)
})

Expand Down
2 changes: 1 addition & 1 deletion R/FilterStateEmpty.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ EmptyFilterState <- R6::R6Class( # nolint
ui_inputs = function(id) {
ns <- NS(id)
isolate({
div(
tags$div(
tags$span("Variable contains missing values only"),
private$keep_na_ui(ns("keep_na"))
)
Expand Down
24 changes: 12 additions & 12 deletions R/FilterStateExpr.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
#' useShinyjs(),
#' include_css_files(pattern = "filter-panel"),
#' include_js_files(pattern = "count-bar-labels"),
#' column(4, div(
#' h4("ChoicesFilterState"),
#' column(4, tags$div(
#' tags$h4("ChoicesFilterState"),
#' filter_state$ui("fs")
#' )),
#' column(8, 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(8, tags$div(
#' tags$h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_choices"), tags$br(),
#' tags$h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_choices"), tags$br(),
#' tags$h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_choices"), tags$br()
#' ))
#' )
#'
Expand Down Expand Up @@ -204,9 +204,9 @@ FilterStateExpr <- R6::R6Class( # nolint
} else {
icon("lock", class = "filter-card-icon")
},
div(class = "filter-card-varname", tags$strong(private$teal_slice$id)),
div(class = "filter-card-varlabel", private$teal_slice$title),
div(
tags$div(class = "filter-card-varname", tags$strong(private$teal_slice$id)),
tags$div(class = "filter-card-varlabel", private$teal_slice$title),
tags$div(
class = "filter-card-controls",
if (isFALSE(private$is_anchored())) {
actionLink(
Expand Down
34 changes: 17 additions & 17 deletions R/FilterStateLogical.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@
#' useShinyjs(),
#' include_css_files(pattern = "filter-panel"),
#' include_js_files(pattern = "count-bar-labels"),
#' column(4, div(
#' h4("LogicalFilterState"),
#' column(4, tags$div(
#' tags$h4("LogicalFilterState"),
#' fs$ui("fs")
#' )),
#' column(4, div(
#' column(4, 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_logical"), br(),
#' h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_logical"), br(),
#' h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_logical"), br()
#' tags$h4("Condition (i.e. call)"), # display the condition call generated by this FilterState
#' textOutput("condition_logical"), tags$br(),
#' tags$h4("Unformatted state"), # display raw filter state
#' textOutput("unformatted_logical"), tags$br(),
#' tags$h4("Formatted state"), # display human readable filter state
#' textOutput("formatted_logical"), tags$br()
#' )),
#' column(4, div(
#' h4("Programmatic filter control"),
#' actionButton("button1_logical", "set drop NA", width = "100%"), br(),
#' actionButton("button2_logical", "set keep NA", width = "100%"), br(),
#' actionButton("button3_logical", "set a selection", width = "100%"), br(),
#' actionButton("button0_logical", "set initial state", width = "100%"), br()
#' column(4, tags$div(
#' tags$h4("Programmatic filter control"),
#' actionButton("button1_logical", "set drop NA", width = "100%"), tags$br(),
#' actionButton("button2_logical", "set keep NA", width = "100%"), tags$br(),
#' actionButton("button3_logical", "set a selection", width = "100%"), tags$br(),
#' actionButton("button0_logical", "set initial state", width = "100%"), tags$br()
#' ))
#' )
#'
Expand Down Expand Up @@ -272,8 +272,8 @@ LogicalFilterState <- R6::R6Class( # nolint
width = "100%"
)
}
div(
div(
tags$div(
tags$div(
class = "choices_state",
uiOutput(ns("trigger_visible"), inline = TRUE),
ui_input
Expand Down
Loading

0 comments on commit 9f5c068

Please sign in to comment.