Skip to content

Commit 9b5a486

Browse files
committed
assignation2(), challenge() and challenge2() added for group assignments and for individual or group challenges
1 parent ca0d7f5 commit 9b5a486

31 files changed

Lines changed: 481 additions & 16 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: learndown
22
Type: Package
3-
Version: 1.1.8
3+
Version: 1.2.0
44
Title: 'SciViews' - R Markdown and Bookdown Additions for Learning Material
55
Description: Extension to R Markdown and Bookdown for building better learning
66
and e-learning material: H5P integration, course-contextual divs, different

NAMESPACE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# Generated by roxygen2: do not edit by hand
22

33
export(assignation)
4+
export(assignation2)
5+
export(assignation2_en)
6+
export(assignation2_fr)
47
export(assignation_en)
58
export(assignation_fr)
9+
export(challenge)
10+
export(challenge2)
11+
export(challenge2_en)
12+
export(challenge2_fr)
13+
export(challenge_en)
14+
export(challenge_fr)
615
export(check_shiny_solution)
716
export(checker_ack_learnr)
817
export(config)

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# learndown 1.2.0
2+
3+
- There are now more GitHub assignation types : `assign2()` for group assignations and `challenge()`/`challenge2()` for assignations linked to challenges (individual or in groups).
4+
5+
- Images related to exercise blocks and suggested `style0.css` and `preamble.tex`to be used for {learndown}-enabled {bookdown}s are also provided now.
6+
17
# learndown 1.1.8
28

39
- Argument `upgrade=` added to `run()`, `run_app()` and `update_pkg()`. By default, it is "never", which is a good value inside the SciViews Box, but "ask" may be more appropriate elsewhere.

R/assignation.R

Lines changed: 164 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#' Insert a GitHub assignation in the document
1+
#' Insert a GitHub assignation or challenge in the document
22
#'
3-
#' Insert a block of class `assign` with data related to a GitHub (Classroom)
3+
#' Insert a block of class `assign`, `assign2`, `challenge` or `challenge2` with data related to a GitHub (Classroom)
44
#' assignment.
55
#'
6-
#' @param name The name of the assignation (usually the same as the name of the
6+
#' @param name The name of the assignation or the challenge (usually the same as the name of the
77
#' template GitHub repository).
8-
#' @param url The URL of the assignation (could be a named list for different
8+
#' @param url The URL of the assignation or challenge (could be a named list for different
99
#' versions depending on the course).
1010
#' @param course.urls Named vector with the Classroom URLS for each course.
1111
#' Names are the course identifiers in Moodle. If `NULL`, no course-specific
@@ -25,6 +25,7 @@
2525
#' the ex-toc.
2626
#' @param assign.link The link to the learnr help page (when the user clicks on
2727
#' the image in the ex-toc).
28+
#' @param block The class of the div, or the LaTeX environment to use for the assignment block.
2829
#' @param title The title of the block.
2930
#' @param part.name The word to use for "part".
3031
#' @param alt The text to display for alternate access to the repository (for
@@ -45,7 +46,7 @@
4546
assignation <- function(name, url, course.urls = NULL, part = NULL,
4647
course.names = c(course1 = "Data Science"), toc = "",
4748
texts = assignation_en(), assign.img = "images/list-assign.png",
48-
assign.link = "github_assignation") {
49+
assign.link = "github_assignation", block = "assign") {
4950
if (is.null(part)) {
5051
anchor <- name
5152
part <- ""
@@ -85,17 +86,47 @@ assign.link = "github_assignation") {
8586

8687
alt_text <- glue::glue(texts$alt)
8788

88-
glue::glue("\n\\BeginKnitrBlock{{assign}}<div class=\"assign\">
89+
glue::glue("\n\\BeginKnitrBlock{{{block}}}<div class=\"{block}\">
8990
{texts$title} **[{name}]{{#{anchor} }}{part}**.
9091
9192
{course_text}
9293
9394
{alt_text}
9495
9596
*{texts$sub}{part}.*
96-
</div>\\EndKnitrBlock{{assign}}\n\n")
97+
</div>\\EndKnitrBlock{{{block}}}\n\n")
9798
}
9899

100+
#' @rdname assignation
101+
#' @export
102+
assignation2 <- function(name, url, course.urls = NULL, part = NULL,
103+
course.names = c(course1 = "Data Science"), toc = "",
104+
texts = assignation2_en(), assign.img = "images/list-assign2.png",
105+
assign.link = "github_assignation", block = "assign2")
106+
assignation(name, url, course.urls = course.urls, part = part,
107+
course.names = course.names, toc = toc, texts = texts,
108+
assign.img = assign.img, assign.link = assign.link, block = block)
109+
110+
#' @rdname assignation
111+
#' @export
112+
challenge <- function(name, url, course.urls = NULL, part = NULL,
113+
course.names = c(course1 = "Data Science"), toc = "",
114+
texts = challenge_en(), assign.img = "images/list-challenge.png",
115+
assign.link = "github_assignation", block = "challenge")
116+
assignation(name, url, course.urls = course.urls, part = part,
117+
course.names = course.names, toc = toc, texts = texts,
118+
assign.img = assign.img, assign.link = assign.link, block = block)
119+
120+
#' @rdname assignation
121+
#' @export
122+
challenge2 <- function(name, url, course.urls = NULL, part = NULL,
123+
course.names = c(course1 = "Data Science"), toc = "",
124+
texts = challenge2_en(), assign.img = "images/list-challenge2.png",
125+
assign.link = "github_assignation", block = "challenge2")
126+
assignation(name, url, course.urls = course.urls, part = part,
127+
course.names = course.names, toc = toc, texts = texts,
128+
assign.img = assign.img, assign.link = assign.link, block = block)
129+
99130
#' @rdname assignation
100131
#' @export
101132
assignation_en <- function(title, part.name, alt, sub, course, toc.def) {
@@ -137,3 +168,129 @@ assignation_fr <- function(title, part.name, alt, sub, course, toc.def) {
137168

138169
texts
139170
}
171+
172+
#' @rdname assignation
173+
#' @export
174+
assignation2_en <- function(title, part.name, alt, sub, course, toc.def) {
175+
texts <- list(
176+
title = "Complete this group assignation:",
177+
part.name = "part",
178+
alt = "If you are not a registered user, or if you work outside of a course, fork [this]({url}){{target=\"_blank\"}} repository.",
179+
sub = "See the explanations in the `README.md`",
180+
course = "Group assignation for the students enrolled at the course",
181+
toc.def = "Group assignation {name}"
182+
)
183+
if (!missing(title)) texts$title <- title
184+
if (!missing(part.name)) texts$part.name <- part.name
185+
if (!missing(alt)) texts$alt <- alt
186+
if (!missing(sub)) texts$sub <- sub
187+
if (!missing(course)) texts$course <- course
188+
if (!missing(toc.def)) texts$toc.def <- toc.def
189+
190+
texts
191+
}
192+
193+
#' @rdname assignation
194+
#' @export
195+
assignation2_fr <- function(title, part.name, alt, sub, course, toc.def) {
196+
texts <- list(
197+
title = "R\u00e9alisez en groupe l'assignation",
198+
part.name = "partie",
199+
alt = "Si vous \u00eates un utilisateur non enregistr\u00e9 ou que vous travaillez en dehors d'un cours, faites un \"fork\" de [ce]({url}){{target=\"_blank\"}} d\u00e9p\u00f4t.",
200+
sub = "Voyez les explications dans le fichier `README.md`",
201+
course = "Assignation en groupe pour les \u00e9tudiants inscrits au cours de",
202+
toc.def = "Assignation en groupe {name}"
203+
)
204+
if (!missing(title)) texts$title <- title
205+
if (!missing(part.name)) texts$part.name <- part.name
206+
if (!missing(alt)) texts$alt <- alt
207+
if (!missing(sub)) texts$sub <- sub
208+
if (!missing(course)) texts$course <- course
209+
if (!missing(toc.def)) texts$toc.def <- toc.def
210+
211+
texts
212+
}
213+
214+
#' @rdname assignation
215+
#' @export
216+
challenge_en <- function(title, part.name, alt, sub, course, toc.def) {
217+
texts <- list(
218+
title = "Accept this challenge:",
219+
part.name = "part",
220+
alt = "If you are not a registered user, or if you work outside of a course, fork [this]({url}){{target=\"_blank\"}} repository.",
221+
sub = "See the explanations in the `README.md`",
222+
course = "Challenge for the students enrolled at the course",
223+
toc.def = "Challenge {name}"
224+
)
225+
if (!missing(title)) texts$title <- title
226+
if (!missing(part.name)) texts$part.name <- part.name
227+
if (!missing(alt)) texts$alt <- alt
228+
if (!missing(sub)) texts$sub <- sub
229+
if (!missing(course)) texts$course <- course
230+
if (!missing(toc.def)) texts$toc.def <- toc.def
231+
232+
texts
233+
}
234+
235+
#' @rdname assignation
236+
#' @export
237+
challenge_fr <- function(title, part.name, alt, sub, course, toc.def) {
238+
texts <- list(
239+
title = "Relevez le challenge",
240+
part.name = "partie",
241+
alt = "Si vous \u00eates un utilisateur non enregistr\u00e9 ou que vous travaillez en dehors d'un cours, faites un \"fork\" de [ce]({url}){{target=\"_blank\"}} d\u00e9p\u00f4t.",
242+
sub = "Voyez les explications dans le fichier `README.md`",
243+
course = "Challenge pour les \u00e9tudiants inscrits au cours de",
244+
toc.def = "Challenge {name}"
245+
)
246+
if (!missing(title)) texts$title <- title
247+
if (!missing(part.name)) texts$part.name <- part.name
248+
if (!missing(alt)) texts$alt <- alt
249+
if (!missing(sub)) texts$sub <- sub
250+
if (!missing(course)) texts$course <- course
251+
if (!missing(toc.def)) texts$toc.def <- toc.def
252+
253+
texts
254+
}
255+
256+
#' @rdname assignation
257+
#' @export
258+
challenge2_en <- function(title, part.name, alt, sub, course, toc.def) {
259+
texts <- list(
260+
title = "Accept this group challenge:",
261+
part.name = "part",
262+
alt = "If you are not a registered user, or if you work outside of a course, fork [this]({url}){{target=\"_blank\"}} repository.",
263+
sub = "See the explanations in the `README.md`",
264+
course = "Group challenge for the students enrolled at the course",
265+
toc.def = "Group challenge {name}"
266+
)
267+
if (!missing(title)) texts$title <- title
268+
if (!missing(part.name)) texts$part.name <- part.name
269+
if (!missing(alt)) texts$alt <- alt
270+
if (!missing(sub)) texts$sub <- sub
271+
if (!missing(course)) texts$course <- course
272+
if (!missing(toc.def)) texts$toc.def <- toc.def
273+
274+
texts
275+
}
276+
277+
#' @rdname assignation
278+
#' @export
279+
challenge2_fr <- function(title, part.name, alt, sub, course, toc.def) {
280+
texts <- list(
281+
title = "Relevez ce challenge par groupe:",
282+
part.name = "partie",
283+
alt = "Si vous \u00eates un utilisateur non enregistr\u00e9 ou que vous travaillez en dehors d'un cours, faites un \"fork\" de [ce]({url}){{target=\"_blank\"}} d\u00e9p\u00f4t.",
284+
sub = "Voyez les explications dans le fichier `README.md`",
285+
course = "Challenge en groupe pour les \u00e9tudiants inscrits au cours de",
286+
toc.def = "Challenge en groupe {name}"
287+
)
288+
if (!missing(title)) texts$title <- title
289+
if (!missing(part.name)) texts$part.name <- part.name
290+
if (!missing(alt)) texts$alt <- alt
291+
if (!missing(sub)) texts$sub <- sub
292+
if (!missing(course)) texts$course <- course
293+
if (!missing(toc.def)) texts$toc.def <- toc.def
294+
295+
texts
296+
}

R/launch_shiny.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ launch_shiny <- function(url, app = basename(url),
5757
imgdir = "images/shinyapps", img = paste0(imgdir, "/", app, ".png"),
5858
createimg = TRUE, width = 780, height = 500, fun = NULL,
5959
alt1 = "*Click to start the Shiny application.*",
60-
alt2 = "*Click to start or [run `{run.cmd}`]({run.url}{run.arg}){{target=\"_blank\"}}.*",
60+
alt2 = paste0("*Click to start",
61+
"or [run `{run.cmd}`]({run.url}{run.arg}){{target=\"_blank\"}}.*"),
6162
toc = "", toc.def = "Shiny application {app}",
6263
run.url = "start_rstudio.html?runrcode=", run.cmd = glue("{fun}(\"{app}\")"),
6364
run.arg = URLencode(run.cmd, reserved = TRUE),

inst/images/block-assign.png

2.52 KB
Loading

inst/images/block-assign2.png

3.17 KB
Loading

inst/images/block-bdd.png

4.05 KB
Loading

inst/images/block-challenge.png

3.12 KB
Loading

inst/images/block-challenge2.png

3.55 KB
Loading

0 commit comments

Comments
 (0)