From 67b178da81307bdaded62db099082354d7d33e5f Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 05 2016 21:19:40 +0000 Subject: [PATCH 1/3] Indentation fixes --- diff --git a/pagure/templates/_formhelper.html b/pagure/templates/_formhelper.html index ee22e92..996538a 100644 --- a/pagure/templates/_formhelper.html +++ b/pagure/templates/_formhelper.html @@ -13,41 +13,41 @@ {% endmacro %} {% macro render_bootstrap_field(field, field_description="", formclass="") %} -
- {% set formclasses = "form-control"%} - {% if field.errors %} {% set formclasses = formclasses + " form-control-error" %} {% endif %} - {% if field.type == "SelectField" %} {% set formclasses = formclasses + " c-select" %} {% endif %} + + {% if field.type == 'BooleanField' %} + {% set formclasses = formclasses + " checkbox-inline" %} + +
+ {% if field_description %} + {{ field_description }} + {% endif %} + {% else %} + {{ field.label }} + {{ field(class_=formclasses)|safe }} +
+ {% if field_description %} + {{field_description}} + {% endif %} + {% if field.errors %} + + + {% for error in field.errors %} + {{ error }}  + {% endfor %} + + + {% endif %} +
+ {% endif %} +
{% endmacro %} (class_="c-select") @@ -105,17 +105,18 @@ {% macro show_comment(comment, id, repo, username, issueid, form, repo_admin) %}
- {{ comment.user.default_email | avatar(16) | safe }} - - {{ comment.user.user }} - {{ comment.date_created | humanize}} - + {{ comment.user.default_email | avatar(16) | safe }} + + {{ comment.user.user }} + + + {{ comment.date_created | humanize}} +
-
- + class="edit_btn" data-comment="{{ comment.id }}" + data-objid="{{ issueid }}"> + {% endif %} {% if id != 0 and g.fas_user and ( (comment.parent.status in [True, 'Open'] and g.fas_user.username == comment.user.username) or repo_admin) %} - {% endif %}
@@ -171,24 +171,24 @@ {% macro show_initial_comment(comment, username, repo, issueid, repo_admin) %}
-
-
- {%- autoescape false -%} +
+
+ {%- autoescape false -%} {{ comment.content | markdown }} - {%- endautoescape -%} -
-
- + {%- endautoescape -%} +
+
+
{% endmacro %} diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index de2c328..6b1edc3 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -65,7 +65,7 @@ + placeholder="Enter your comment here" tabindex=1>
@@ -100,12 +100,12 @@
{% if authenticated and form %} -
- {{ form.csrf_token }} - {% endif %} + {{ form.csrf_token }} + {% endif %} {% if authenticated and repo_admin %} - + {% endif%} From a02e40113d516598e8f50e8a26dd54f92fd23620 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 05 2016 21:19:40 +0000 Subject: [PATCH 2/3] Add a link to the markdown syntax near the input fields for comments Fixes https://pagure.io/pagure/issue/710 --- diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 6b1edc3..0417899 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -78,13 +78,17 @@
0%
+ Markdown Syntax
- - + +
{% else %} diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index a6aebbe..4ab71ea 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -341,14 +341,18 @@ + placeholder="Enter your comment here" tabindex=1>
+ Markdown Syntax
- - + +
{% else %} From c3b75f5636e39a5e1b7e0887a4298ebcac15786c Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 05 2016 21:19:40 +0000 Subject: [PATCH 3/3] Adjust unit-tests for the change in indentation in the HTML --- diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py index fcd5ded..c15c844 100644 --- a/tests/test_pagure_flask_ui_app.py +++ b/tests/test_pagure_flask_ui_app.py @@ -161,23 +161,24 @@ class PagureFlaskApptests(tests.Modeltests): self.assertEqual(output.status_code, 200) self.assertIn('Create new Project', output.data) self.assertIn( - '\n This field is required.' - ' \n ', output.data) + '\n This field is required. \n' + ' ', output.data) data['name'] = 'project-1' output = self.app.post('/new/', data=data) self.assertEqual(output.status_code, 200) self.assertIn('Create new Project', output.data) self.assertNotIn( - '\n This field is required.' - ' \n ', output.data) + '\n This field is required. \n' + ' ', output.data) data['csrf_token'] = csrf_token output = self.app.post('/new/', data=data) self.assertEqual(output.status_code, 200) self.assertIn('Create new Project', output.data) self.assertIn( - '\n No user "username" found', + '\n No user ' + '"username" found\n
', output.data) user.username = 'foo' diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py index e093181..fab24c2 100644 --- a/tests/test_pagure_flask_ui_issues.py +++ b/tests/test_pagure_flask_ui_issues.py @@ -1163,11 +1163,11 @@ class PagureFlaskIssuestests(tests.Modeltests): '
\n Edit ' 'issue #1\n
' in output.data) self.assertEqual(output.data.count( - '\n This field is required' - '. \n '), 1) + '\n This field is required. \n' + ' '), 1) self.assertEqual(output.data.count( - '\n Not a valid choice' - ' \n '), 1) + '\n Not a valid choice ' + '\n '), 1) data['status'] = 'Open' data['title'] = 'Test issue #1' @@ -1177,11 +1177,11 @@ class PagureFlaskIssuestests(tests.Modeltests): '
\n Edit ' 'issue #1\n
' in output.data) self.assertEqual(output.data.count( - '\n This field is required' - '. \n '), 0) + '\n This field is required. \n' + ' '), 0) self.assertEqual(output.data.count( - '\n Not a valid choice' - '. \n '), 0) + '\n Not a valid choice ' + '\n '), 0) data['csrf_token'] = csrf_token output = self.app.post(