-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.R
60 lines (58 loc) · 1.92 KB
/
about.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#' About Server
#'
#' @param id identifier for shiny reactive
#' @param helppath path to help markdown
#' @param entry entry logical flag
#'
#' @return reactive server
#' @export
#' @importFrom shiny a bootstrapPage br includeMarkdown isTruthy NS reactive
#' renderUI shinyApp strong uiOutput
aboutServer <- function(id, helppath = NULL,
entry = shiny::reactive( TRUE )) {
shiny::moduleServer(id, function(input, output, session) {
ns <- session$ns
output$about <- shiny::renderUI({
if(!is.null(helppath) && helppath != "" && file.exists(helppath)) {
datainfo <- shiny::includeMarkdown(helppath)
} else {
datainfo <- shiny::includeMarkdown(
system.file(file.path("shinyApp", "help.md"), package='foundrShiny'))
}
tagList(
if(shiny::isTruthy(entry())) {
shiny::strong("Click on tabs above this line to see data panels.")
},
shiny::includeMarkdown(
system.file(file.path("shinyApp", "intro.md"), package='foundrShiny')),
"See GitHub:",
shiny::a(paste("byandell/foundrShiny",
paste0("(version ",
utils::packageVersion("foundrShiny"), "); ")),
href = "https://github.com/byandell/foundrShiny"),
shiny::a(paste("byandell/foundr",
paste0("(version ", utils::packageVersion("foundr"), ")")),
href = "https://github.com/byandell/foundr"),
shiny::br(),
shiny::br(),
datainfo)
})
})
}
#' @export
#' @rdname aboutServer
aboutOutput <- function(id) {
ns <- shiny::NS(id)
shiny::uiOutput(ns("about"))
}
#' @export
#' @rdname aboutServer
aboutApp <- function(id) {
ui <- shiny::bootstrapPage(
aboutOutput("about")
)
server <- function(input, output, session) {
aboutServer("about", helppath = customSettings$help)
}
shiny::shinyApp(ui, server)
}