From 1f62ac8c4643b1f8ff63ae3f83196244000070e2 Mon Sep 17 00:00:00 2001 From: Dominik Krzeminski Date: Thu, 3 Dec 2020 11:17:00 +0000 Subject: [PATCH 1/3] default view does not get hidden by default --- R/router.R | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/R/router.R b/R/router.R index 4d611bd..3b65f93 100644 --- a/R/router.R +++ b/R/router.R @@ -7,18 +7,25 @@ ROUTER_UI_ID <- '_router_ui' #' with 'router-hidden' class is added. #' #' @param ui Single page UI content created with proper html tags or tag list. -#' @param path Single page path name. Attached to \code{data-path} attriubute. -attach_attribs <- function(ui, path) { +#' @param path Single page path name. Attached to \code{data-path} attribute. +#' @param not_hidden character with default page that is not hidden by default. +attach_attribs <- function(ui, path, not_hidden = "/") { if ("shiny.tag" %in% class(ui)) { # make pages identification easier ui$attribs$`data-path` <- path - ui$attribs$class <- paste("router router-hidden", ui$attribs$class) + if (path == not_hidden) + ui$attribs$class <- paste("router", ui$attribs$class) + else + ui$attribs$class <- paste("router router-hidden", ui$attribs$class) } if ("shiny.tag.list" %in% class(ui)) { # make pages identification easier container <- shiny::div(ui) container$attribs$`data-path` <- path - container$attribs$class <- "router router-hidden" + if (path == not_hidden) + container$attribs$class <- "router" + else + container$attribs$class <- "router router-hidden" ui <- container } ui From 9fab4606dc8b5c4f02cd41cb79fc5d758d48b043 Mon Sep 17 00:00:00 2001 From: Dominik Krzeminski Date: Fri, 11 Dec 2020 10:47:25 +0000 Subject: [PATCH 2/3] option for control of default not hidden display added --- R/router.R | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/R/router.R b/R/router.R index 3b65f93..d8512b9 100644 --- a/R/router.R +++ b/R/router.R @@ -9,7 +9,12 @@ ROUTER_UI_ID <- '_router_ui' #' @param ui Single page UI content created with proper html tags or tag list. #' @param path Single page path name. Attached to \code{data-path} attribute. #' @param not_hidden character with default page that is not hidden by default. +#' this can be controlled globally by option \code{router.default.display} set +#' to the default view of the app. attach_attribs <- function(ui, path, not_hidden = "/") { + option_not_hidden <- getOption("router_default_display") + if (!is.null(option_not_hidden)) + not_hidden <- option_not_hidden if ("shiny.tag" %in% class(ui)) { # make pages identification easier ui$attribs$`data-path` <- path From 4266cdd2c52098ab235e86b1653dafb6d4fa1b81 Mon Sep 17 00:00:00 2001 From: Dominik Krzeminski Date: Fri, 11 Dec 2020 10:57:46 +0000 Subject: [PATCH 3/3] docs fixed for attach_attribs --- R/router.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/router.R b/R/router.R index d8512b9..5955579 100644 --- a/R/router.R +++ b/R/router.R @@ -9,7 +9,7 @@ ROUTER_UI_ID <- '_router_ui' #' @param ui Single page UI content created with proper html tags or tag list. #' @param path Single page path name. Attached to \code{data-path} attribute. #' @param not_hidden character with default page that is not hidden by default. -#' this can be controlled globally by option \code{router.default.display} set +#' this can be controlled globally by option \code{router_default_display} set #' to the default view of the app. attach_attribs <- function(ui, path, not_hidden = "/") { option_not_hidden <- getOption("router_default_display")