-
Notifications
You must be signed in to change notification settings - Fork 97
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
Add labels option to calendar range #375
base: ryszard.support_for_calendar_ranges
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,15 @@ | |
#' @param end_placeholder Text visible in the end calendar input when nothing is inputted. | ||
#' @param min Minimum allowed value in both calendars. | ||
#' @param max Maximum allowed value in both calendars. | ||
#' @param start_label Label text in the start calendar. | ||
#' @param end_label Label text in the end calendar. | ||
#' | ||
#' @rdname calendar_range | ||
#' @export | ||
#' | ||
calendar_range <- function(input_id, type = "date", start_value = NULL, end_value = NULL, | ||
start_placeholder = NULL, end_placeholder = NULL, min = NA, max = NA) { | ||
start_placeholder = NULL, end_placeholder = NULL, min = NA, max = NA, | ||
start_label = NULL, end_label = NULL) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've checked that in the majority of inputs we keep the order of arguments the same as in basic shiny inputs, this is: id, label, value/choices. How about putting the labels after the input_id argument? |
||
if (!is.null(start_value)) start_value <- format(as.Date(start_value), "%Y/%m/%d") | ||
if (!is.null(end_value)) end_value <- format(as.Date(end_value), "%Y/%m/%d") | ||
if (!is.na(min)) min <- format(as.Date(min), "%Y/%m/%d") | ||
|
@@ -73,10 +76,12 @@ calendar_range <- function(input_id, type = "date", start_value = NULL, end_valu | |
class = "two fields", | ||
div( | ||
class = "field", | ||
tags$label(start_label), | ||
start_cal_widget | ||
), | ||
div( | ||
class = "field", | ||
tags$label(end_label), | ||
end_cal_widget | ||
) | ||
) | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about changing the descriptions to 'Label to be displayed with the start calendar' and 'Label to be displayed with the end calendar'?