diff --git a/pagure/templates/new_issue.html b/pagure/templates/new_issue.html index b6c6cf3..495e75a 100644 --- a/pagure/templates/new_issue.html +++ b/pagure/templates/new_issue.html @@ -41,7 +41,10 @@ {{ render_bootstrap_field(form.private, field_description="Do you want to keep the issue private?") }}
Attach file - -{% endif %} - + {% if authenticated and repo_admin and type and type == 'edit' %} + + {% endif %} @@ -132,42 +134,43 @@ $(document).ready(function() { emoji_complete(json_url, folder); }); + {% endif %} $(function() { $( "#preview" ).hide(); $( "#previewinmarkdown" ).click( function(event, ui) { - if ($( "#previewinmarkdown" ).hasClass("inactive")){ - var _text = $( "#issue_content" ).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) { - var preview = emojione.toImage(res); - $( "#preview" ).html(preview); - $( "#previewinmarkdown" ).removeClass("inactive"); - $( "#previewinmarkdown" ).addClass("active"); - $( "#issue_content" ).hide(); - $( "#preview" ).show(); - }, - error: function() { - alert('Unable to generate preview!'+error); - } - }); - return false; - } else if ($( "#previewinmarkdown" ).hasClass("active")){ - $( "#previewinmarkdown" ).addClass("inactive"); - $( "#previewinmarkdown" ).removeClass("active"); - $( "#issue_content" ).show(); - $( "#preview" ).hide(); + if ($( "#previewinmarkdown" ).hasClass("inactive")){ + var _text = $( "#issue_content" ).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) { + var preview = emojione.toImage(res); + $( "#preview" ).html(preview); + $( "#previewinmarkdown" ).removeClass("inactive"); + $( "#previewinmarkdown" ).addClass("active"); + $( "#issue_content" ).hide(); + $( "#preview" ).show(); + }, + error: function() { + alert('Unable to generate preview!'+error); } + }); + return false; + } else if ($( "#previewinmarkdown" ).hasClass("active")){ + $( "#previewinmarkdown" ).addClass("inactive"); + $( "#previewinmarkdown" ).removeClass("active"); + $( "#issue_content" ).show(); + $( "#preview" ).hide(); + } } ); });