8784: Fix test for latest firefox.
[arvados.git] / apps / workbench / app / assets / javascripts / report_issue.js
1 $(document).
2   on('click', "#report-issue-submit", function(e){
3     $(this).html('Sending');
4     $(this).prop('disabled', true);
5     var $cancelButton = $('#report-issue-cancel');
6     if ($cancelButton) {
7       $cancelButton.html('Close');
8     }
9     $('div').remove('.modal-footer-status');
10
11     $.ajax('/report_issue', {
12         type: 'POST',
13         data: $(this).parents('form').serialize()
14     }).success(function(data, status, jqxhr) {
15         var $sendButton = $('#report-issue-submit');
16         $sendButton.html('Report sent');
17         $('div').remove('.modal-footer-status');
18         $('.modal-footer').append('<div><br/></div><div class="modal-footer-status alert alert-success"><p class="contain-align-left">Thanks for reporting this issue!</p></div>');
19     }).fail(function(jqxhr, status, error) {
20         var $sendButton = $('#report-issue-submit');
21         if ($sendButton && $sendButton.prop('disabled')) {
22           $('div').remove('.modal-footer-status');
23           $('.modal-footer').append('<div><br/></div><div class="modal-footer-status alert alert-danger"><p class="contain-align-left">We are sorry. We could not submit your report! We really want this to work, though -- please try again.</p></div>');
24           $sendButton.html('Send problem report');
25           $sendButton.prop('disabled', false);
26         }
27         var $cancelButton = $('#report-issue-cancel');
28         $cancelButton.html('Cancel');
29     });
30     return false;
31   });