diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 784bae6..9e0ce8b 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -580,13 +580,24 @@ source.addEventListener('message', function(e) { }, false); {% if authenticated and form %} +function set_ui_for_comment(setting){ + console.log(setting) + if (setting == false) { + $(document.body).find('input[type="submit"]').removeAttr("disabled"); + document.body.style.cursor = 'default'; + } else { + $(document.body).find('input[type="submit"]').attr("disabled", "disabled"); + document.body.style.cursor = 'wait'; + } +} function try_async_comment(form) { console.log(form) - $(form).find('input[type="submit"]').attr("disabled", "disabled"); + set_ui_for_comment(true); var _data = $(form).serialize(); var btn = $(document.activeElement); if (btn[0].name == 'drop_comment'){ _data += '&drop_comment=' + btn[0].value; + set_ui_for_comment(false); return true; } if (!sse) { @@ -611,6 +622,7 @@ function try_async_comment(form) { $( ".issue-metadata-display" ).show(); $( ".issue-custom-form" ).hide(); $( ".issue-custom-display" ).show(); + set_ui_for_comment(false); } else { // Make the browser submit the form sync $(form).off('submit'); @@ -622,7 +634,6 @@ function try_async_comment(form) { $(form).off('submit'); form.submit(); }) - $(form).find('input[type="submit"]').removeAttr("disabled"); return false; }; {% endif %}