-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
…lude
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#' DfE bookmark include | ||
#' | ||
#' @description | ||
#' This function allows for a whitelist of included inputs | ||
#' for bookmarking | ||
#' | ||
#' @param bookmarkingWhitelist list of inputs to include in bookmark | ||
#' @return a bookmark with relevant inputs included | ||
#' | ||
#' @export | ||
#' @examples | ||
#' # You will need a line such as this in your global.R script ================ | ||
#' bookmarkingWhitelist <- c("navlistPanel", "tabsetpanels") | ||
#' | ||
#' # In the server.R script =================================================== | ||
#' shiny::observe({ | ||
#' setBookmarkInclude(bookmarkingWhitelist) | ||
#' }) | ||
#' | ||
#' observe({ | ||
#' # Trigger this observer every time an input changes | ||
#' reactiveValuesToList(input) | ||
#' session$doBookmark() | ||
#' }) | ||
#' | ||
#' onBookmarked(function(url) { | ||
#' updateQueryString(url) | ||
#' }) | ||
setBookmarkInclude <- function(bookmarkingWhitelist){ | ||
Check notice Code scanning / lintr Variable and function name style should match snake_case or symbols. Note
Variable and function name style should match snake_case or symbols.
Check notice Code scanning / lintr Variable and function name style should match snake_case or symbols. Note
Variable and function name style should match snake_case or symbols.
Check notice Code scanning / lintr There should be a space before an opening curly brace. Note
There should be a space before an opening curly brace.
Check notice Code scanning / lintr There should be a space between a right parenthesis and a body expression. Note
There should be a space between a right parenthesis and a body expression.
|
||
# exclude the white list from complete list | ||
toExclude <- setdiff(names(input), bookmarkingWhitelist) | ||
Check notice Code scanning / lintr Variable and function name style should match snake_case or symbols. Note
Variable and function name style should match snake_case or symbols.
Check warning Code scanning / lintr no visible binding for global variable 'input' Warning
no visible binding for global variable 'input'
|
||
|
||
# print to log for testing | ||
# print(paste("ExcludedIDs:", paste(toExclude, collapse = ", "))) | ||
Check notice Code scanning / lintr Commented code should be removed. Note
Commented code should be removed.
|
||
|
||
# exclude all remaining inputs from bookmark | ||
setBookmarkExclude(toExclude) | ||
Check warning Code scanning / lintr no visible global function definition for 'setBookmarkExclude' Warning
no visible global function definition for 'setBookmarkExclude'
|
||
|
||
print('bookmarked') | ||
Check notice Code scanning / lintr Only use double-quotes. Note
Only use double-quotes.
|
||
# Trigger bookmarking whenever relevant inputs change | ||
session$doBookmark() | ||
Check warning Code scanning / lintr no visible binding for global variable 'session' Warning
no visible binding for global variable 'session'
|
||
} |