From 531aee27d9978b18c484fac062f1278f58c76487 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 19 2016 22:51:24 +0000 Subject: [PATCH 1/2] Clear the preview window after adding a comment via SSE --- diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index b2a2a2e..8dbeebc 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -411,6 +411,11 @@ function try_async_comment(form) { if(data == 'ok') { {# The event-source server will automatically refresh the UI #} $('#comment').val(''); + $('#preview').html(''); + $('#previewinmarkdown').addClass('inactive'); + $('#previewinmarkdown').removeClass('active'); + $('#preview').hide(); + $('#comment').show(); $('#comments').find('.comment_body').show(); $('#comments').find('.edit_comment').remove(); $( ".issue-metadata-form" ).hide(); From 48f7d0e3178aee3c3d9143aad41961a8e8dfa5b6 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Mar 20 2016 18:02:58 +0000 Subject: [PATCH 2/2] Clear the preview section after adding a comment in a PR via SSE --- diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 212bd46..a52602c 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -874,6 +874,11 @@ function try_async_comment(form, inline) { .done(function(data) { if(data == 'ok') { $('#comment').val(''); + $('#preview').html(''); + $('#previewinmarkdown').addClass('inactive'); + $('#previewinmarkdown').removeClass('active'); + $('#preview').hide(); + $('#comment').show(); /* We have submitted the comment correctly */ var item = $('.pr_comment_form').closest('tr'); if (!$(item.parent().children()[1]).is(':visible')){