mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Pull out bootstrapLib into separate function
This commit is contained in:
@@ -39,6 +39,7 @@ export(addResourcePath)
|
||||
export(animationOptions)
|
||||
export(as.shiny.appobj)
|
||||
export(basicPage)
|
||||
export(bootstrapLib)
|
||||
export(bootstrapPage)
|
||||
export(br)
|
||||
export(browserViewer)
|
||||
|
||||
@@ -33,26 +33,6 @@ bootstrapPage <- function(..., title = NULL, responsive = NULL, theme = NULL) {
|
||||
shinyDeprecated("The 'responsive' argument is no longer used with Bootstrap 3.")
|
||||
}
|
||||
|
||||
# required head tags for boostrap
|
||||
importBootstrap <- function() {
|
||||
list(
|
||||
htmlDependency("bootstrap", "3.3.5",
|
||||
c(
|
||||
href = "shared/bootstrap",
|
||||
file = system.file("www/shared/bootstrap", package = "shiny")
|
||||
),
|
||||
script = c(
|
||||
"js/bootstrap.min.js",
|
||||
# These shims are necessary for IE 8 compatibility
|
||||
"shim/html5shiv.min.js",
|
||||
"shim/respond.min.js"
|
||||
),
|
||||
stylesheet = if (is.null(theme)) "css/bootstrap.min.css",
|
||||
meta = list(viewport = "width=device-width, initial-scale=1")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
attachDependencies(
|
||||
tagList(
|
||||
if (!is.null(title)) tags$head(tags$title(title)),
|
||||
@@ -63,7 +43,41 @@ bootstrapPage <- function(..., title = NULL, responsive = NULL, theme = NULL) {
|
||||
# remainder of tags passed to the function
|
||||
list(...)
|
||||
),
|
||||
importBootstrap()
|
||||
bootstrapDependency()
|
||||
)
|
||||
}
|
||||
|
||||
#' Bootstrap libraries
|
||||
#'
|
||||
#' This function returns a set of web dependencies necessary for using Bootstrap
|
||||
#' components in a web page.
|
||||
#'
|
||||
#' It isn't necessary to call this function if you use
|
||||
#' \code{\link{bootstrapPage}} or others which use \code{bootstrapPage}, such
|
||||
#' \code{\link{basicPage}}, \code{\link{fluidPage}}, \code{\link{fillPage}},
|
||||
#' \code{\link{pageWithSidebar}}, and \code{\link{navbarPage}}, because they
|
||||
#' already include the Bootstrap web dependencies.
|
||||
#'
|
||||
#' @inheritParams bootstrapPage
|
||||
#' @export
|
||||
bootstrapLib <- function(theme = NULL) {
|
||||
attachDependencies(tagList(), bootstrapDependency(theme))
|
||||
}
|
||||
|
||||
bootstrapDependency <- function(theme = NULL) {
|
||||
htmlDependency("bootstrap", "3.3.5",
|
||||
c(
|
||||
href = "shared/bootstrap",
|
||||
file = system.file("www/shared/bootstrap", package = "shiny")
|
||||
),
|
||||
script = c(
|
||||
"js/bootstrap.min.js",
|
||||
# These shims are necessary for IE 8 compatibility
|
||||
"shim/html5shiv.min.js",
|
||||
"shim/respond.min.js"
|
||||
),
|
||||
stylesheet = if (is.null(theme)) "css/bootstrap.min.css",
|
||||
meta = list(viewport = "width=device-width, initial-scale=1")
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
24
man/bootstrapLib.Rd
Normal file
24
man/bootstrapLib.Rd
Normal file
@@ -0,0 +1,24 @@
|
||||
% Generated by roxygen2: do not edit by hand
|
||||
% Please edit documentation in R/bootstrap.R
|
||||
\name{bootstrapLib}
|
||||
\alias{bootstrapLib}
|
||||
\title{Bootstrap libraries}
|
||||
\usage{
|
||||
bootstrapLib(theme = NULL)
|
||||
}
|
||||
\arguments{
|
||||
\item{theme}{Alternative Bootstrap stylesheet (normally a css file within the
|
||||
www directory, e.g. \code{www/bootstrap.css})}
|
||||
}
|
||||
\description{
|
||||
This function returns a set of web dependencies necessary for using Bootstrap
|
||||
components in a web page.
|
||||
}
|
||||
\details{
|
||||
It isn't necessary to call this function if you use
|
||||
\code{\link{bootstrapPage}} or others which use \code{bootstrapPage}, such
|
||||
\code{\link{basicPage}}, \code{\link{fluidPage}}, \code{\link{fillPage}},
|
||||
\code{\link{pageWithSidebar}}, and \code{\link{navbarPage}}, because they
|
||||
already include the Bootstrap web dependencies.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user