Skip to content

Commit 137576c

Browse files
committed
squash several last commits into one because there are just many of them
1 parent d1f9293 commit 137576c

File tree

4 files changed

+21
-11
lines changed

4 files changed

+21
-11
lines changed

R/boxes.R

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ infoBox <- function(title, value = NULL, subtitle = NULL,
120120
#' @param collapsed If TRUE, start collapsed. This must be used with
121121
#' \code{collapsible=TRUE}.
122122
#' @param ... Contents of the box.
123-
#' @param wrench Adds a dropdown menu
123+
#' @param wrench Adds a dropdown menu. By default it does not (false).
124+
#' @param wrenchOptions Add menu items to the wrench icon. This must be used with
125+
#' \code{wrench=TRUE}. Can be also a \code{list(...)} of \code{tags$li(...)}.
124126
#'
125127
#' @family boxes
126128
#'
@@ -251,7 +253,8 @@ infoBox <- function(title, value = NULL, subtitle = NULL,
251253
#' @export
252254
box <- function(..., title = NULL, footer = NULL, status = NULL,
253255
solidHeader = FALSE, background = NULL, width = 6,
254-
height = NULL, collapsible = FALSE, collapsed = FALSE, wrench = FALSE, wrenchOptions = NULL) {
256+
height = NULL, collapsible = FALSE, collapsed = FALSE,
257+
wrench = FALSE, wrenchOptions = NULL) {
255258

256259
boxClass <- "box"
257260
if (solidHeader || !is.null(background)) {
@@ -281,6 +284,8 @@ box <- function(..., title = NULL, footer = NULL, status = NULL,
281284
}
282285

283286
boxToolsTag <- NULL
287+
boxTools <- NULL
288+
284289
if (collapsible == TRUE || wrench == TRUE) {
285290
boxToolsTag <- TRUE
286291
} else {
@@ -296,29 +301,29 @@ box <- function(..., title = NULL, footer = NULL, status = NULL,
296301
collapseIcon <- if (collapsed) "plus" else "minus"
297302

298303
if (collapsible == TRUE) {
299-
collapseTag <- tags$button(class = paste0("btn btn-box-tool"), `data-widget` = "collapse", shiny::icon(collapseIcon))
304+
collapseTag <- tags$button(class = paste0("btn btn-box-tool"),
305+
`data-widget` = "collapse", shiny::icon(collapseIcon))
300306
}
301307

302308
if (wrench == TRUE) {
303309
wrenchTag <- div(class = paste0("btn-group"),
304310
tags$button(class = "btn btn-box-tool dropdown-toggle", `type` = "button",
305311
`data-toggle` = "dropdown", shiny::icon("wrench")),
306312
tags$ul(class = "dropdown-menu", `role` = "menu", wrenchOptions)
307-
## TODO: how to display them ?
308313
)
309314
}
310315

311-
boxToolsTag <- div(class = "box-tools pull-right",
316+
boxTools <- div(class = "box-tools pull-right",
312317
collapseTag,
313318
wrenchTag
314319
)
315320
}
316321

317322
headerTag <- NULL
318-
if (!is.null(titleTag) || !is.null(boxToolsTag)) {
323+
if (!is.null(titleTag) || !is.null(boxTools)) {
319324
headerTag <- div(class = "box-header",
320325
titleTag,
321-
boxToolsTag
326+
boxTools
322327
)
323328
}
324329

man/box.Rd

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/renderMenu.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests-manual/box.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ body <- dashboardBody(
4242
)
4343
),
4444
box(title = "Histogram box title",
45-
status = "warning", solidHeader = TRUE, collapsible = F, wrench = T, wrenchOptions = tags$li(a(href="https://google.cz", "Click here!")),
45+
status = "info", solidHeader = TRUE, collapsible = F, wrench = T,
46+
wrenchOptions = list(tags$li(a(href="https://google.cz", "google czech",style="color: red", target="_blank")),
47+
tags$li(a(href="https://www.polygon.com", "polygon!",style="color: yellow", target="_blank"))),
4648
plotOutput("plot", height = 250)
4749
)
4850
),
@@ -165,7 +167,7 @@ header <- dashboardHeader(
165167
shinyApp(
166168
ui = dashboardPage(
167169
header,
168-
dashboardSidebar(),
170+
dashboardSidebar(disable = T),
169171
body
170172
),
171173
server = server

0 commit comments

Comments
 (0)