Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing top message for dropdownMenus #165

Closed
federicomarini opened this issue Nov 21, 2016 · 1 comment
Closed

Changing top message for dropdownMenus #165

federicomarini opened this issue Nov 21, 2016 · 1 comment
Assignees

Comments

@federicomarini
Copy link

federicomarini commented Nov 21, 2016

I have one request, about the function
shinydashboard::dropdownMenu

function (..., type = c("messages", "notifications", "tasks"),
 badgeStatus = "primary", icon = NULL, .list = NULL)
{
 type <- match.arg(type)
 if (!is.null(badgeStatus))
 validateStatus(badgeStatus)
 items <- c(list(...), .list)
 lapply(items, tagAssert, type = "li")
 dropdownClass <- paste0("dropdown ", type, "-menu")
 if (is.null(icon)) {
 icon <- switch(type, messages = shiny::icon("envelope"),
 notifications = shiny::icon("warning"), tasks = shiny::icon("tasks"))
 }
 numItems <- length(items)
 if (is.null(badgeStatus)) {
 badge <- NULL
 }
 else {
 badge <- span(class = paste0("label label-", badgeStatus),
 numItems)
 }
 tags$li(class = dropdownClass, a(href = "#", class = "dropdown-toggle",
 `data-toggle` = "dropdown", icon, badge), tags$ul(class = "dropdown-menu",
 tags$li(class = "header", paste("You have", numItems,
 type)), tags$li(tags$ul(class = "menu", items))))
}
<environment: namespace:shinydashboard>

Would it be possible to change the behavior of the part in bold and allow the user to provide a custom message for that in a separate parameter?
I can always override the function to do that, but I feel more comfortable if you can deal with it.

Something like...

function (.., type = c("messages", "notifications", "tasks"),
 badgeStatus = "primary", icon = NULL, .list = NULL, top_msg = NULL)
{
 ...
 tags$li(class = dropdownClass, a(href = "#", class = "dropdown-toggle",`data-toggle` = "dropdown", icon, badge), tags$ul(class = "dropdown-menu", style = dropdown_style, tags$li(class = "header", top_msg), tags$li(tags$ul(class = "menu", style = "list-style-type: none;max-height: 800px;", items))))
}

Thank you in advance for the time considering this idea!
Federico

@schmate
Copy link

schmate commented Apr 24, 2017

This feature would be very welcome by me also - it's needed for creative utilization of the dropdown menu element as much as for building non-English dashboards.

bborgesr added a commit that referenced this issue Apr 26, 2017
… the `dropdownMenu()` function. If provided by the user, this text (instead of the default) will be shown on the header of the menu (only visible when the menu is expanded).
@bborgesr bborgesr self-assigned this Apr 26, 2017
@wch wch closed this as completed in #207 Apr 26, 2017
wch pushed a commit that referenced this issue Apr 26, 2017
… the `dropdownMenu()` function. If provided by the user, this text (instead of the default) will be shown on the header of the menu (only visible when the menu is expanded).
@wch wch removed the in progress label Apr 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants