Skip to content

Commit

Permalink
UI tweaks to submit button
Browse files Browse the repository at this point in the history
  • Loading branch information
karyon committed Aug 15, 2016
1 parent d3f0039 commit b6a0288
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions evap/student/templates/student_vote.html
Expand Up @@ -108,7 +108,12 @@ <h2>{{ course.name }} ({{ course.semester.name }})</h2>
var form = $('#student-vote-form');
form.submit(function (event) {
event.preventDefault(); // don't use the default submission
$('#vote-submit-btn').prop('disabled', true)
var submitButton = $('#vote-submit-btn');
var originalText = submitButton.val();

submitButton.val("Submitting...");
submitButton.prop('disabled', true);

$.ajax({
type: form.attr('method'),
url: form.attr('action'),
Expand All @@ -123,9 +128,10 @@ <h2>{{ course.name }} ({{ course.semester.name }})</h2>
},
error: function(data) {
// show a warning if the post isn't successful
$('#vote-submit-btn').effect("highlight", {color:"#eb595a"}, 2000);
document.getElementById('submit-error-warning').style.display = 'block';
$('#vote-submit-btn').prop('disabled', false)
submitButton.effect("highlight", {color:"#eb595a"}, 2000);
submitButton.val(originalText);
submitButton.prop('disabled', false);
}
});
return false;
Expand Down

0 comments on commit b6a0288

Please sign in to comment.