From ee3f6dc65bc584d88426ae75623566493ed58a0b Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Dec 24 2015 09:22:04 +0000 Subject: Close the metadata form after updating them and fix indentation in the JS --- diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 8d5054b..867feb5 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -254,8 +254,6 @@ $(document).ready(function() { $(window.onload=highlight_comment()); $(window).on('hashchange', highlight_comment); - - $(".edit_btn").click(function() { var commentid = $( this ).attr('data-comment'); var _url = '{{ request.base_url }}' + '/comment/' + commentid + '/edit'; @@ -349,6 +347,8 @@ function try_async_comment(form) { $('#comment').val(''); $('#comments').find('.comment_body').show(); $('#comments').find('.edit_comment').remove(); + $( ".issue-metadata-form" ).hide(); + $( ".issue-metadata-display" ).show(); } else { // Make the browser submit the form sync $(form).off('submit'); @@ -413,7 +413,6 @@ $( document ).ready(function() { } }); - $('#blocks').selectize({ plugins: ['remove_button'], valueField: 'id', @@ -503,35 +502,35 @@ $( document ).ready(function() { $( "#preview" ).hide(); $( "#previewinmarkdown" ).click( function(event, ui) { - if ($( "#previewinmarkdown" ).hasClass("inactive")){ - var _text = $( "#comment" ).val(); - var _url = "{{ url_for('markdown_preview') }}"; - $.ajax({ - url: _url , - type: 'POST', - data: { - content: _text, - csrf_token: "{{ form.csrf_token.current_token }}", - }, - dataType: 'html', - success: function(res) { - $( "#preview" ).html(res); - $( "#previewinmarkdown" ).removeClass("inactive"); - $( "#previewinmarkdown" ).addClass("active"); - $( "#comment" ).hide(); - $( "#preview" ).show(); - }, - error: function() { - alert('Unable to generate preview!'); - } - }); - return false; - } else if ($( "#previewinmarkdown" ).hasClass("active")){ - $( "#previewinmarkdown" ).addClass("inactive"); - $( "#previewinmarkdown" ).removeClass("active"); - $( "#comment" ).show(); - $( "#preview" ).hide(); - } + if ($( "#previewinmarkdown" ).hasClass("inactive")){ + var _text = $( "#comment" ).val(); + var _url = "{{ url_for('markdown_preview') }}"; + $.ajax({ + url: _url , + type: 'POST', + data: { + content: _text, + csrf_token: "{{ form.csrf_token.current_token }}", + }, + dataType: 'html', + success: function(res) { + $( "#preview" ).html(res); + $( "#previewinmarkdown" ).removeClass("inactive"); + $( "#previewinmarkdown" ).addClass("active"); + $( "#comment" ).hide(); + $( "#preview" ).show(); + }, + error: function() { + alert('Unable to generate preview!'); + } + }); + return false; + } else if ($( "#previewinmarkdown" ).hasClass("active")){ + $( "#previewinmarkdown" ).addClass("inactive"); + $( "#previewinmarkdown" ).removeClass("active"); + $( "#comment" ).show(); + $( "#preview" ).hide(); + } } );