X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/63fedb562b719408600b3b42c51bf0cbe4713006..9816d2cf5f88d19e4e492c1e965874e5a5b3055c:/apps/workbench/app/views/application/report_issue_popup.js.erb diff --git a/apps/workbench/app/views/application/report_issue_popup.js.erb b/apps/workbench/app/views/application/report_issue_popup.js.erb index 53edb4b96d..73830ee049 100644 --- a/apps/workbench/app/views/application/report_issue_popup.js.erb +++ b/apps/workbench/app/views/application/report_issue_popup.js.erb @@ -1,44 +1,12 @@ $("#report-issue-modal-window").html("<%= escape_javascript(render partial: 'report_issue_popup') %>"); +$("#report-issue-modal-window .modal").modal('show'); -// reset form input fields, for the next time around -function reset_form() { - $('#report_issue_text').val(""); - $('#additional_info').val(""); -} +// Disable the submit button on modal loading +$submit = $('#report-issue-submit'); +$submit.prop('disabled', true); -// 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); - } - 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('Report issue'); - $sendButton.attr('disabled',false); - } - var $cancelButton = $('#report-issue-cancel'); - if ($cancelButton) { - var text = document.getElementById('report-issue-cancel').firstChild; - $cancelButton.html('Cancel'); - } - }); +// capture events to enable submit button when applicable +$('#report_issue_text').bind('input propertychange', function() { + var problem_desc = document.forms["report-issue-form"]["report_issue_text"].value; + $submit.prop('disabled', (problem_desc === null) || (problem_desc === "")); +});