set_dropdown: Set the order of items in a dropdown menu

Description Usage Arguments Examples

View source: R/set_dropdown.R

Description

Set the order of items in a dropdown menu

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set_dropdown(path = ".", order = NULL, write = FALSE, folder)

set_config(pairs = NULL, path = ".", write = FALSE)

set_episodes(path = ".", order = NULL, write = FALSE)

set_learners(path = ".", order = NULL, write = FALSE)

set_instructors(path = ".", order = NULL, write = FALSE)

set_profiles(path = ".", order = NULL, write = FALSE)

Arguments

path

path to the lesson. Defaults to the current directory.

order

the files in the order presented (with extension)

write

if TRUE, the schedule will overwrite the schedule in the current file.

folder

one of four folders that sandpaper recognises where the files listed in order are located: episodes, learners, instructors, profiles.

pairs

a named character vector with keys as the names and the new values as the contents

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
tmp <- tempfile()
create_lesson(tmp, "test lesson")
# Change the title and License
set_config(c(title = "Absolutely Free Lesson", license = "CC0"),
  path = tmp,
  write = TRUE
)
create_episode("using-R", path = tmp)
print(sched <- get_episodes(tmp))

# reverse the schedule
set_episodes(tmp, order = rev(sched))
# write it
set_episodes(tmp, order = rev(sched), write = TRUE)

# see it
get_episodes(tmp)

zkamvar/sandpaper documentation built on Nov. 25, 2021, 1:16 p.m.