Skip to content

Commit

Permalink
Fix type and added some aria fields
Browse files Browse the repository at this point in the history
  • Loading branch information
amir-qayyum-khan committed Jul 30, 2015
1 parent 4690834 commit 31673b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion edx_sga/static/js/src/edx_sga.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ function StaffGradedAssignmentXBlock(runtime, element) {
}
}
});

updateChangeEvent(fileUpload);
if (!_.isUndefined(state.error)) {
$(content).find('p.error').focus();
}
}

function renderStaffGrading(data) {
Expand Down Expand Up @@ -175,10 +177,13 @@ function StaffGradedAssignmentXBlock(runtime, element) {
event.preventDefault();
if (isNaN(score)) {
form.find('.error').html('<br/>Grade must be a number.');
form.find('.error').focus();
} else if (score !== parseInt(score)) {
form.find('.error').html('<br/>Grade must be an integer.');
form.find('.error').focus();
} else if (score < 0) {
form.find('.error').html('<br/>Grade must be positive.');
form.find('.error').focus();
} else if (score > max_score) {
form.find('.error').html('<br/>Maximum score is ' + max_score);
} else {
Expand Down
10 changes: 5 additions & 5 deletions edx_sga/templates/staff_graded_assignment/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@
<% if (upload_allowed) { %>
<p>
<% if (uploaded) { %>
<span id="upload_lable">{% trans "Upload a different file" %}</span>
<span id="upload_label">{% trans "Upload a different file" %}</span>
<% } else { %>
<span id="upload_lable">{% trans "Upload your assignment" %}</span>
<span id="upload_label">{% trans "Upload your assignment" %}</span>
<% } %>
<div class="upload" aria-describedby="upload_lable" aria-live="polite">
<div class="upload" aria-describedby="upload_label" role="alert" aria-live="assertive">
<input class="fileupload" type="file" name="assignment"/>
<button>Select a file</button>
</div>
</p>
<% } %>
<% if (error) { %>
<p class="error"><%= error %></p>
<p class="error" role="alert" aria-live="assertive" tabindex="1"><%= error %></p>
<% } %>
</script>

Expand Down Expand Up @@ -165,7 +165,7 @@
<input id="submission_id-input" type="hidden" name="submission_id"/>
<div>Grade for <span id="student-name"/></div>
<div>Grade: <input id="grade-input" name="grade"/>
<span class="error"></span></div>
<span class="error" role="alert" aria-live="assertive" tabindex="1"></span></div>
<div>Comment: <textarea id="comment-input" name="comment" rows="4"></textarea></div>
<div>
<button type="submit">{% trans "Submit" %}</button>
Expand Down

0 comments on commit 31673b1

Please sign in to comment.