Skip to content

Commit e569deb

Browse files
committed
If shinyAppFile is used, store the filename and use it in the showcase's app file discovery logic
1 parent 26dd456 commit e569deb

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

R/app.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ shinyAppFile <- function(appFile, options=list()) {
136136
appFile <- normalizePath(appFile, mustWork = TRUE)
137137
appDir <- dirname(appFile)
138138

139-
shinyAppDir_appR(basename(appFile), appDir, options = options)
139+
.globals$appFile <- basename(appFile)
140+
shinyAppDir_appR(.globals$appFile, appDir, options = options)
140141
}
141142

142143
# This reads in an app dir in the case that there's a server.R (and ui.R/www)

R/showcase.R

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ appMetadata <- function(desc) {
8181
navTabsHelper <- function(files, prefix = "") {
8282
lapply(files, function(file) {
8383
with(tags,
84-
li(class=if (tolower(file) %in% c("app.r", "server.r")) "active" else "",
84+
li(class=if (tolower(file) %in% c("app.r", "server.r", tolower(.globals$appFile))) "active" else "",
8585
a(href=paste0("#", gsub("\\.|\\s+", "_", file), "_code"),
8686
"data-toggle"="tab", paste0(prefix, file)))
8787
)
@@ -106,8 +106,7 @@ tabContentHelper <- function(files, path, language) {
106106
lapply(files, function(file) {
107107
with(tags,
108108
div(class=paste0("tab-pane",
109-
# TODO: what if the app filename is something else?
110-
if (tolower(file) %in% c("app.r", "server.r")) " active"
109+
if (tolower(file) %in% c("app.r", "server.r", tolower(.globals$appFile))) " active"
111110
else ""),
112111
id=paste0(gsub("\\.|\\s+", "_", file), "_code"),
113112
pre(class="shiny-code",

0 commit comments

Comments
 (0)