From 1b960e3e17c214bff0afb804d1d8faf7470e0780 Mon Sep 17 00:00:00 2001 From: Ehtesham Date: Fri, 19 Aug 2016 19:51:36 +0500 Subject: [PATCH] requiring codemirror compressed with all addons included --- cms/static/cms/js/require-config.js | 1 + .../pipeline_js/templates/xmodule.js | 5 +- common/lib/capa/capa/capa_problem.py | 48 ++--- common/lib/capa/capa/inputtypes.py | 16 +- .../lib/capa/capa/templates/choicegroup.html | 16 +- .../capa/templates/formulaequationinput.html | 12 +- .../lib/capa/capa/templates/optioninput.html | 14 +- .../lib/capa/capa/templates/solutionspan.html | 4 +- common/lib/capa/capa/templates/textline.html | 19 +- .../lib/capa/capa/tests/test_capa_problem.py | 67 +++--- .../capa/capa/tests/test_input_templates.py | 86 +++++--- common/lib/capa/capa/tests/test_inputtypes.py | 2 + .../xmodule/xmodule/js/karma_xmodule.conf.js | 3 +- .../xmodule/js/spec/capa/display_spec.coffee | 2 +- .../xmodule/js/spec/problem/edit_spec.coffee | 204 ++++++++---------- .../js/spec/problem/edit_spec_hint.coffee | 52 +++-- .../xmodule/js/src/capa/display.coffee | 2 +- .../xmodule/js/src/problem/edit.coffee | 6 +- .../templates/problem/customgrader.yaml | 12 +- .../problem/optionresponse_hint.yaml | 6 +- .../templates/problem/problem_with_hint.yaml | 2 +- .../problem/string_response_hint.yaml | 10 +- common/static/js/lib/pretty-print.js | 106 +++++++++ .../static/js/spec/pretty_print_xml_spec.js | 20 ++ common/static/karma_common.conf.js | 1 + .../tests/lms/test_certificate_web_view.py | 6 +- lms/static/karma_lms_coffee.conf.js | 2 +- 27 files changed, 422 insertions(+), 302 deletions(-) create mode 100644 common/static/js/lib/pretty-print.js create mode 100644 common/static/js/spec/pretty_print_xml_spec.js diff --git a/cms/static/cms/js/require-config.js b/cms/static/cms/js/require-config.js index 45aadf6498..426fae9f59 100644 --- a/cms/static/cms/js/require-config.js +++ b/cms/static/cms/js/require-config.js @@ -28,6 +28,7 @@ 'mustache': 'js/vendor/mustache', 'codemirror': 'js/vendor/codemirror-compressed', 'codemirror/stex': 'js/vendor/CodeMirror/stex', + 'pretty-print': 'js/lib/pretty-print', 'jquery': 'common/js/vendor/jquery', 'jquery-migrate': 'common/js/vendor/jquery-migrate', 'jquery.ui': 'js/vendor/jquery-ui.min', diff --git a/common/djangoapps/pipeline_js/templates/xmodule.js b/common/djangoapps/pipeline_js/templates/xmodule.js index fb0c22d2c1..1b257bbd97 100644 --- a/common/djangoapps/pipeline_js/templates/xmodule.js +++ b/common/djangoapps/pipeline_js/templates/xmodule.js @@ -6,9 +6,8 @@ ## and attach them to the global context manually. define(["jquery", "underscore", "codemirror", "tinymce", "jquery.tinymce", "jquery.qtip", "jquery.scrollTo", "jquery.flot", - "jquery.cookie", - "utility"], - function($, _, CodeMirror, tinymce) { + "jquery.cookie", "pretty-print", "utility"], + function($, _, CodeMirror) { window.$ = $; window._ = _; require(['mathjax']); diff --git a/common/lib/capa/capa/capa_problem.py b/common/lib/capa/capa/capa_problem.py index fc32e2b4da..ae967438d7 100644 --- a/common/lib/capa/capa/capa_problem.py +++ b/common/lib/capa/capa/capa_problem.py @@ -36,14 +36,14 @@ from capa.safe_exec import safe_exec # extra things displayed after "show answers" is pressed solution_tags = ['solution'] -# fully accessible capa response types -ACCESSIBLE_CAPA_RESPONSE_TYPES = [ - 'choiceresponse', - 'multiplechoiceresponse', - 'optionresponse', - 'numericalresponse', - 'stringresponse', - 'formularesponse', +# fully accessible capa input types +ACCESSIBLE_CAPA_INPUT_TYPES = [ + 'checkboxgroup', + 'radiogroup', + 'choicegroup', + 'optioninput', + 'textline', + 'formulaequationinput', ] # these get captured as student responses @@ -911,6 +911,10 @@ class LoncapaProblem(object): responsetype_id (str): responsetype id problem_data (dict): dict to be filled with response data """ + # if there are no inputtypes then don't do anything + if not inputfields: + return + element_to_be_deleted = None label = '' @@ -938,35 +942,17 @@ class LoncapaProblem(object): # store