forked from gammarama/intRo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.R
executable file
·52 lines (48 loc) · 2.48 KB
/
ui.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
addResourcePath(prefix="images", directoryPath="images/")
## For printing
dynFrame <- function(outputId)
{
HTML(paste0("<iframe class = 'print_results' src='about:blank' id = '", outputId, "'></iframe>"))
}
## Source ui
module_info <- read.table("modules/modules.txt", header = TRUE, sep=",")
sapply(file.path("modules", dir("modules")[dir("modules") != "modules.txt"], "ui.R"), source)
## Generates the UI tabs
mylist <- list()
old_heading <- ""
for (i in 1:nrow(module_info)) {
if (module_info[i,1] != old_heading) {
mylist[[length(mylist) + 1]] <- capitalize(as.character(module_info[i,1]))
old_heading <- module_info[i,1]
}
mylist[[length(mylist) + 1]] <- get(paste(module_info[i,2], "ui", sep = "_"))
}
shinyUI(
navbarPage("intRo", id="top-nav", theme = shinytheme("united"),
tabPanel(title="", icon=icon("home", "fa-2x"),
fluidRow(
dynFrame(outputId = 'print_output'),
do.call(navlistPanel, c(list(id = "side-nav", widths = c(2, 10)), mylist))
),
hr(),
fluidRow(
column(12,
aceEditor("myEditor", "", mode="r", readOnly=TRUE, theme="chrome")
)
)
),
tabPanel(title="", value="http://gammarama.github.io/intRo", icon=icon('question-circle', "fa-2x")),
tabPanel(title="", value="http://github.com/gammarama/intRo", icon=icon("github", "fa-2x")),
navbarMenu("", icon=icon("envelope", "fa-2x"),
tabPanel("Eric Hare"),
tabPanel("Andee Kaplan")),
tabPanel(title="hide_me"),
tabPanel(title="", icon=icon('code', "fa-2x"), value = "javascript:$('#myEditor').slideToggle(); $('.fa-code').parent().parent().toggleClass('active'); code_clicked();"),
tabPanel(title="", icon=icon("print", "fa-2x"), value="javascript: $(this).addClass('print_button'); print_clicked();"),
footer=tagList(includeScript("scripts/top-nav-links.js"),
includeScript("scripts/print.js"),
includeScript("scripts/other-helpers.js"),
includeCSS("www/additional.css")
),
tags$head(tags$link(rel="shortcut icon", href="images/icon.png"))
))