Skip to content

Commit

Permalink
will fix #349
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Jun 5, 2023
1 parent 49c1bf3 commit 82b7f3d
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 8 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# bs4Dash 2.2.2.9000

## Bug fixes
- Fix #349: allow to pass list of `accordionItem()` with `.list` parameter in `accordion()`. Thanks @vladimirstroganov for reporting.
- Fix #330: allow to use input elements (or any not `menuItem` element) in the sidebar.
- Fix #343: Refine `help` parameter behavior in `dashboardPage()`. If NULL, no icon is shown. If FALSE, icon and toggle are shown but not checked. If TRUE the toggle is checked.

Expand Down
28 changes: 24 additions & 4 deletions R/useful-items.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ bs4Badge <- function(..., color, position = c("left", "right"),
#' @param ... slot for \link{accordionItem}.
#' @param id Unique accordion id.
#' @param width The width of the accordion.
#' @param .list To pass \link{accordionItem} within a list.
#'
#' @author David Granjon, \email{dgranjon@@ymail.com}
#' @rdname accordion
Expand Down Expand Up @@ -111,18 +112,37 @@ bs4Badge <- function(..., color, position = c("left", "right"),
#' collapsed = FALSE,
#' "This is some text!"
#' )
#' )
#' ),
#' accordion(
#' id = "accordion_dynamic",
#' .list = lapply(
#' 1:2,
#' function(i)
#' accordionItem(
#' title = paste('Accordion 1 Item', i),
#' status = "danger",
#' collapsed = ifelse (i == 1, TRUE, FALSE),
#' "This is some text!"
#' )
#' )
#' )
#' ),
#' title = "Accordion"
#' ),
#' server = function(input, output) { }
#' server = function(input, output) {
#' observe({
#' print(input$accordion1)
#' print(input$accordion2)
#' print(input$accordion_dynamic)
#' })
#' }
#' )
#' }
#'
#' @export
bs4Accordion <- function(..., id, width = 12) {
bs4Accordion <- function(..., id, width = 12, .list = NULL) {

items <- list(...)
items <- c(list(...), .list)

# patch that enables a proper accordion behavior
# we add the data-parent non standard attribute to each
Expand Down
29 changes: 25 additions & 4 deletions man/accordion.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 82b7f3d

Please sign in to comment.