-
-
Notifications
You must be signed in to change notification settings - Fork 222
More config values for Runcstone components #867
base: master
Are you sure you want to change the base?
Changes from 10 commits
0b1a55a
ad5bb1d
ae91929
7ab3f18
5d8ae5d
750ef5a
789815e
90d33ed
203de5d
eed1f01
ac5b251
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ build_info | |
|
|
||
| # IDEs | ||
| .vscode/ | ||
| .vs/ | ||
| **/sphinx-enki-info.txt | ||
| # Mac stuff | ||
| .DS_Store | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,11 +32,12 @@ def setup(app): | |
| app.add_directive("qnum", QuestionNumber) | ||
| app.add_directive("timed", TimedDirective) | ||
|
|
||
| app.add_config_value("mchoice_div_class", "runestone alert alert-warning", "html") | ||
| app.add_config_value('mchoice_div_class', 'runestone alert alert-warning', 'html') | ||
|
||
| app.add_config_value('mchoice_compare_button_show', True, 'html'); | ||
| app.add_autoversioned_javascript('mchoice.js') | ||
| app.add_autoversioned_javascript('timedmc.js') | ||
| app.add_autoversioned_javascript('timed.js') | ||
|
|
||
| app.add_autoversioned_javascript("mchoice.js") | ||
| app.add_autoversioned_javascript("timedmc.js") | ||
| app.add_autoversioned_javascript("timed.js") | ||
|
|
||
| app.add_node(TimedNode, html=(visit_timed_node, depart_timed_node)) | ||
| app.add_node(MChoiceNode, html=(visit_mc_node, depart_mc_node)) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -297,3 +297,7 @@ htmlhelp_basename = 'PythonCoursewareProjectdoc' | |
| #shortanswer_optional_div_class = 'journal alert alert-success' | ||
| #showeval_div_class = 'runestone explainer alert alert-warning' | ||
| #tabbed_div_class = 'alert alert-warning' | ||
| #mchoice_compare_button_show - if False, hide the 'Compare me' button (default True) | ||
| #mchoice_compare_button_show = True | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a brief description of what this option controls for both of these.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In fitb.py and multiplechoice.py there are these two comments:
Should I add these to conf.tmpl as well?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, exactly. |
||
| #fitb_compare_button_show - if False, hide the 'Compare me' button (default True) | ||
| #fitb_compare_button_show = True | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,10 +36,10 @@ def setup(app): | |
| app.add_autoversioned_javascript("timedfitb.js") | ||
| app.add_node(FITBNode, html=(visit_fitb_node, depart_fitb_node)) | ||
| app.add_node(BlankNode, html=(visit_blank_node, depart_blank_node)) | ||
| app.add_node( | ||
| FITBFeedbackNode, html=(visit_fitb_feedback_node, depart_fitb_feedback_node) | ||
| ) | ||
| app.add_config_value("fitb_div_class", "runestone", "html") | ||
|
|
||
|
||
| app.add_node(FITBFeedbackNode, html=(visit_fitb_feedback_node, depart_fitb_feedback_node)) | ||
| app.add_config_value('fitb_div_class', 'runestone', 'html') | ||
| app.add_config_value('fitb_compare_button_show', True, 'html') | ||
|
|
||
|
|
||
| class FITBNode(nodes.General, nodes.Element, RunestoneNode): | ||
|
|
@@ -126,6 +126,7 @@ class FillInTheBlank(RunestoneIdDirective): | |
| config values (conf.py): | ||
|
|
||
| - fitb_div_class - custom CSS class of the component's outermost div | ||
| - fitb_compare_button_show - if False, hide the 'Compare me' button (default True) | ||
| """ | ||
|
|
||
| required_arguments = 1 | ||
|
|
@@ -150,10 +151,17 @@ def run(self): | |
|
|
||
| super(FillInTheBlank, self).run() | ||
|
|
||
| TEMPLATE_START = """ | ||
| env = self.state.document.settings.env | ||
| if env.config.fitb_compare_button_show: | ||
| self.options['showcomparebutton'] = 'data-showcomparebutton=true' | ||
| else: | ||
| self.options['showcomparebutton'] = 'data-showcomparebutton=false' | ||
|
|
||
| TEMPLATE_START = ''' | ||
| <div class="%(divclass)s"> | ||
| <div data-component="fillintheblank" id="%(divid)s"> | ||
| """ | ||
|
|
||
| <div data-component="fillintheblank" id="%(divid)s" %(showcomparebutton)s> | ||
| ''' | ||
|
|
||
| TEMPLATE_END = """ | ||
| <script type="application/json"> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
|
|
||
| from .update import * |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| ============================== | ||
| Testing update-config direcive | ||
| ============================== | ||
|
|
||
|
|
||
| Multiple Choice | ||
| --------------- | ||
|
|
||
| .. mchoice:: question1 | ||
| :multiple_answers: | ||
| :correct: a,b,d | ||
| :answer_a: red | ||
| :answer_b: yellow | ||
| :answer_c: black | ||
| :answer_d: green | ||
| :feedback_a: Red is a definitely on of the colors. | ||
| :feedback_b: Yes, yellow is correct. | ||
| :feedback_c: Remember the acronym...ROY G BIV. B stands for blue. | ||
| :feedback_d: Yes, green is one of the colors. | ||
|
|
||
| Which colors might be found in a rainbow? (choose all that are correct) | ||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
| Fill in the Blank | ||
| ----------------- | ||
| .. fillintheblank:: fill1 | ||
|
|
||
| Fill in the blanks to make the following sentence: "The red car drove away." | ||
|
|
||
| The |blank| car drove |blank|. | ||
|
|
||
| - :red: Correct. | ||
| :x: Incorrect. Try 'red'. | ||
| - :away: Correct. | ||
| :x: Incorrect. Try 'away'. | ||
|
|
||
|
|
||
|
|
||
|
|
||
| .. update-config:: | ||
| :set_config_option: mchoice_compare_button_show False | ||
| .. update-config:: | ||
| :set_config_option: fitb_compare_button_show False | ||
|
|
||
|
|
||
| Multiple Choice | ||
| --------------- | ||
|
|
||
| .. mchoice:: question2 | ||
| :multiple_answers: | ||
| :correct: a,b,d | ||
| :answer_a: red | ||
| :answer_b: yellow | ||
| :answer_c: black | ||
| :answer_d: green | ||
| :feedback_a: Red is a definitely on of the colors. | ||
| :feedback_b: Yes, yellow is correct. | ||
| :feedback_c: Remember the acronym...ROY G BIV. B stands for blue. | ||
| :feedback_d: Yes, green is one of the colors. | ||
|
|
||
| Which colors might be found in a rainbow? (choose all that are correct) | ||
|
|
||
|
|
||
|
|
||
| Fill in the Blank | ||
| ----------------- | ||
| .. fillintheblank:: fill2 | ||
|
|
||
| Fill in the blanks to make the following sentence: "The red car drove away." | ||
|
|
||
| The |blank| car drove |blank|. | ||
|
|
||
| - :red: Correct. | ||
| :x: Incorrect. Try 'red'. | ||
| - :away: Correct. | ||
| :x: Incorrect. Try 'away'. | ||
|
|
||
|
|
||
| .. update-config:: | ||
| :set_config_option: mchoice_compare_button_show True | ||
|
|
||
|
|
||
| Multiple Choice | ||
| --------------- | ||
|
|
||
| .. mchoice:: question3 | ||
| :multiple_answers: | ||
| :correct: a,b,d | ||
| :answer_a: red | ||
| :answer_b: yellow | ||
| :answer_c: black | ||
| :answer_d: green | ||
| :feedback_a: Red is a definitely on of the colors. | ||
| :feedback_b: Yes, yellow is correct. | ||
| :feedback_c: Remember the acronym...ROY G BIV. B stands for blue. | ||
| :feedback_d: Yes, green is one of the colors. | ||
|
|
||
|
|
||
| .. update-config:: | ||
| :set_config_option: fitb_compare_button_show True | ||
|
|
||
| Fill in the Blank | ||
| ----------------- | ||
| .. fillintheblank:: fill3 | ||
|
|
||
| Fill in the blanks to make the following sentence: "The red car drove away." | ||
|
|
||
| The |blank| car drove |blank|. | ||
|
|
||
| - :red: Correct. | ||
| :x: Incorrect. Try 'red'. | ||
| - :away: Correct. | ||
| :x: Incorrect. Try 'away'. | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicated -- see line 78.