Skip to content

Commit

Permalink
271: Removed dataset name displayed in dropdown menus (#279)
Browse files Browse the repository at this point in the history
fixes: #271

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
kartikeyakirar and github-actions[bot] authored Jun 6, 2024
1 parent e7b4cc5 commit f52dd20
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 8 deletions.
4 changes: 2 additions & 2 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@ ui_g_boxplot <- function(id, ...) {
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = a$trt_group$choices,
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
uiOutput(ns("axis_selections")),
teal.widgets::optionalSelectInput(
ns("facet_var"),
label = "Facet by",
choices = a$facet_var$choices,
choices = get_choices(a$facet_var$choices),
selected = a$facet_var$selected,
multiple = FALSE
),
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ ui_g_correlationplot <- function(id, ...) {
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = a$trt_group$choices,
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_gh_density_distribution_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ ui_g_density_distribution_plot <- function(id, ...) {
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = a$trt_group$choices,
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_gh_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ ui_lineplot <- function(id, ...) {
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = a$trt_group$choices,
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
Expand Down Expand Up @@ -380,7 +380,7 @@ srv_lineplot <- function(id,
output$shape_ui <- renderUI({
if (!is.null(shape_choices)) {
if (methods::is(shape_choices, "choices_selected")) {
choices <- shape_choices$choices
choices <- get_choices(shape_choices$choices)
selected <- shape_choices$selected
} else {
choices <- shape_choices
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_gh_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ ui_g_scatterplot <- function(id, ...) {
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = a$trt_group$choices,
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_gh_spaghettiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ g_ui_spaghettiplot <- function(id, ...) {
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = a$trt_group$choices,
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
Expand Down
17 changes: 17 additions & 0 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,20 @@ report_card_template_goshawk <- function(title,
)
card
}

#' Get Choices
#'
#' This function returns choices based on the class of the input.
#' If the input is of class `delayed_data`, it returns the `subset` of the input.
#' Otherwise, it returns the input as is.
#'
#' @param choices An object that contains choices.
#' @return A vector of choices.
#' @keywords internal
get_choices <- function(choices) {
if (inherits(choices, "delayed_data")) {
choices$subset
} else {
choices
}
}
20 changes: 20 additions & 0 deletions man/get_choices.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f52dd20

Please sign in to comment.