diff --git a/pagure/templates/_formhelper.html b/pagure/templates/_formhelper.html index 93a7a63..d9dd2e7 100644 --- a/pagure/templates/_formhelper.html +++ b/pagure/templates/_formhelper.html @@ -175,32 +175,26 @@
-
-
- - - - {% if repo_admin or ( - g.fas_user and g.fas_user.username == comment.user.username) %} - - - {% endif %} - {% if repo_admin %} - - {{ form.csrf_token }} - {% endif %} -
-
+
+ + + + {% if repo_admin or ( + g.fas_user and g.fas_user.username == comment.user.username) %} + + + {% endif %} + {% if repo_admin %} + + {% endif %} +
{% endmacro %} diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index e35b11a..bddac95 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -15,8 +15,12 @@ {% block repo %}
-
+
+ {{ form.csrf_token }} +

#{{ issueid }} {{issue.title | noJS("img") | safe }} @@ -32,10 +36,6 @@ {{ show_initial_comment(issue, username, repo,issueid, repo_admin, form) }} - - {{ form.csrf_token }}
{% if issue.comments %} {% for comment in issue.comments %} @@ -43,7 +43,6 @@ {% endfor %} {% endif %}
-
@@ -51,12 +50,6 @@
{% if authenticated and form %} -
- {{ form.csrf_token }} -
@@ -72,7 +65,8 @@
Select files OR drag them into the comment field below. - + Markdown Syntax - - - - -
- - -
- +
+ + +
{% else %}

Login @@ -101,18 +90,11 @@

-

+
- {% if authenticated and form %} -
- {{ form.csrf_token }} - {% endif %}
+ +
{% endblock %} @@ -326,6 +323,27 @@ $(document).ready(function() { return false; }; + {% if repo_admin %} + $('#closeticket').click(function(event){ + event.preventDefault(); + var closeForm = jQuery('
', { + 'method': 'POST', + 'action': '{{ + url_for('.delete_issue', + username=username, repo=repo.name, issueid=issueid) }}', + }).append(jQuery('', { + 'name': 'csrf_token', + 'value': '{{ form.csrf_token.current_token }}', + 'type': 'hidden' + })).appendTo('body'); + console.log(closeForm); + if (confirm('Are you sure to delete this ticket? \nThis is final and cannot be un-done.')){ + console.log(closeForm.submit()); + } + return false; + }); + {% endif %} + $(window.onload=highlight_comment()); $(window).on('hashchange', highlight_comment); cancel_edit_btn(); @@ -375,7 +393,8 @@ source.addEventListener('message', function(e) { {% if authenticated and form %} function try_async_comment(form) { - $(form).find('input[type="submit"]').attr("disabled", "disabled"); + console.log(form) + $('body').find('input[type="submit"]').attr("disabled", "disabled"); var _data = $(form).serialize(); var btn = $(document.activeElement); if (btn[0].name == 'drop_comment'){ @@ -408,7 +427,7 @@ function try_async_comment(form) { $(form).off('submit'); form.submit(); }) - $(form).find('input[type="submit"]').removeAttr("disabled"); + $('body').find('input[type="submit"]').removeAttr("disabled"); return false; }; {% endif %}