# [shiny alerts] utils functions
#' alert_no_code
#'
#' @importFrom shinyalert shinyalert
alert_no_code <- function() {
shinyalert(
title = "Oops !",
text = "maybe you should write some code before to run !",
closeOnEsc = TRUE,
closeOnClickOutside = TRUE
)
}
#' alert_forbidden_fun
#'
#' @importFrom shinyalert shinyalert
alert_forbidden_fun <- function() {
shinyalert(
title = "Sorry !",
text = "you are trying something not expected !",
type = "warning",
closeOnEsc = TRUE,
closeOnClickOutside = TRUE
)
}
#' alert_error_msg
#'
#' @param error an error message to print
#' @importFrom shinyalert shinyalert
#' @importFrom shiny pre
alert_error_msg <- function(error) {
shinyalert(
title = "Stop ! \n An error occured :",
text = error,
type = "error",
closeOnEsc = TRUE,
closeOnClickOutside = TRUE,
className = "error"
)
}
#' ilovesqlnstructor
#' Easter egg - just fun
#'
#' @importFrom shinyalert shinyalert
ilovesqlnstructor <- function() {
shinyalert(
title = "oh yes, you found it ! \n you're the best",
imageUrl = "https://media.giphy.com/media/nEMmyUp4hl1QOzovKh/giphy.gif",
imageWidth = 350,
imageHeight = 250,
closeOnEsc = TRUE,
closeOnClickOutside = TRUE
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.