allow pullLeft/Right functions to take tags or lists of tags; validate that all inputs are tags

This commit is contained in:
JJ Allaire
2013-12-12 06:02:31 -05:00
parent e4b8e08e89
commit 80e992a9fc

View File

@@ -299,7 +299,9 @@ horizontalLayout <- function(...) {
#' @rdname horizontalLayout
#' @export
pullLeft <- function(...) {
lapply(list(...), function(element) {
lapply(flattenTags(list(...)), function(element) {
if (!isTag(element))
stop("pullLeft - passed argument not a shiny UI element", call. = FALSE)
element$attribs$class <- paste(element$attribs$class, "pull-left")
element
})
@@ -308,13 +310,14 @@ pullLeft <- function(...) {
#' @rdname horizontalLayout
#' @export
pullRight <- function(...) {
lapply(list(...), function(element) {
lapply(flattenTags(list(...)), function(element) {
if (!isTag(element))
stop("pullRight - passed argument not a shiny UI element", call. = FALSE)
element$attribs$class <- paste(element$attribs$class, "pull-right")
element
})
}
# Helper function to test whether an element has a span class
validateSpan <- function(element, name, width = NA) {