diff --git a/.gitignore b/.gitignore index 460e6c953..4c327e8ad 100644 --- a/.gitignore +++ b/.gitignore @@ -48,6 +48,7 @@ build_info # IDEs .vscode/ +.vs/ **/sphinx-enki-info.txt # Mac stuff .DS_Store diff --git a/runestone/__init__.py b/runestone/__init__.py index a145ba1ee..0da19aaec 100644 --- a/runestone/__init__.py +++ b/runestone/__init__.py @@ -70,7 +70,11 @@ def runestone_extensions(): if os.path.exists("{}/__init__.py".format(os.path.join(basedir, x))) ] # Place ``runestone.common`` first, so it can run init code needed by all other modules. This assumes that the first module in the list is run first. An alternative to this to guarantee this ordering is to call ``app.setup_extension('runestone.common')`` in every extension. - modules.insert(0, modules.pop(modules.index("runestone.common"))) + modules.insert(0, modules.pop(modules.index('runestone.common'))) + # ``runestone.updateConfig`` is reserved for testing and will only be included if ``test`` is the second to last element of tha path + if 'test' != os.path.split(os.getcwd())[-1]: + modules.remove('runestone.updateConfig') + return modules diff --git a/runestone/assess/assess.py b/runestone/assess/assess.py index de7563cca..634975b6f 100644 --- a/runestone/assess/assess.py +++ b/runestone/assess/assess.py @@ -33,7 +33,7 @@ def setup(app): app.add_directive("timed", TimedDirective) 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") diff --git a/runestone/assess/js/mchoice.js b/runestone/assess/js/mchoice.js index c5516661a..869b17938 100644 --- a/runestone/assess/js/mchoice.js +++ b/runestone/assess/js/mchoice.js @@ -35,6 +35,7 @@ MultipleChoice.prototype.init = function (opts) { this.multipleanswers = false; this.divid = orig.id; this.caption = 'Multiple Choice' + this.showcomparebutton = $(orig).data('showcomparebutton'); if ($(this.origElem).data("multipleanswers") === true) { this.multipleanswers = true; @@ -233,7 +234,7 @@ MultipleChoice.prototype.renderMCFormButtons = function () { this.optsForm.appendChild(this.submitButton); // Create compare button - if (this.useRunestoneServices) { + if (this.useRunestoneServices && this.showcomparebutton) { this.compareButton = document.createElement("button"); $(this.compareButton).attr({ "class": "btn btn-default", diff --git a/runestone/assess/multiplechoice.py b/runestone/assess/multiplechoice.py index c243c3908..5601f4fe2 100644 --- a/runestone/assess/multiplechoice.py +++ b/runestone/assess/multiplechoice.py @@ -149,6 +149,7 @@ class MChoice(Assessment): config values (conf.py): - mchoice_div_class - custom CSS class of the component's outermost div + - mchoice_compare_button_show - if False, hide the 'Compare me' button (default True) """ required_arguments = 1 @@ -184,10 +185,16 @@ def run(self): super(MChoice, self).run() - TEMPLATE_START = """ + env = self.state.document.settings.env + if env.config.mchoice_compare_button_show: + self.options['showcomparebutton'] = 'data-showcomparebutton=true' + else: + self.options['showcomparebutton'] = 'data-showcomparebutton=false' + + TEMPLATE_START = '''
-