Add 'apps/arv-web/' from commit 'f9732ad8460d013c2f28363655d0d1b91894dca5'
[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('/').
12       success(function(data, status, jqxhr) {
13         var $sendButton = $('#report-issue-submit');
14         $sendButton.html('Report sent');
15         $('div').remove('.modal-footer-status');
16         $('.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>');
17       }).
18       fail(function(jqxhr, status, error) {
19         var $sendButton = $('#report-issue-submit');
20         if ($sendButton && $sendButton.prop('disabled')) {
21           $('div').remove('.modal-footer-status');
22           $('.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>');
23           $sendButton.html('Send problem report');
24           $sendButton.prop('disabled', false);
25         }
26         var $cancelButton = $('#report-issue-cancel');
27         $cancelButton.html('Cancel');
28       });
29
30   });