Compare commits

...

2 Commits

3 changed files with 10 additions and 9 deletions

View File

@@ -121,8 +121,10 @@ shinyAppDir <- function(appDir, options=list()) {
appDir <- normalizePath(appDir, mustWork = TRUE)
if (file.exists.ci(appDir, "server.R")) {
shinyOptions(appFile = "server.R")
shinyAppDir_serverR(appDir, options = options)
} else if (file.exists.ci(appDir, "app.R")) {
shinyOptions(appFile = "app.R")
shinyAppDir_appR("app.R", appDir, options = options)
} else {
stop("App dir must contain either app.R or server.R.")
@@ -136,6 +138,7 @@ shinyAppFile <- function(appFile, options=list()) {
appFile <- normalizePath(appFile, mustWork = TRUE)
appDir <- dirname(appFile)
shinyOptions(appFile = basename(appFile))
shinyAppDir_appR(basename(appFile), appDir, options = options)
}

View File

@@ -81,8 +81,8 @@ appMetadata <- function(desc) {
navTabsHelper <- function(files, prefix = "") {
lapply(files, function(file) {
with(tags,
li(class=if (tolower(file) %in% c("app.r", "server.r")) "active" else "",
a(href=paste("#", gsub(".", "_", file, fixed=TRUE), "_code", sep=""),
li(class=if (identical(file, getShinyOption("appFile"))) "active" else "",
a(href=paste0("#", gsub("\\.|\\s+", "_", file), "_code"),
"data-toggle"="tab", paste0(prefix, file)))
)
})
@@ -105,12 +105,10 @@ navTabsDropdown <- function(files) {
tabContentHelper <- function(files, path, language) {
lapply(files, function(file) {
with(tags,
div(class=paste("tab-pane",
if (tolower(file) %in% c("app.r", "server.r")) " active"
else "",
sep=""),
id=paste(gsub(".", "_", file, fixed=TRUE),
"_code", sep=""),
div(class=paste0("tab-pane",
if (identical(file, getShinyOption("appFile"))) " active"
else ""),
id=paste0(gsub("\\.|\\s+", "_", file), "_code"),
pre(class="shiny-code",
# we need to prevent the indentation of <code> ... </code>
HTML(format(tags$code(

View File

@@ -82,7 +82,7 @@
el = document.createElement("span");
el.id = "srcref_" + srcref;
var ref = srcref;
var code = document.getElementById(srcfile.replace(/\./g, "_") + "_code");
var code = document.getElementById(srcfile.replace(/\.|\s+/g, "_") + "_code");
// if there is no code file (might be a shiny file), quit early
if (!code) return;
var start = findTextPoint(code, ref[0], ref[4]);