Skip to content

Commit 01af1e5

Browse files
committed
Add datasets_selected
1 parent 4cab9d5 commit 01af1e5

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

R/tm_front_page.R

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#' @param footnotes (`character` vector) of text to be shown at the bottom of the module, for each
1515
#' element, if named the name is shown first in bold, followed by the value.
1616
#' @param show_metadata (`logical`) indicating whether the metadata of the datasets be available on the module.
17+
#' @inheritParams tm_variable_browser
1718
#'
1819
#' @inherit shared_params return
1920
#'
@@ -69,7 +70,8 @@ tm_front_page <- function(label = "Front page",
6970
tables = list(),
7071
additional_tags = tagList(),
7172
footnotes = character(0),
72-
show_metadata = FALSE) {
73+
show_metadata = FALSE,
74+
datasets_selected = character(0L)) {
7375
message("Initializing tm_front_page")
7476

7577
# Start of assertions
@@ -79,18 +81,27 @@ tm_front_page <- function(label = "Front page",
7981
checkmate::assert_multi_class(additional_tags, classes = c("shiny.tag.list", "html"))
8082
checkmate::assert_character(footnotes, min.len = 0, any.missing = FALSE)
8183
checkmate::assert_flag(show_metadata)
84+
checkmate::assert_character(datasets_selected, min.len = 0, min.chars = 1)
85+
8286
# End of assertions
8387

8488
# Make UI args
8589
args <- as.list(environment())
90+
datanames <- if (show_metadata && length(datasets_selected) > 0L) {
91+
datasets_selected
92+
} else if (show_metadata) {
93+
"all"
94+
} else {
95+
NULL
96+
}
8697

8798
ans <- module(
8899
label = label,
89100
server = srv_front_page,
90101
ui = ui_front_page,
91102
ui_args = args,
92103
server_args = list(tables = tables, show_metadata = show_metadata),
93-
datanames = if (show_metadata) "all" else NULL
104+
datanames = datanames
94105
)
95106
attr(ans, "teal_bookmarkable") <- TRUE
96107
ans

man/tm_front_page.Rd

Lines changed: 7 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)