-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
get_dropdown.R
46 lines (41 loc) · 1.43 KB
/
get_dropdown.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
#' Helpers to extract contents of dropdown menus on the site
#'
#' This fuction will extract the resources that exist and are listed in the
#' config file.
#'
#' @param path the path to the lesson, defaults to the current working directory
#' @param folder the folder to extract fromt he dropdown menues
#' @param trim if `TRUE` (default), only the file name will be presented. When
#' `FALSE`, the full path will be prepended.
#' @return a character vector of episodes in order of presentation
#'
#' @export
#' @rdname get_dropdown
#' @examples
#' tmp <- tempfile()
#' create_lesson(tmp, open = FALSE, rmd = FALSE)
#' get_episodes(tmp)
#' get_learners(tmp) # information for learners
get_dropdown <- function(path = ".", folder, trim = TRUE) {
as.character(get_resource_list(path, trim, folder, warn = TRUE))
}
#' @rdname get_dropdown
#' @export
get_episodes <- function(path = ".", trim = TRUE) {
as.character(get_resource_list(path, trim, "episodes", warn = TRUE))
}
#' @rdname get_dropdown
#' @export
get_learners <- function(path = ".", trim = TRUE) {
as.character(get_resource_list(path, trim, "learners", warn = TRUE))
}
#' @rdname get_dropdown
#' @export
get_instructors <- function(path = ".", trim = TRUE) {
as.character(get_resource_list(path, trim, "instructors", warn = TRUE))
}
#' @rdname get_dropdown
#' @export
get_profiles <- function(path = ".", trim = TRUE) {
as.character(get_resource_list(path, trim, "profiles", warn = TRUE))
}