Skip to content

Commit

Permalink
fix: evaluating asis parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
federiva committed Apr 27, 2023
1 parent d637450 commit dcd9ab3
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions R/modal.R
Expand Up @@ -278,15 +278,17 @@ attach_rule <- function(id, behavior, target, value) {
#' @param session The \code{session} object passed to function given to
#' \code{shinyServer}.
#' @param asis A boolean indicating if the id must be handled as is (TRUE) or
#' will be it must be namespaced (FALSE)
#' FALSE if it meants to be namespaced
#' @seealso modal
#'
#' @rdname show_modal
#'
#' @export
show_modal <- function(id, session = shiny::getDefaultReactiveDomain(),
asis = TRUE) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
if (!asis) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
}
session$sendCustomMessage("showSemanticModal", list(id = id, action = "show")) # nolint
}

Expand All @@ -299,7 +301,9 @@ showModal <- function(ui, session = shiny::getDefaultReactiveDomain()) {
#' @export
remove_modal <- function(id, session = shiny::getDefaultReactiveDomain(),
asis = TRUE) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
if (!asis) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
}
shiny::removeUI(paste0("#", id))
}

Expand All @@ -320,6 +324,8 @@ removeModal <- function(session = shiny::getDefaultReactiveDomain()) {
#' @export
hide_modal <- function(id, session = shiny::getDefaultReactiveDomain(),
asis = TRUE) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
if (!asis) {
id <- ifelse(inherits(session, "session_proxy"), session$ns(id), id)
}
session$sendCustomMessage("showSemanticModal", list(id = id, action = "hide")) # nolint
}

0 comments on commit dcd9ab3

Please sign in to comment.