diff --git a/NAMESPACE b/NAMESPACE index 2044fcd..cc185b1 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -9,6 +9,7 @@ export(MNR.DB.Organisations) export(MNR.DB.Users) export(MNR.GeoPlot) export(attachResourcePaths) +export(mnrNotification) export(resourcePrefix) export(use_mnr_ui) import(dplyr) diff --git a/R/db_applications.R b/R/db_applications.R index 450a738..980b522 100644 --- a/R/db_applications.R +++ b/R/db_applications.R @@ -278,6 +278,8 @@ MNR.DB.Applications <- R6::R6Class( ) # Include user what-ifs | (user_match & organisation_id == -1 & state_whatif) + # Include organisation what-ifs + | (!user_match & organisation_match & app_submitter & state_whatif) # Admin override | (!!flag_admin & organisation_id == -1) ) %>% diff --git a/R/notification.R b/R/notification.R new file mode 100644 index 0000000..86a6227 --- /dev/null +++ b/R/notification.R @@ -0,0 +1,22 @@ + +#' Displays a shiny notification with MNR specific settings +#' +#' @inheritParams shiny::showNotification +#' @param message Character string to display in the notification +#' +#' @export +mnrNotification <- function( + message, type = "message", session = shiny::getDefaultReactiveDomain() +) { + shiny::showNotification( + message, + type = type, + duration = ifelse( + type %in% c("warning", "error"), + getOption("mnr.error_duration", 30), + getOption("mnr.notify_duration", 15) + ), + closeButton = TRUE, + session = session + ) +} diff --git a/inst/www/css/mnr-shiny.css b/inst/www/css/mnr-shiny.css index 6cd496e..63388fa 100644 --- a/inst/www/css/mnr-shiny.css +++ b/inst/www/css/mnr-shiny.css @@ -81,3 +81,7 @@ hr { opacity: 1.0; width: 2px; } + +.shiny-notification-close { + font-size: 2em !important; +} \ No newline at end of file diff --git a/man/mnrNotification.Rd b/man/mnrNotification.Rd new file mode 100644 index 0000000..c3f1dbe --- /dev/null +++ b/man/mnrNotification.Rd @@ -0,0 +1,19 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/notification.R +\name{mnrNotification} +\alias{mnrNotification} +\title{Displays a shiny notification with MNR specific settings} +\usage{ +mnrNotification(message, type, session = shiny::getDefaultReactiveDomain()) +} +\arguments{ +\item{message}{Character string to display in the notification} + +\item{type}{A string which controls the color of the notification. One of +"default" (gray), "message" (blue), "warning" (yellow), or "error" (red).} + +\item{session}{Session object to send notification to.} +} +\description{ +Displays a shiny notification with MNR specific settings +}