From 07cacaf73dfbbd54f4432a8edf309dc46247308f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 16 2016 10:50:05 +0000 Subject: [PATCH 1/9] Fix
tag --- diff --git a/pagure/templates/_formhelper.html b/pagure/templates/_formhelper.html index eddd8fb..82e63e0 100644 --- a/pagure/templates/_formhelper.html +++ b/pagure/templates/_formhelper.html @@ -25,7 +25,7 @@ {{ field.label }} -
+
{% if field_description %} {{ field_description }} {% endif %} From 24584d1cab6b49093527d3241a51105643f3d014 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 16 2016 10:50:05 +0000 Subject: [PATCH 2/9] Let's consider the h4, h5 and h6 HTML tags safe --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index e3cbb42..d81aa9f 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -2559,7 +2559,8 @@ def clean_input(text, ignore=None): attrs['img'] = filter_img_src tags = bleach.ALLOWED_TAGS + [ - 'p', 'br', 'div', 'h1', 'h2', 'h3', 'table', 'td', 'tr', 'th', + 'p', 'br', 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', + 'table', 'td', 'tr', 'th', 'col', 'tbody', 'pre', 'img', 'hr', 'dl', 'dt', 'dd', 'span', ] if ignore: From 6c8ca2c61188dc956a06648ace6113a9ac3ac66d Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 16 2016 10:50:05 +0000 Subject: [PATCH 3/9] Indentation fixes --- 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?") }}
- Preview + + Preview +
From 79367e04967f15f411fde05ab75f1df27c2e8a40 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 16 2016 10:50:05 +0000 Subject: [PATCH 8/9] Upon changing the ticket type, offer the reload the corresponding template --- diff --git a/pagure/templates/new_issue.html b/pagure/templates/new_issue.html index e227f0b..ca4b756 100644 --- a/pagure/templates/new_issue.html +++ b/pagure/templates/new_issue.html @@ -148,6 +148,33 @@ $(document).ready(function() { var json_url = '{{ url_for("static", filename="emoji/emoji_strategy.json") }}'; emoji_complete(json_url, folder); + $("#type").on("change", function() { + if ( !confirm('Do you want to load the new template?')){ + return false; + } + + var _type = $("#type").val(); + var _url = "{{ + url_for('internal_ns.get_ticket_template', + username=repo.username if repo.is_fork else None, + repo=repo.name) }}"; + _url += '?template=' + _type; + $.ajax({ + url: _url , + type: 'POST', + data: { + csrf_token: "{{ form.csrf_token.current_token }}", + }, + dataType: 'json', + success: function(res) { + $("#issue_content").val(res.message); + }, + error: function(res) { + alert('Unable to get this template'); + } + }); + }); + }); {% endif %} From f82d60bf0d4ea799538fe16875782b1d6e81afdc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 16 2016 10:50:05 +0000 Subject: [PATCH 9/9] Add a link to the markdown syntax supported in tickets --- diff --git a/pagure/templates/new_issue.html b/pagure/templates/new_issue.html index ca4b756..87ceaa8 100644 --- a/pagure/templates/new_issue.html +++ b/pagure/templates/new_issue.html @@ -89,6 +89,8 @@ {% endif %} {{ form.csrf_token }} + Markdown Syntax