1 // ajax handling for report-issue function
3 on('ajax:send', function() {
4 var $sendButton = $('#report-issue-submit');
6 $sendButton.html('Sending...');
7 $sendButton.attr('disabled',true);
9 var $cancelButton = $('#report-issue-cancel');
11 $cancelButton.html('Close');
13 $('div').remove('.modal-footer-status');
15 on('ajax:success', function() {
16 var $sendButton = $('#report-issue-submit');
17 if ($sendButton && $sendButton.prop('disabled')) {
18 $sendButton.html('Report sent');
19 $('div').remove('.modal-footer-status');
20 $('.modal-footer').append('<div class="modal-footer-status alert alert-success"><div><p align="left">Thanks for reporting this issue!</p></div></div>');
23 on('ajax:failure', function() {
24 var $sendButton = $('#report-issue-submit');
25 if ($sendButton && $sendButton.prop('disabled')) {
26 $('div').remove('.modal-footer-status');
27 $('.modal-footer').append('<div class="modal-footer-status alert alert-danger"></br><p align="left">We are sorry. We could not submit your report! We really want this to work, though -- please try again.</p></div>');
28 $sendButton.html('Send problem report');
29 $sendButton.attr('disabled',false);
31 var $cancelButton = $('#report-issue-cancel');
33 var text = document.getElementById('report-issue-cancel').firstChild;
34 $cancelButton.html('Cancel');