Skip to content

Commit

Permalink
Adapt to htmltools 0.2.1 API
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed May 31, 2014
1 parent 1cb5e09 commit eb4d4d7
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ License: GPL-3
Depends:
R (>= 2.14.1),
methods,
htmltools (>= 0.2.0)
htmltools (>= 0.2.1)
Imports:
tools,
utils,
Expand Down
10 changes: 5 additions & 5 deletions R/bootstrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bootstrapPage <- function(..., title = NULL, responsive = TRUE, theme = NULL) {
)
}

attachDependency(
attachDependencies(
tagList(
if (!is.null(title)) tags$head(tags$title(title)),
if (!is.null(theme)) {
Expand Down Expand Up @@ -762,7 +762,7 @@ selectizeIt <- function(inputId, select, options, width = NULL, nonempty = FALSE
tags$script(src = 'shared/selectize/js/selectize.min.js')
))
)
attachDependency(
attachDependencies(
tagList(
select,
tags$script(
Expand Down Expand Up @@ -1060,7 +1060,7 @@ dateInput <- function(inputId, label, value = NULL, min = NULL, max = NULL,
if (inherits(min, "Date")) min <- format(min, "%Y-%m-%d")
if (inherits(max, "Date")) max <- format(max, "%Y-%m-%d")

attachDependency(
attachDependencies(
tags$div(id = inputId,
class = "shiny-date-input",

Expand Down Expand Up @@ -1159,7 +1159,7 @@ dateRangeInput <- function(inputId, label, start = NULL, end = NULL,
if (inherits(min, "Date")) min <- format(min, "%Y-%m-%d")
if (inherits(max, "Date")) max <- format(max, "%Y-%m-%d")

attachDependency(
attachDependencies(
tags$div(id = inputId,
# input-daterange class is needed for dropdown behavior
class = "shiny-date-range-input input-daterange",
Expand Down Expand Up @@ -1619,7 +1619,7 @@ dataTableDependency <- list(
#' @rdname tableOutput
#' @export
dataTableOutput <- function(outputId) {
attachDependency(
attachDependencies(
div(id = outputId, class="shiny-datatable-output"),
dataTableDependency
)
Expand Down
2 changes: 1 addition & 1 deletion R/server.R
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ identicalFunctionBodies <- function(a, b) {
handlerManager <- HandlerManager$new()

addSubApp <- function(appObj, autoRemove = TRUE) {
path <- sprintf("/%s", createUniqueId(16))
path <- createUniqueId(16, "/app")
appHandlers <- createAppHandlers(appObj$httpHandler, appObj$serverFuncSource)

# remove the leading / from the path so a relative path is returned
Expand Down
11 changes: 8 additions & 3 deletions R/shiny.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,16 @@ NULL
#' @import htmltools httpuv caTools RJSONIO xtable digest methods
NULL

createUniqueId <- function(bytes) {
createUniqueId <- function(bytes, prefix = "", suffix = "") {
withPrivateSeed({
paste(
format(as.hexmode(sample(256, bytes, replace = TRUE)-1), width=2),
collapse = "")
prefix,
paste(
format(as.hexmode(sample(256, bytes, replace = TRUE)-1), width=2),
collapse = ""),
suffix,
sep = ""
)
})
}

Expand Down
2 changes: 1 addition & 1 deletion R/shinywrappers.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ markRenderFunction <- function(uiFunc, renderFunc) {

useRenderFunction <- function(renderFunc) {
outputFunction <- attr(renderFunc, "outputFunc")
id <- createUniqueId(8)
id <- createUniqueId(8, "out")
o <- getDefaultReactiveDomain()$output
if (!is.null(o))
o[[id]] <- renderFunc
Expand Down
2 changes: 1 addition & 1 deletion R/showcase.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ showcaseHead <- function() {
else ""
))

return(attachDependency(html, deps))
return(attachDependencies(html, deps))
}

# Returns tags containing the application metadata (title and author) in
Expand Down
2 changes: 1 addition & 1 deletion R/slider.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ slider <- function(inputId, min, max, value, step = NULL, ...,
stylesheet = "css/jquery.slider.min.css"
)
sliderFragment <- list(
attachDependency(
attachDependencies(
tags$input(
id=inputId, type="slider",
name=inputId, value=paste(value, collapse=';'), class="jslider",
Expand Down

0 comments on commit eb4d4d7

Please sign in to comment.