Skip to content

Commit

Permalink
If shinyAppFile is used, store the filename and use it in the showcas…
Browse files Browse the repository at this point in the history
…e's app file discovery logic
  • Loading branch information
cpsievert committed Sep 10, 2019
1 parent 26dd456 commit e569deb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion R/app.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ shinyAppFile <- function(appFile, options=list()) {
appFile <- normalizePath(appFile, mustWork = TRUE)
appDir <- dirname(appFile)

shinyAppDir_appR(basename(appFile), appDir, options = options)
.globals$appFile <- basename(appFile)
shinyAppDir_appR(.globals$appFile, appDir, options = options)
}

# This reads in an app dir in the case that there's a server.R (and ui.R/www)
Expand Down
5 changes: 2 additions & 3 deletions R/showcase.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ 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 "",
li(class=if (tolower(file) %in% c("app.r", "server.r", tolower(.globals$appFile))) "active" else "",
a(href=paste0("#", gsub("\\.|\\s+", "_", file), "_code"),
"data-toggle"="tab", paste0(prefix, file)))
)
Expand All @@ -106,8 +106,7 @@ tabContentHelper <- function(files, path, language) {
lapply(files, function(file) {
with(tags,
div(class=paste0("tab-pane",
# TODO: what if the app filename is something else?
if (tolower(file) %in% c("app.r", "server.r")) " active"
if (tolower(file) %in% c("app.r", "server.r", tolower(.globals$appFile))) " active"
else ""),
id=paste0(gsub("\\.|\\s+", "_", file), "_code"),
pre(class="shiny-code",
Expand Down

0 comments on commit e569deb

Please sign in to comment.