From 8e09fa10daba12a4f08b1a746fcbefb92107a11a Mon Sep 17 00:00:00 2001 From: dmpe Date: Sun, 21 Feb 2016 18:06:25 +0100 Subject: [PATCH] fixes/closes issue #125 #118 where light skins of color can be added --- R/boxes.R | 8 +++++--- R/dashboardPage.R | 8 ++++++-- R/utils.R | 8 +++++--- man/dashboardPage.Rd | 8 +++++--- man/renderMenu.Rd | 2 +- man/validStatuses.Rd | 1 + tests-manual/bigDash.R | 4 +++- 7 files changed, 26 insertions(+), 13 deletions(-) diff --git a/R/boxes.R b/R/boxes.R index c89d6632..9f6ebede 100644 --- a/R/boxes.R +++ b/R/boxes.R @@ -284,6 +284,8 @@ box <- function(..., title = NULL, footer = NULL, status = NULL, } boxToolsTag <- NULL + boxTools <- NULL + if (collapsible == TRUE || wrench == TRUE) { boxToolsTag <- TRUE } else { @@ -311,17 +313,17 @@ box <- function(..., title = NULL, footer = NULL, status = NULL, ) } - boxToolsTag <- div(class = "box-tools pull-right", + boxTools <- div(class = "box-tools pull-right", collapseTag, wrenchTag ) } headerTag <- NULL - if (!is.null(titleTag) || !is.null(boxToolsTag)) { + if (!is.null(titleTag) || !is.null(boxTools)) { headerTag <- div(class = "box-header", titleTag, - boxToolsTag + boxTools ) } diff --git a/R/dashboardPage.R b/R/dashboardPage.R index 0fdf0815..b5bbe727 100644 --- a/R/dashboardPage.R +++ b/R/dashboardPage.R @@ -8,10 +8,12 @@ #' @param title A title to display in the browser's title bar. If no value is #' provided, it will try to extract the title from the \code{dashboardHeader}. #' @param skin A color theme. One of \code{"blue"}, \code{"black"}, -#' \code{"purple"}, \code{"green"}, \code{"red"}, or \code{"yellow"}. +#' \code{"purple"}, \code{"green"}, \code{"red"}, or \code{"yellow"}. Or light +#' skin of each color, e.g. \code{"red-light"} #' #' @seealso \code{\link{dashboardHeader}}, \code{\link{dashboardSidebar}}, #' \code{\link{dashboardBody}}. +#' #' @examples #' ## Only run this example in interactive R sessions #' if (interactive()) { @@ -29,7 +31,9 @@ #' } #' @export dashboardPage <- function(header, sidebar, body, title = NULL, - skin = c("blue", "black", "purple", "green", "red", "yellow")) { + skin = c("blue", "blue-light", "black", "black-light", "purple", + "purple-light", "green", "green-light", "red", "red-light", "yellow", + "yellow-light")) { tagAssert(header, type = "header", class = "main-header") tagAssert(sidebar, type = "aside", class = "main-sidebar") diff --git a/R/utils.R b/R/utils.R index a7ea6d3b..33d7b169 100644 --- a/R/utils.R +++ b/R/utils.R @@ -83,9 +83,10 @@ validateColor <- function(color) { #' @format NULL #' #' @keywords internal -validColors <- c("red", "yellow", "aqua", "blue", "light-blue", "green", +validColors <- c("red", "yellow", "aqua", "blue", "light-blue","blue-light", + "green","black-light", "purple-light","green-light", "navy", "teal", "olive", "lime", "orange", "fuchsia", - "purple", "maroon", "black") + "purple", "maroon", "black", "red-light", "yellow-light") # Returns TRUE if a status is valid; throws error otherwise. @@ -112,13 +113,14 @@ validateStatus <- function(status) { #' \item \code{info} Blue #' \item \code{warning} Orange #' \item \code{danger} Red +#' \item \code{default} Grey #' } #' #' @usage NULL #' @format NULL #' #' @keywords internal -validStatuses <- c("primary", "success", "info", "warning", "danger") +validStatuses <- c("primary", "success", "info", "warning", "danger", "default") "%OR%" <- function(a, b) if (!is.null(a)) a else b diff --git a/man/dashboardPage.Rd b/man/dashboardPage.Rd index d8b8969a..b490bf09 100644 --- a/man/dashboardPage.Rd +++ b/man/dashboardPage.Rd @@ -4,8 +4,9 @@ \alias{dashboardPage} \title{Dashboard page} \usage{ -dashboardPage(header, sidebar, body, title = NULL, skin = c("blue", "black", - "purple", "green", "red", "yellow")) +dashboardPage(header, sidebar, body, title = NULL, skin = c("blue", + "blue-light", "black", "black-light", "purple", "purple-light", "green", + "green-light", "red", "red-light", "yellow", "yellow-light")) } \arguments{ \item{header}{A header created by \code{dashboardHeader}.} @@ -18,7 +19,8 @@ dashboardPage(header, sidebar, body, title = NULL, skin = c("blue", "black", provided, it will try to extract the title from the \code{dashboardHeader}.} \item{skin}{A color theme. One of \code{"blue"}, \code{"black"}, -\code{"purple"}, \code{"green"}, \code{"red"}, or \code{"yellow"}.} +\code{"purple"}, \code{"green"}, \code{"red"}, or \code{"yellow"}. Or light +skin of each color, e.g. \code{"red-light"}} } \description{ This creates a dashboard page for use in a Shiny app. diff --git a/man/renderMenu.Rd b/man/renderMenu.Rd index a7192167..5f78a27b 100644 --- a/man/renderMenu.Rd +++ b/man/renderMenu.Rd @@ -16,7 +16,7 @@ or a list of such objects.} is useful if you want to save an expression in a variable.} \item{func}{A function that returns a Shiny tag object, \code{\link{HTML}}, -or a list of such objects (deprecated; use \code{expr} instead).} + or a list of such objects (deprecated; use \code{expr} instead).} } \description{ Create dynamic menu output (server side) diff --git a/man/validStatuses.Rd b/man/validStatuses.Rd index 60760c80..d5102783 100644 --- a/man/validStatuses.Rd +++ b/man/validStatuses.Rd @@ -16,6 +16,7 @@ generally appear as follows: \item \code{info} Blue \item \code{warning} Orange \item \code{danger} Red + \item \code{default} Grey } } \keyword{internal} diff --git a/tests-manual/bigDash.R b/tests-manual/bigDash.R index 1fd4a3ee..53369718 100644 --- a/tests-manual/bigDash.R +++ b/tests-manual/bigDash.R @@ -211,6 +211,7 @@ body <- dashboardBody(tabItems( box( width = 4, + status = "default", background = "light-blue", p("This is content. The background color is set to light-blue") ) @@ -306,6 +307,7 @@ server <- function(input, output) { ui <- dashboardPage(header, sidebar, - body) + body, + skin = "blue-light") shinyApp(ui, server)