X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1acc76ca7c9d4c641a9a0f30f3498be8febbbacd..8a10f2ecd21a783cac5b0edd23c923a41e9cc801:/apps/workbench/app/assets/javascripts/report_issue.js diff --git a/apps/workbench/app/assets/javascripts/report_issue.js b/apps/workbench/app/assets/javascripts/report_issue.js index 482fd53548..a05cba5983 100644 --- a/apps/workbench/app/assets/javascripts/report_issue.js +++ b/apps/workbench/app/assets/javascripts/report_issue.js @@ -1,36 +1,31 @@ -// ajax handling for report-issue function $(document). - on('ajax:send', function() { - var $sendButton = $('#report-issue-submit'); - if ($sendButton) { - $sendButton.html('Sending...'); - $sendButton.attr('disabled',true); - } + on('click', "#report-issue-submit", function(e){ + $(this).html('Sending'); + $(this).attr('disabled', true); var $cancelButton = $('#report-issue-cancel'); if ($cancelButton) { $cancelButton.html('Close'); } $('div').remove('.modal-footer-status'); - }). - on('ajax:success', function() { - var $sendButton = $('#report-issue-submit'); - if ($sendButton && $sendButton.prop('disabled')) { - $sendButton.html('Report sent'); - $('div').remove('.modal-footer-status'); - $('.modal-footer').append(''); - } - }). - on('ajax:failure', function() { - var $sendButton = $('#report-issue-submit'); - if ($sendButton && $sendButton.prop('disabled')) { - $('div').remove('.modal-footer-status'); - $('.modal-footer').append(''); - $sendButton.html('Send problem report'); - $sendButton.attr('disabled',false); - } - var $cancelButton = $('#report-issue-cancel'); - if ($cancelButton) { - var text = document.getElementById('report-issue-cancel').firstChild; - $cancelButton.html('Cancel'); - } + + $.ajax('/'). + success(function(data, status, jqxhr) { + var $sendButton = $('#report-issue-submit'); + $sendButton.html('Report sent'); + $('div').remove('.modal-footer-status'); + $('.modal-footer').append(''); + }). + fail(function(jqxhr, status, error) { + var $sendButton = $('#report-issue-submit'); + if ($sendButton && $sendButton.prop('disabled')) { + $('div').remove('.modal-footer-status'); + $('.modal-footer').append(''); + $sendButton.html('Send problem report'); + $sendButton.attr('disabled',false); + } + var $cancelButton = $('#report-issue-cancel'); + var text = document.getElementById('report-issue-cancel').firstChild; + $cancelButton.html('Cancel'); + }); + });