Commit c1365ee1 by Jason Bau

Merge branch 'giulio/accessibility' into edx-west/release-20130608

parents 923e9455 238d6796
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
<div class="block block-comment">${comment}</div> <div class="block block-comment">${comment}</div>
<div class="block">${comment_prompt}</div> <div class="block">${comment_prompt}</div>
<textarea class="comment" id="input_${id}_comment" name="input_${id}_comment">${comment_value|h}</textarea> <textarea class="comment" id="input_${id}_comment" name="input_${id}_comment" aria-describedby="answer_${id}">${comment_value|h}</textarea>
<div class="block">${tag_prompt}</div> <div class="block">${tag_prompt}</div>
<ul class="tags"> <ul class="tags">
...@@ -22,11 +22,11 @@ ...@@ -22,11 +22,11 @@
<li> <li>
% if has_options_value: % if has_options_value:
% if all([c == 'correct' for c in option['choice'], status]): % if all([c == 'correct' for c in option['choice'], status]):
<span class="tag-status correct" id="status_${id}"></span> <span class="tag-status correct" id="status_${id}" aria-describedby="input_${id}_comment"><span class="sr">Status: Correct</span></span>
% elif all([c == 'partially-correct' for c in option['choice'], status]): % elif all([c == 'partially-correct' for c in option['choice'], status]):
<span class="tag-status partially-correct" id="status_${id}"></span> <span class="tag-status partially-correct" id="status_${id}" aria-describedby="input_${id}_comment"><span class="sr">Status: Partially Correct</span></span>
% elif all([c == 'incorrect' for c in option['choice'], status]): % elif all([c == 'incorrect' for c in option['choice'], status]):
<span class="tag-status incorrect" id="status_${id}"></span> <span class="tag-status incorrect" id="status_${id}" aria-describedby="input_${id}_comment"><span class="sr">Status: Incorrect</span></span>
% endif % endif
% endif % endif
...@@ -53,11 +53,11 @@ ...@@ -53,11 +53,11 @@
% endif % endif
% if status == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: Unanswered</span></span>
% elif status == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: Incorrect</span></span>
% elif status == 'incorrect' and not has_options_value: % elif status == 'incorrect' and not has_options_value:
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: Incorrect</span></span>
% endif % endif
<p id="answer_${id}" class="answer answer-annotation"></p> <p id="answer_${id}" class="answer answer-annotation"></p>
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
<div class="incorrect" id="status_${id}"> <div class="incorrect" id="status_${id}">
% endif % endif
<input type="text" name="input_${id}" id="input_${id}" data-input-id="${id}" value="${value|h}" <input type="text" name="input_${id}" id="input_${id}" aria-describedby="answer_${id}" data-input-id="${id}" value="${value|h}"
% if size: % if size:
size="${size}" size="${size}"
% endif % endif
/> />
<p class="status"> <p class="status" aria-describedby="input_${id}">
% if status == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif status == 'correct': % elif status == 'correct':
......
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
% if status == 'unsubmitted' or show_correctness == 'never': % if status == 'unsubmitted' or show_correctness == 'never':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}"></span>
% elif status == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}"><span class="sr">Status: correct</span></span>
% elif status == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"><span class="sr">Status: incorrect</span></span>
% elif status == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}"><span class="sr">Status: incomplete</span></span>
% endif % endif
% endif % endif
</div> </div>
...@@ -31,14 +31,29 @@ ...@@ -31,14 +31,29 @@
% endif % endif
% endif % endif
> >
<input type="${input_type}" name="input_${id}${name_array_suffix}" id="input_${id}_${choice_id}" value="${choice_id}" <input type="${input_type}" name="input_${id}${name_array_suffix}" id="input_${id}_${choice_id}" aria-describedby="answer_${id}" value="${choice_id}"
% if input_type == 'radio' and ( (isinstance(value, basestring) and (choice_id == value)) or (not isinstance(value, basestring) and choice_id in value) ): % if input_type == 'radio' and ( (isinstance(value, basestring) and (choice_id == value)) or (not isinstance(value, basestring) and choice_id in value) ):
checked="true" checked="true"
% elif input_type != 'radio' and choice_id in value: % elif input_type != 'radio' and choice_id in value:
checked="true" checked="true"
% endif % endif
/> ${choice_description} </label> /> ${choice_description}
% if input_type == 'radio' and ( (isinstance(value, basestring) and (choice_id == value)) or (not isinstance(value, basestring) and choice_id in value) ):
<%
if status == 'correct':
correctness = 'correct'
elif status == 'incorrect':
correctness = 'incorrect'
else:
correctness = None
%>
% if correctness and not show_correctness=='never':
<span class="sr" aria-describedby="input_${id}_${choice_id}">Status: ${correctness}</span>
% endif
% endif
</label>
% endfor % endfor
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
</fieldset> </fieldset>
......
<section id="textbox_${id}" class="textbox"> <section id="textbox_${id}" class="textbox">
<textarea rows="${rows}" cols="${cols}" name="input_${id}" id="input_${id}" <textarea rows="${rows}" cols="${cols}" name="input_${id}" aria-describedby="answer_${id}" id="input_${id}"
% if hidden: % if hidden:
style="display:none;" style="display:none;"
% endif % endif
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
<div class="grader-status"> <div class="grader-status">
% if status == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}">Unanswered</span> <span class="unanswered" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: </span>Unanswered</span>
% elif status == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}">Correct</span> <span class="correct" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: </span>Correct</span>
% elif status == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}">Incorrect</span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: </span>Incorrect</span>
% elif status == 'queued': % elif status == 'queued':
<span class="processing" id="status_${id}">Queued</span> <span class="processing" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: </span>Queued</span>
<span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span> <span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span>
% endif % endif
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
% endif % endif
<input type="text" name="input_${id}" id="input_${id}" value="${value|h}" style="display:none;"/> <input type="text" name="input_${id}" aria-describedby="answer_${id}" id="input_${id}" value="${value|h}" style="display:none;"/>
<p class="status"> <p class="status" aria-describedby="input_${id}">
% if status == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif status == 'correct': % elif status == 'correct':
......
...@@ -14,9 +14,9 @@ ...@@ -14,9 +14,9 @@
<div id="protex_container"></div> <div id="protex_container"></div>
<input type="hidden" name="target_shape" id="target_shape" value ="${target_shape}"></input> <input type="hidden" name="target_shape" id="target_shape" value ="${target_shape}"></input>
<input type="hidden" name="input_${id}" id="input_${id}" value="${value|h}"/> <input type="hidden" name="input_${id}" id="input_${id}" aria-describedby="answer_${id}" value="${value|h}"/>
<p class="status"> <p class="status" aria-describedby="input_${id}">
% if status == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif status == 'correct': % elif status == 'correct':
......
...@@ -19,10 +19,10 @@ ...@@ -19,10 +19,10 @@
% endif % endif
<input type="text" name="input_${id}" id="input_${id}" value="${value|h}" <input type="text" name="input_${id}" id="input_${id}" aria-describedby="answer_${id}" value="${value|h}"
style="display:none;"/> style="display:none;"/>
<p class="status"> <p class="status" aria-describedby="input_${id}">
% if status == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif status == 'correct': % elif status == 'correct':
......
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
<div id="genex_container"></div> <div id="genex_container"></div>
<input type="hidden" name="genex_dna_sequence" id="genex_dna_sequence" value ="${genex_dna_sequence}"></input> <input type="hidden" name="genex_dna_sequence" id="genex_dna_sequence" value ="${genex_dna_sequence}"></input>
<input type="hidden" name="genex_problem_number" id="genex_problem_number" value ="${genex_problem_number}"></input> <input type="hidden" name="genex_problem_number" id="genex_problem_number" value ="${genex_problem_number}"></input>
<input type="hidden" name="input_${id}" id="input_${id}" value="${value|h}"/> <input type="hidden" name="input_${id}" aria-describedby="answer_${id}" id="input_${id}" value="${value|h}"/>
<p class="status"> <p class="status" aria-describedby="input_${id}">
% if status == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif status == 'correct': % elif status == 'correct':
......
...@@ -16,13 +16,13 @@ ...@@ -16,13 +16,13 @@
<br/> <br/>
<input type="hidden" name="input_${id}" id="input_${id}" value="${value|h}"/> <input type="hidden" name="input_${id}" id="input_${id}" aria-describedby="answer_${id}" value="${value|h}"/>
<button id="reset_${id}" class="reset">Reset</button> <button id="reset_${id}" class="reset">Reset</button>
<p id="answer_${id}" class="answer"></p> <p id="answer_${id}" class="answer"></p>
<p class="status"> <p class="status" aria-describedby="input_${id}">
% if status == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif status == 'correct': % elif status == 'correct':
......
...@@ -5,12 +5,20 @@ ...@@ -5,12 +5,20 @@
</div> </div>
% if status == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: unanswered</span>
</span>
% elif status == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: correct</span>
</span>
% elif status == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: incorrect</span>
</span>
% elif status == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: incorrect</span>
</span>
% endif % endif
</span> </span>
...@@ -19,13 +19,21 @@ ...@@ -19,13 +19,21 @@
% endif % endif
% if status == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: unanswered</span>
</span>
% elif status == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: correct</span>
</span>
% elif status == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: incorrect</span>
</span>
% elif status == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: incorrect</span>
</span>
% endif % endif
% if msg: % if msg:
<br/> <br/>
......
<section id="textbox_${id}" class="textbox"> <section id="textbox_${id}" class="textbox">
<textarea rows="${rows}" cols="${cols}" name="input_${id}" id="input_${id}" <textarea rows="${rows}" cols="${cols}" name="input_${id}" aria-describedby="answer_${id}" id="input_${id}"
% if hidden: % if hidden:
style="display:none;" style="display:none;"
% endif % endif
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
<div class="grader-status"> <div class="grader-status">
% if status == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}">Unanswered</span> <span class="unanswered" style="display:inline-block;" id="status_${id}"><span class="sr">Status: </span>Unanswered</span>
% elif status == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}">Correct</span> <span class="correct" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: </span>Correct</span>
% elif status == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}">Incorrect</span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: </span>Incorrect</span>
% elif status == 'queued': % elif status == 'queued':
<span class="processing" id="status_${id}">Queued</span> <span class="processing" id="status_${id}" aria-describedby="input_${id}"><span class="sr">Status: </span>Queued</span>
<span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span> <span style="display:none;" class="xqueue" id="${id}" >${queue_len}</span>
% endif % endif
......
<form class="option-input"> <form class="option-input">
<select name="input_${id}" id="input_${id}" > <select name="input_${id}" id="input_${id}" aria-describedby="answer_${id}">
<option value="option_${id}_dummy_default"> </option> <option value="option_${id}_dummy_default"> </option>
% for option_id, option_description in options: % for option_id, option_description in options:
<option value="${option_id}" <option value="${option_id}"
...@@ -13,12 +13,20 @@ ...@@ -13,12 +13,20 @@
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
% if status == 'unsubmitted': % if status == 'unsubmitted':
<span class="unanswered" style="display:inline-block;" id="status_${id}"></span> <span class="unanswered" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: unsubmitted</span>
</span>
% elif status == 'correct': % elif status == 'correct':
<span class="correct" id="status_${id}"></span> <span class="correct" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: correct</span>
</span>
% elif status == 'incorrect': % elif status == 'incorrect':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: incorrect</span>
</span>
% elif status == 'incomplete': % elif status == 'incomplete':
<span class="incorrect" id="status_${id}"></span> <span class="incorrect" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: incomplete</span>
</span>
% endif % endif
</form> </form>
<span> <span>
<input type="hidden" class="schematic" height="${height}" width="${width}" parts="${parts}" analyses="${analyses}" name="input_${id}" id="input_${id}" value="" initial_value=""/> <input type="hidden" class="schematic" height="${height}" width="${width}" parts="${parts}" analyses="${analyses}" name="input_${id}" id="input_${id}" aria-describedby="answer_${id}" value="" initial_value=""/>
<div id="value_${id}" style="display:none">${value}</div> <div id="value_${id}" style="display:none">${value}</div>
<div id="initial_value_${id}" style="display:none">${initial_value}</div> <div id="initial_value_${id}" style="display:none">${initial_value}</div>
...@@ -13,13 +13,21 @@ ...@@ -13,13 +13,21 @@
<span id="answer_${id}"></span> <span id="answer_${id}"></span>
% if status == 'unsubmitted': % if status == 'unsubmitted':
<span class="ui-icon ui-icon-bullet" style="display:inline-block;" id="status_${id}"></span> <span class="ui-icon ui-icon-bullet" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: unsubmitted</span>
</span>
% elif status == 'correct': % elif status == 'correct':
<span class="ui-icon ui-icon-check" style="display:inline-block;" id="status_${id}"></span> <span class="ui-icon ui-icon-check" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: correct</span>
</span>
% elif status == 'incorrect': % elif status == 'incorrect':
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span> <span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: incorrect</span>
</span>
% elif status == 'incomplete': % elif status == 'incomplete':
<span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}"></span> <span class="ui-icon ui-icon-close" style="display:inline-block;" id="status_${id}" aria-describedby="input_${id}">
<span class="sr">Status: incomplete</span>
</span>
% endif % endif
</span> </span>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div style="display:none;" name="${hidden}" inputid="input_${id}" /> <div style="display:none;" name="${hidden}" inputid="input_${id}" />
% endif % endif
<input type="text" name="input_${id}" id="input_${id}" value="${value|h}" <input type="text" name="input_${id}" id="input_${id}" aria-describedby="answer_${id}" value="${value|h}"
% if do_math: % if do_math:
class="math" class="math"
% endif % endif
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
/> />
${trailing_text | h} ${trailing_text | h}
<p class="status"> <p class="status" aria-describedby="input_${id}">
% if status == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif status == 'correct': % elif status == 'correct':
......
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
<div class="incorrect" id="status_${id}"> <div class="incorrect" id="status_${id}">
% endif % endif
<input type="text" name="input_${id}" id="input_${id}" value="${value|h}" <input type="text" name="input_${id}" id="input_${id}" aria-describedby="answer_${id}" value="${value|h}"
style="display:none;" style="display:none;"
/> />
<p class="status"> <p class="status" aria-describedby="input_${id}">
% if status == 'unsubmitted': % if status == 'unsubmitted':
unanswered unanswered
% elif status == 'correct': % elif status == 'correct':
......
...@@ -555,6 +555,15 @@ section.problem { ...@@ -555,6 +555,15 @@ section.problem {
@extend .blue-button; @extend .blue-button;
} }
button.show {
height: ($baseline*2);
span {
font-size: 1.0em;
font-weight: 600;
}
}
.submission_feedback { .submission_feedback {
// background: #F3F3F3; // background: #F3F3F3;
// border: 1px solid #ddd; // border: 1px solid #ddd;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<input class="check" type="button" value="Check"> <input class="check" type="button" value="Check">
<input class="reset" type="button" value="Reset"> <input class="reset" type="button" value="Reset">
<input class="save" type="button" value="Save"> <input class="save" type="button" value="Save">
<input class="show" type="button" value="Show Answer"> <button class="show"><span class="show-label">Show Answer(s)</span> <span class="sr">(for question(s) above - adjacent to each field)</span></button>
<a href="/courseware/6.002_Spring_2012/${ explain }" class="new-page">Explanation</a> <a href="/courseware/6.002_Spring_2012/${ explain }" class="new-page">Explanation</a>
<section class="submission_feedback"></section> <section class="submission_feedback"></section>
</section> </section>
......
...@@ -62,7 +62,7 @@ describe 'Problem', -> ...@@ -62,7 +62,7 @@ describe 'Problem', ->
expect($('section.action input.reset')).toHandleWith 'click', @problem.reset expect($('section.action input.reset')).toHandleWith 'click', @problem.reset
it 'bind the show button', -> it 'bind the show button', ->
expect($('section.action input.show')).toHandleWith 'click', @problem.show expect($('section.action button.show')).toHandleWith 'click', @problem.show
it 'bind the save button', -> it 'bind the save button', ->
expect($('section.action input.save')).toHandleWith 'click', @problem.save expect($('section.action input.save')).toHandleWith 'click', @problem.save
...@@ -198,7 +198,7 @@ describe 'Problem', -> ...@@ -198,7 +198,7 @@ describe 'Problem', ->
it 'toggle the show answer button', -> it 'toggle the show answer button', ->
spyOn($, 'postWithPrefix').andCallFake (url, callback) -> callback(answers: {}) spyOn($, 'postWithPrefix').andCallFake (url, callback) -> callback(answers: {})
@problem.show() @problem.show()
expect($('.show')).toHaveValue 'Hide Answer' expect($('.show .show-label')).toHaveText 'Hide Answer(s)'
it 'add the showed class to element', -> it 'add the showed class to element', ->
spyOn($, 'postWithPrefix').andCallFake (url, callback) -> callback(answers: {}) spyOn($, 'postWithPrefix').andCallFake (url, callback) -> callback(answers: {})
...@@ -223,7 +223,7 @@ describe 'Problem', -> ...@@ -223,7 +223,7 @@ describe 'Problem', ->
expect($('label[for="input_1_1_3"]')).toHaveAttr 'correct_answer', 'true' expect($('label[for="input_1_1_3"]')).toHaveAttr 'correct_answer', 'true'
expect($('label[for="input_1_2_1"]')).not.toHaveAttr 'correct_answer', 'true' expect($('label[for="input_1_2_1"]')).not.toHaveAttr 'correct_answer', 'true'
describe 'when the answers are alreay shown', -> describe 'when the answers are already shown', ->
beforeEach -> beforeEach ->
@problem.el.addClass 'showed' @problem.el.addClass 'showed'
@problem.el.prepend ''' @problem.el.prepend '''
...@@ -243,7 +243,7 @@ describe 'Problem', -> ...@@ -243,7 +243,7 @@ describe 'Problem', ->
it 'toggle the show answer button', -> it 'toggle the show answer button', ->
@problem.show() @problem.show()
expect($('.show')).toHaveValue 'Show Answer' expect($('.show .show-label')).toHaveText 'Show Answer(s)'
it 'remove the showed class from element', -> it 'remove the showed class from element', ->
@problem.show() @problem.show()
......
...@@ -24,7 +24,7 @@ class @Problem ...@@ -24,7 +24,7 @@ class @Problem
@$('section.action input.check').click @check_fd @$('section.action input.check').click @check_fd
#@$('section.action input.check').click @check #@$('section.action input.check').click @check
@$('section.action input.reset').click @reset @$('section.action input.reset').click @reset
@$('section.action input.show').click @show @$('section.action button.show').click @show
@$('section.action input.save').click @save @$('section.action input.save').click @save
# Collapsibles # Collapsibles
...@@ -260,14 +260,14 @@ class @Problem ...@@ -260,14 +260,14 @@ class @Problem
@el.find('.problem > div').each (index, element) => @el.find('.problem > div').each (index, element) =>
MathJax.Hub.Queue ["Typeset", MathJax.Hub, element] MathJax.Hub.Queue ["Typeset", MathJax.Hub, element]
@$('.show').val 'Hide Answer' @$('.show-label').text 'Hide Answer(s)'
@el.addClass 'showed' @el.addClass 'showed'
@updateProgress response @updateProgress response
else else
@$('[id^=answer_], [id^=solution_]').text '' @$('[id^=answer_], [id^=solution_]').text ''
@$('[correct_answer]').attr correct_answer: null @$('[correct_answer]').attr correct_answer: null
@el.removeClass 'showed' @el.removeClass 'showed'
@$('.show').val 'Show Answer' @$('.show-label').text 'Show Answer(s)'
@el.find(".capa_inputtype").each (index, inputtype) => @el.find(".capa_inputtype").each (index, inputtype) =>
display = @inputtypeDisplays[$(inputtype).attr('id')] display = @inputtypeDisplays[$(inputtype).attr('id')]
......
...@@ -98,8 +98,10 @@ define('ElOutput', ['logme'], function (logme) { ...@@ -98,8 +98,10 @@ define('ElOutput', ['logme'], function (logme) {
); );
logme('Error message: "' + err.message + '".'); logme('Error message: "' + err.message + '".');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>');
$('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>'); $('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>');
}
paramNames.pop(); paramNames.pop();
......
...@@ -87,8 +87,10 @@ define('GLabelElOutput', ['logme'], function (logme) { ...@@ -87,8 +87,10 @@ define('GLabelElOutput', ['logme'], function (logme) {
); );
logme('Error message: "' + err.message + '".'); logme('Error message: "' + err.message + '".');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from string "' + funcString + '".' + '</div>');
$('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>'); $('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>');
}
paramNames.pop(); paramNames.pop();
......
...@@ -242,8 +242,10 @@ define('Graph', ['logme'], function (logme) { ...@@ -242,8 +242,10 @@ define('Graph', ['logme'], function (logme) {
); );
logme('Error message: "' + err.message + '"'); logme('Error message: "' + err.message + '"');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from the string "' + funcString + '".' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from the string "' + funcString + '".' + '</div>');
$('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>'); $('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>');
}
paramNames.pop(); paramNames.pop();
...@@ -709,6 +711,7 @@ define('Graph', ['logme'], function (logme) { ...@@ -709,6 +711,7 @@ define('Graph', ['logme'], function (logme) {
); );
logme('Error message: "' + err.message + '"'); logme('Error message: "' + err.message + '"');
if (state.showDebugInfo) {
$('#' + gstId).html( $('#' + gstId).html(
'<div style="color: red;">' + 'ERROR IN ' + '<div style="color: red;">' + 'ERROR IN ' +
'XML: Could not create a function from the string "' + 'XML: Could not create a function from the string "' +
...@@ -718,6 +721,7 @@ define('Graph', ['logme'], function (logme) { ...@@ -718,6 +721,7 @@ define('Graph', ['logme'], function (logme) {
'<div style="color: red;">' + 'Error ' + '<div style="color: red;">' + 'Error ' +
'message: "' + err.message + '".' + '</div>' 'message: "' + err.message + '".' + '</div>'
); );
}
return false; return false;
} }
...@@ -790,6 +794,7 @@ define('Graph', ['logme'], function (logme) { ...@@ -790,6 +794,7 @@ define('Graph', ['logme'], function (logme) {
); );
logme('Error message: "' + err.message + '"'); logme('Error message: "' + err.message + '"');
if (state.showDebugInfo) {
$('#' + gstId).html( $('#' + gstId).html(
'<div style="color: red;">' + 'ERROR IN ' + '<div style="color: red;">' + 'ERROR IN ' +
'XML: Could not create a function from the string "' + 'XML: Could not create a function from the string "' +
...@@ -799,6 +804,7 @@ define('Graph', ['logme'], function (logme) { ...@@ -799,6 +804,7 @@ define('Graph', ['logme'], function (logme) {
'<div style="color: red;">' + 'Error message: "' + '<div style="color: red;">' + 'Error message: "' +
err.message + '".' + '</div>' err.message + '".' + '</div>'
); );
}
return false; return false;
} }
...@@ -1006,8 +1012,10 @@ define('Graph', ['logme'], function (logme) { ...@@ -1006,8 +1012,10 @@ define('Graph', ['logme'], function (logme) {
); );
logme('Error message: "' + err.message + '"'); logme('Error message: "' + err.message + '"');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from the string "' + funcString + '".' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not create a function from the string "' + funcString + '".' + '</div>');
$('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>'); $('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>');
}
paramNames.pop(); paramNames.pop();
paramNames.pop(); paramNames.pop();
...@@ -1133,8 +1141,10 @@ define('Graph', ['logme'], function (logme) { ...@@ -1133,8 +1141,10 @@ define('Graph', ['logme'], function (logme) {
logme('ERROR: Could not determine xrange start.'); logme('ERROR: Could not determine xrange start.');
logme('Error message: "' + err.message + '".'); logme('Error message: "' + err.message + '".');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not determine xrange start from defined function.' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not determine xrange start from defined function.' + '</div>');
$('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>'); $('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>');
}
return false; return false;
} }
...@@ -1144,8 +1154,10 @@ define('Graph', ['logme'], function (logme) { ...@@ -1144,8 +1154,10 @@ define('Graph', ['logme'], function (logme) {
logme('ERROR: Could not determine xrange end.'); logme('ERROR: Could not determine xrange end.');
logme('Error message: "' + err.message + '".'); logme('Error message: "' + err.message + '".');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not determine xrange end from defined function.' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not determine xrange end from defined function.' + '</div>');
$('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>'); $('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>');
}
return false; return false;
} }
...@@ -1175,8 +1187,10 @@ define('Graph', ['logme'], function (logme) { ...@@ -1175,8 +1187,10 @@ define('Graph', ['logme'], function (logme) {
logme('ERROR: Could not generate data.'); logme('ERROR: Could not generate data.');
logme('Error message: "' + err.message + '".'); logme('Error message: "' + err.message + '".');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not generate data from defined function.' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not generate data from defined function.' + '</div>');
$('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>'); $('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>');
}
return false; return false;
} }
...@@ -1204,8 +1218,10 @@ define('Graph', ['logme'], function (logme) { ...@@ -1204,8 +1218,10 @@ define('Graph', ['logme'], function (logme) {
logme('ERROR: Could not generate data.'); logme('ERROR: Could not generate data.');
logme('Error message: "' + err.message + '".'); logme('Error message: "' + err.message + '".');
if (state.showDebugInfo) {
$('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not generate data from function.' + '</div>'); $('#' + gstId).html('<div style="color: red;">' + 'ERROR IN XML: Could not generate data from function.' + '</div>');
$('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>'); $('#' + gstId).append('<div style="color: red;">' + 'Error message: "' + err.message + '".' + '</div>');
}
return false; return false;
} }
......
...@@ -51,6 +51,8 @@ define( ...@@ -51,6 +51,8 @@ define(
// state object. // state object.
state = State(gstId, config); state = State(gstId, config);
state.showDebugInfo = false;
// It is possible that something goes wrong while extracting parameters // It is possible that something goes wrong while extracting parameters
// from the JSON config object. In this case, we will not continue. // from the JSON config object. In this case, we will not continue.
if (state === undefined) { if (state === undefined) {
......
...@@ -105,7 +105,7 @@ class TestStaffMasqueradeAsStudent(LoginEnrollmentTestCase): ...@@ -105,7 +105,7 @@ class TestStaffMasqueradeAsStudent(LoginEnrollmentTestCase):
resp = self.get_problem() resp = self.get_problem()
html = json.loads(resp.content)['html'] html = json.loads(resp.content)['html']
print html print html
sabut = '<input class="show" type="button" value="Show Answer">' sabut = '<button class="show"><span class="show-label">Show Answer(s)</span> <span class="sr">(for question(s) above - adjacent to each field)</span></button>'
self.assertTrue(sabut in html) self.assertTrue(sabut in html)
def test_no_showanswer_for_student(self): def test_no_showanswer_for_student(self):
...@@ -116,5 +116,5 @@ class TestStaffMasqueradeAsStudent(LoginEnrollmentTestCase): ...@@ -116,5 +116,5 @@ class TestStaffMasqueradeAsStudent(LoginEnrollmentTestCase):
resp = self.get_problem() resp = self.get_problem()
html = json.loads(resp.content)['html'] html = json.loads(resp.content)['html']
print html print html
sabut = '<input class="show" type="button" value="Show Answer">' sabut = '<button class="show"><span class="show-label">Show Answer(s)</span> <span class="sr">(for question(s) above - adjacent to each field)</span></button>'
self.assertFalse(sabut in html) self.assertFalse(sabut in html)
...@@ -620,7 +620,7 @@ def upload(request, course_id): # ajax upload file to a question or answer ...@@ -620,7 +620,7 @@ def upload(request, course_id): # ajax upload file to a question or answer
raise exceptions.PermissionDenied(msg) raise exceptions.PermissionDenied(msg)
except exceptions.PermissionDenied, err: except exceptions.PermissionDenied, err:
error = unicode(e) error = unicode(err)
except Exception, err: except Exception, err:
print err print err
logging.critical(unicode(err)) logging.critical(unicode(err))
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</%def> </%def>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html lang="en-us">
<head> <head>
<%block name="title"> <%block name="title">
% if stanford_theme_enabled(): % if stanford_theme_enabled():
......
...@@ -10,19 +10,19 @@ ...@@ -10,19 +10,19 @@
${ problem['html'] } ${ problem['html'] }
<section class="action"> <section class="action">
<input type="hidden" name="problem_id" value="${ problem['name'] }"> <input type="hidden" name="problem_id" value="${ problem['name'] }" />
% if check_button: % if check_button:
<input class="check ${ check_button }" type="button" value="${ check_button }"> <input class="check ${ check_button }" type="button" value="${ check_button }" />
% endif % endif
% if reset_button: % if reset_button:
<input class="reset" type="button" value="Reset"> <input class="reset" type="button" value="Reset" />
% endif % endif
% if save_button: % if save_button:
<input class="save" type="button" value="Save"> <input class="save" type="button" value="Save" />
% endif % endif
% if answer_available: % if answer_available:
<input class="show" type="button" value="Show Answer"> <button class="show"><span class="show-label">Show Answer(s)</span> <span class="sr">(for question(s) above - adjacent to each field)</span></button>
% endif % endif
% if attempts_allowed : % if attempts_allowed :
<section class="submission_feedback"> <section class="submission_feedback">
......
## The JS for this is defined in xqa_interface.html ## The JS for this is defined in xqa_interface.html
${module_content} ${module_content}
%if location.category in ['problem','video','html','combinedopenended']: %if location.category in ['problem','video','html','combinedopenended','graphical_slider_tool']:
% if edit_link: % if edit_link:
<div> <div>
<a href="${edit_link}">Edit</a> <a href="${edit_link}">Edit</a>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment