Skip to content

Commit e8112f4

Browse files
committed
Inactive items are now taken into account in the addin
1 parent 825d155 commit e8112f4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
- New version for academic year 2023-2024.
44

5+
- The addin to select learnrs or Shiny apps now detects inactivated items and takes them out of the list.
6+
57
# BioDataScience3 2022.4.1
68

79
- Corrections in **C06La_map**.

R/addins.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@ run_addin <- function() {
99

1010
items <- character(0)
1111
tutorials <- dir(system.file("tutorials", package = package))
12+
is_active <- function(dir, subdir, pattern)
13+
length(dir(system.file(dir, subdir, package = package),
14+
pattern = pattern)) > 0
15+
keep <- logical(length(tutorials))
16+
for (i in seq_along(tutorials))
17+
keep[i] <- is_active("tutorials", tutorials[i], "\\.Rmd$")
18+
tutorials <- tutorials[keep]
1219
if (length(tutorials))
1320
items <- paste(tutorials, "(tutorial)")
1421
apps <- dir(system.file("shiny", package = package))
22+
keep <- logical(length(apps))
23+
for (i in seq_along(apps))
24+
keep[i] <- is_active("shiny", apps[i], "^app.R$")
25+
apps <- apps[keep]
1526
if (length(apps))
1627
items <- c(items, paste(apps, "(Shiny app)"))
1728
if (!length(items)) return()

0 commit comments

Comments
 (0)