Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make shiny modules for quiz questions (instead of htmlwidgets) #194

Merged
merged 67 commits into from Apr 9, 2019

Conversation

@schloerke
Copy link
Collaborator

schloerke commented Oct 5, 2018

Fixes #192
Fixes #173
Fixes #109
Fixes #217

Will make a separate PR for text box input-based questions (included)

schloerke added 19 commits Oct 5, 2018
* upstream/master:
  Highlight code and exercise area (#185)
  save metadata information using dput vs deparse (#190)
* master:
  Aggressive Prerender checks within rmarkdown (#179)
… mechanisms

use s3 methods for
* question_initialize_input
* question_completed_input
* question_is_valid
* question_is_correct
* question_disable_selector (will probably remove)
@jcheng5

This comment has been minimized.

Copy link
Member

jcheng5 commented Oct 16, 2018

  1. Looks like there are some TODO-barret comments left, do any of those need to be addressed?
  2. Are you aware of any backward-incompatible changes in this PR? I've only started skimming but I vaguely recall you saying you were getting rid of the quiz function?
@jcheng5

This comment has been minimized.

Copy link
Member

jcheng5 commented Oct 16, 2018

To (partially) answer my own question, the question() arguments correct and incorrect have been renamed to correct_message and incorrect_message. Do you really want to break backward compat for that? (The examples still use the old param names btw)

@jcheng5

This comment has been minimized.

Copy link
Member

jcheng5 commented Oct 16, 2018

I can't get this to work in RStudio. It seems to me like the S3 methods are not registered properly. This is what I'm testing with:

---
title: "learnr test"
output: learnr::tutorial
runtime: shiny_prerendered
---

```{r setup, include=FALSE}
library(learnr)
```

```{r one}
question("Where are you right now? (select ALL that apply)",
 answer("Planet Earth", correct = TRUE),
 answer("Pluto"),
 answer("At a computing device", correct = TRUE),
 answer("In the Milky Way", correct = TRUE),
 incorrect_message = paste0("Incorrect. You're on Earth, ",
                    "in the Milky Way, at a computer.")
)
```

Instead of the report launching, I get each individual answer launching in a new window. If I use devtools::load_all I get different behavior, where the structure of the question is dumped into the output as text.

Update: Oh, interesting. I had some local changes to htmltools that caused this. Seems to almost be working now, other than the missing import declarations I mentioned below.

@jcheng5

This comment has been minimized.

Copy link
Member

jcheng5 commented Oct 16, 2018

Also there seem to be a lot of missing import declarations, R CMD check will point them out.

Copy link
Member

jcheng5 left a comment

I'll try again after you get the right imports in place so it works in RStudio.

I'll have some feedback about question_module_server as well, we can discuss that after I am actually able to run tutorials.

* master:
  Bump rmarkdown version to >= v1.12.0 (#220)
  Explaining that the example is just an example (#203)
  Adding missing word 'in' to sentence. (#200)
  Converting _it's_ (it is) to _its_ (possessive). (#201)
@jcheng5
jcheng5 approved these changes Apr 4, 2019
@schloerke schloerke changed the title [WIP] Make shiny modules for quiz questions (instead of htmlwidgets) Make shiny modules for quiz questions (instead of htmlwidgets) Apr 9, 2019
@schloerke schloerke merged commit 314c031 into rstudio:master Apr 9, 2019
@schloerke schloerke deleted the schloerke:text_answer branch Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.