Title: | Multipage 'Shiny' Apps |
---|---|
Description: | Build multipage 'shiny' apps. |
Authors: | Colin Fay [aut, cre] |
Maintainer: | Colin Fay <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9024 |
Built: | 2024-11-01 11:15:47 UTC |
Source: | https://github.com/ColinFay/brochure |
This function is to be used in place of
shinyApp()
.
brochureApp( ..., onStart = NULL, options = list(), enableBookmarking = NULL, content_404 = "Not found", basepath = "", req_handlers = list(), res_handlers = list(), wrapped = shiny::tagList )
brochureApp( ..., onStart = NULL, options = list(), enableBookmarking = NULL, content_404 = "Not found", basepath = "", req_handlers = list(), res_handlers = list(), wrapped = shiny::tagList )
... |
a list of elements to inject in the brochureApp.
IMPORTANT NOTE all elements which are not of class |
onStart |
A function that will be called before the app is actually run.
This is only needed for |
options |
Named options that should be passed to the |
enableBookmarking |
Can be one of |
content_404 |
The content to dislay when a 404 is sent |
basepath |
The base path of your app. This pattern will be removed from the
url, so that it matches the href of your |
req_handlers |
a list of functions that can manipulate the |
res_handlers |
A list of functions that can manipulate the httpResponse
object before it is send to the browser. Each function must take a |
wrapped |
A UI function wrapping the Brochure UI.
Default is |
A shiny.appobj
Golem Hook function
golem_hook(path, package_name, ...)
golem_hook(path, package_name, ...)
path |
Name of the folder to create the package in. This will also be used as the package name. |
package_name |
Package name to use. By default, golem uses
|
... |
Arguments passed from |
Used for side effect
if (requireNamespace("golem") & interactive()) { golem::create_golem("myapp", project_hook = golem_hook) }
if (requireNamespace("golem") & interactive()) { golem::create_golem("myapp", project_hook = golem_hook) }
Module template for golem
new_page(name, path, export, ...)
new_page(name, path, export, ...)
name |
The name of the module. |
path |
The path to the R script where the module will be written.
Note that this path will not be set by the user but via
|
export |
Should the module be exported? Default is |
... |
Arguments to be passed to the |
Used for side effect
if (requireNamespace("golem") & interactive()) { golem::add_module(name = "home", module_template = brochure::new_page) }
if (requireNamespace("golem") & interactive()) { golem::add_module(name = "home", module_template = brochure::new_page) }
A Brochure Page
page( href, ui = tagList(), server = function(input, output, session) { }, req_handlers = list(), res_handlers = list() )
page( href, ui = tagList(), server = function(input, output, session) { }, req_handlers = list(), res_handlers = list() )
href |
The endpoint to serve the UI on |
ui |
The UI definition of the app (for example, a call to
If bookmarking is enabled (see |
server |
A function with three parameters: |
req_handlers |
a list of functions that can manipulate the |
res_handlers |
A list of functions that can manipulate the httpResponse
object before it is send to the browser. Each function must take a |
A list
library(shiny) page( href = "/page2", ui = tagList( h1("This is my second page"), plotOutput("plotb") ) )
library(shiny) page( href = "/page2", ui = tagList( h1("This is my second page"), plotOutput("plotb") ) )
Parse the cookie string
parse_cookie_string(cookie_string) get_cookies(session = shiny::getDefaultReactiveDomain())
parse_cookie_string(cookie_string) get_cookies(session = shiny::getDefaultReactiveDomain())
cookie_string |
The cookie string to parse |
session |
The |
a list of cookies and values
parse_cookie_string("brochure_session=63422; brochure_cookie=3958")
parse_cookie_string("brochure_session=63422; brochure_cookie=3958")
Redirection
redirect(from, to, code = 301)
redirect(from, to, code = 301)
from |
redirect from |
to |
redirect to |
code |
redirectin http code (one of |
A redirection
Do a server side redirection
server_redirect(to, session = shiny::getDefaultReactiveDomain())
server_redirect(to, session = shiny::getDefaultReactiveDomain())
to |
the destination of the redirection |
session |
shiny session object, default is |
Please read https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie for more information. Description of parameters is taken from this page.
set_cookie( res, name, value, expires = NULL, max_age = NULL, domain = NULL, path = NULL, secure = NULL, http_only = NULL, same_site = NULL ) remove_cookie(res, name)
set_cookie( res, name, value, expires = NULL, max_age = NULL, domain = NULL, path = NULL, secure = NULL, http_only = NULL, same_site = NULL ) remove_cookie(res, name)
res |
An httpResponse object |
name |
A cookie-name can be any US-ASCII characters,
except control characters, spaces, or tabs. It also must
not contain a separator character like the following:
[ ]: R:%20 |
value |
A cookie-value can optionally be wrapped in double quotes and include any US-ASCII characters excluding control characters, Whitespace, double quotes, comma, semicolon, and backslash. |
expires |
The maximum lifetime of the cookie as an HTTP-date timestamp. Please enter an ISO 8601 datetime format. |
max_age |
Number of seconds until the cookie expires. A zero or negative number will expire the cookie immediately. If both Expires and Max-Age are set, Max-Age has precedence. |
domain |
Host to which the cookie will be sent. |
path |
A path that must exist in the requested URL, or the browser won't send the Cookie header. |
secure |
Cookie is only sent to the server when a request is made with the https: scheme (except on localhost), and therefore is more resistent to man-in-the-middle attacks. |
http_only |
Forbids JavaScript from accessing the cookie, for example, through the Document.cookie property. |
same_site |
Controls whether a cookie is sent with cross-origin requests, providing some protection against cross-site request forgery attacks (CSRF). |
the httpResponse, with a cookie header
set_cookie( shiny:::httpResponse(), "this", 12 )
set_cookie( shiny:::httpResponse(), "this", 12 )