Commit e8ebf79b by Brian Talbot

Merge pull request #125 from edx/will/peer-enable-disable-button

Self/Peer assessment buttons enable/disable
parents eab29bc5 32596ffa
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<div class="peer-assessment__actions"> <div class="peer-assessment__actions">
<ul class="list list--actions"> <ul class="list list--actions">
<li class="list--actions__item"> <li class="list--actions__item">
<button type="submit" id="peer-assessment--001__assessment__submit" class="action action--submit"> <button type="submit" id="peer-assessment--001__assessment__submit" class="action action--submit is--disabled">
<span class="copy">{{ submit_button_text }}</span> <span class="copy">{{ submit_button_text }}</span>
<i class="ico icon-caret-right"></i> <i class="ico icon-caret-right"></i>
</button> </button>
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
<div class="self-assessment__actions"> <div class="self-assessment__actions">
<ul class="list list--actions"> <ul class="list list--actions">
<li class="list--actions__item"> <li class="list--actions__item">
<button type="submit" id="self-assessment--001__assessment__submit" class="action action--submit"> <button type="submit" id="self-assessment--001__assessment__submit" class="action action--submit is--disabled">
<span class="copy">{% trans "Submit Your Assessment" %}</span> <span class="copy">{% trans "Submit Your Assessment" %}</span>
<i class="ico icon-caret-right"></i> <i class="ico icon-caret-right"></i>
</button> </button>
......
...@@ -111,6 +111,17 @@ OpenAssessment.BaseUI.prototype = { ...@@ -111,6 +111,17 @@ OpenAssessment.BaseUI.prototype = {
var sel = $('#openassessment__peer-assessment', ui.element); var sel = $('#openassessment__peer-assessment', ui.element);
sel.replaceWith(html); sel.replaceWith(html);
// Install a change handler for rubric options to enable/disable the submit button
$("#peer-assessment--001__assessment", ui.element).change(
function() {
var numChecked = $('input[type=radio]:checked', this).length;
var numAvailable = $('.field--radio.assessment__rubric__question', this).length;
$("#peer-assessment--001__assessment__submit", ui.element).toggleClass(
'is--disabled', numChecked != numAvailable
);
}
);
// Install a click handler for assessment // Install a click handler for assessment
$('#peer-assessment--001__assessment__submit', ui.element).click( $('#peer-assessment--001__assessment__submit', ui.element).click(
function(eventObject) { function(eventObject) {
...@@ -140,6 +151,17 @@ OpenAssessment.BaseUI.prototype = { ...@@ -140,6 +151,17 @@ OpenAssessment.BaseUI.prototype = {
function(html) { function(html) {
$('#openassessment__self-assessment', ui.element).replaceWith(html); $('#openassessment__self-assessment', ui.element).replaceWith(html);
// Install a change handler for rubric options to enable/disable the submit button
$("#self-assessment--001__assessment", ui.element).change(
function() {
var numChecked = $('input[type=radio]:checked', this).length;
var numAvailable = $('.field--radio.assessment__rubric__question', this).length;
$("#self-assessment--001__assessment__submit", ui.element).toggleClass(
'is--disabled', numChecked != numAvailable
);
}
);
// Install a click handler for the submit button // Install a click handler for the submit button
$('#self-assessment--001__assessment__submit', ui.element).click( $('#self-assessment--001__assessment__submit', ui.element).click(
function(eventObject) { function(eventObject) {
......
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