diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css index f2a026c..1c2cd28 100644 --- a/pagure/static/pagure.css +++ b/pagure/static/pagure.css @@ -811,8 +811,37 @@ a.nav-link.btn{ font-size:0.9em; } +.opacity-100{ + opacity:1!important; +} + .autogenerated-comment p{ margin-bottom:0; } +.custom-file.comment-upload-browse{ + width:100%!important; + height:1.5em!important; +} + +.custom-file.comment-upload-browse .custom-file-control:lang(en)::before{ + content: "\f1c5\00a0\00a0 Browse"; + font-family: FontAwesome; + font-weight:bold; + color:#666; +} +.custom-file.comment-upload-browse .custom-file-control::before{ + height:1.5em; + padding:0.9em 1em; + line-height: 0.1em; + border-radius: 0.25rem; +} + +.custom-file.comment-upload-browse .custom-file-control{ + height:1.5em; + padding:0.9em 1em; + line-height: 0.1em; + color:#777; + border:0; +} diff --git a/pagure/static/upload.js b/pagure/static/upload.js index 632bdec..5d7e8ef 100644 --- a/pagure/static/upload.js +++ b/pagure/static/upload.js @@ -9,6 +9,7 @@ function doUpload(csrf_token, files) { $("#progress").show(); + $(".custom-file.comment-upload-browse").hide(); var $progressBar = $("#progress-bar"); // Gray out the form. @@ -78,12 +79,14 @@ function doUpload(csrf_token, files) { setTimeout( function(){ $("#progress").hide() + $(".custom-file.comment-upload-browse").show(); }, 1000 /* 1 000ms = 2 s */ ); }, error: function(data) { $("#progress").hide(); + $(".custom-file.comment-upload-browse").show(); var text = data.responseText; if ( !text || text === "" ) { text = '

An error occured when uploading your file. Could it be ' diff --git a/pagure/templates/_formhelper.html b/pagure/templates/_formhelper.html index 2e35fe3..ed06d4f 100644 --- a/pagure/templates/_formhelper.html +++ b/pagure/templates/_formhelper.html @@ -300,31 +300,14 @@ {{ comment.content | markdown | noJS | safe }} -

+
{% if g.fas_user %} - - + Reply {% endif %} - {% if g.repo_committer or ( - g.fas_user and g.fas_user.username == comment.user.username) %} - - - {% endif %} - {% if g.repo_committer %} - - {% endif %}
diff --git a/pagure/templates/issue.html b/pagure/templates/issue.html index 10d511d..f994dfb 100644 --- a/pagure/templates/issue.html +++ b/pagure/templates/issue.html @@ -16,37 +16,162 @@ {% endblock %} {% block repo %} +
+

+ {% if g.authenticated and g.repo_user %} + + {% endif %} +
+ {% if issue.private %} + + {% endif %} + {% if issue.status == 'Open' %} + + #{{issue.id}} + {% elif issue.status == 'Closed' %} + + #{{issue.id}} + {% endif %} + + {{ issue.title | noJS(ignore="img") | safe}} + + {% if g.repo_committer or ( + g.fas_user and g.fas_user.username == issue.user.username) %} + + + {% endif %} +
+
+ + {% if issue.status == 'Open' %} + + Opened {{ issue.date_created |humanize }} + + by {{ issue.user.user }}. + + Modified {{ issue.last_updated |humanize }} + + {% elif issue.status == 'Closed' %} + + + {% if issue.close_status %} + Closed: {{issue.close_status}} + {% else %} + Closed + {% endif %} + {{ issue.closed_at |humanize }} + + by + {{ issue.user.user }}. + + Opened {{ issue.date_created |humanize }} + + by {{ issue.user.user }}. + {% endif %} + +
+

+
+
+ +
+
+
+
+}}" method="post" onsubmit="return try_async_comment(this)" class="mainform"> {{ form.csrf_token }} -
-
-

- #{{ issueid }} - {{issue.title | noJS("img") | safe }} - {% if issue.private %} - - {% endif %} -

- -
- Created {{ issue.date_created | humanize}} by {{ issue.user.user }} -
- {% if issue.last_updated %} -
- Modified {{ issue.last_updated | humanize}} -
- {% endif %} -
+
+
{{ show_initial_comment(issue, username, repo,issueid, form) }} +
+ {% if attachments %}
{{ show_attachments(attachments) }} @@ -54,19 +179,18 @@ namespace=repo.namespace, repo=repo.name, issueid=issueid)
{% endif %} -
+
{% if issue.comments %} {% for comment in issue.comments %} {% if comment.notification %} -
-
-
-
- {{ - comment.date_created | humanize }} -
- {{ comment.comment | markdown | noJS | safe }} -
+
+
+ {{ comment.user.default_email | avatar(24) | safe }} +
+ {{ comment.comment | markdown | noJS | safe }} +
+ {{ + comment.date_created | humanize }}
{% else %} @@ -76,40 +200,84 @@ namespace=repo.namespace, repo=repo.name, issueid=issueid) {% endif %}
-
-
- -
{% if g.authenticated and form and not repo.settings.get('issue_tracker_read_only', False) %} - - - Preview - - - {% if repo.quick_replies %} - {% include "quick_reply.html" %} - {% endif %} - - -
-
- - Select files OR drag them into the comment field above. - - - Markdown Syntax -
- +
+
+
+
+ Add new comment +
+
+ + {% if repo.quick_replies %} + {% include "quick_reply.html" %} + {% endif %} +
+
+
+
+ +
+
+
+ + +
+
+
{% elif g.authenticated and form and repo.settings.get('issue_tracker_read_only', False) %}

@@ -121,49 +289,86 @@ namespace=repo.namespace, repo=repo.name, issueid=issueid) to comment on this ticket.

{% endif %} -
-
-
-
-
- - +
+
+
+
Metadata
+ {% if g.authenticated and (g.repo_user or g.fas_user.username == issue.user.user) + and not repo.settings.get('issue_tracker_read_only', False) %} +
+ + +
+ {% endif %} +
{% if g.authenticated and (g.repo_user or g.fas_user.username == issue.user.user) %} - {{ render_bootstrap_field(form.status, - formclass="issue-metadata-form") }} - {{ render_bootstrap_field(form.close_status, - formclass="issue-metadata-form") }} + {% endif%} -
+ {% endif%} {% if g.authenticated and g.repo_user %} @@ -184,60 +392,34 @@ namespace=repo.namespace, repo=repo.name, issueid=issueid) {% endif%} - - - {% if g.authenticated and g.repo_user %} - - {% endif%} + {%macro blocks_item(ticket, itemtype="block") %} +
+
+ + #{{ticket.id}} +
+ +
+ {% endmacro %} - {% endif%} - {% if g.authenticated and g.repo_user %} @@ -275,12 +455,14 @@ namespace=repo.namespace, repo=repo.name, issueid=issueid) {% endif%} {% if repo.priorities %} -
@@ -509,7 +674,7 @@ $(document).ready(function() { } $("#comment").atwho(userConfig); - $('#assignee').selectize({ + $('.mainform #assignee').selectize({ valueField: 'user', labelField: 'user', searchField: 'user', @@ -797,10 +962,11 @@ function take_issue(){ var _data = {assignee: "{{ g.fas_user.username }}"}; $.post (_url, _data ).done( function(data) { - var _user_url = '\n' + '{{ g.fas_user.username }}' - + ''; + + ' — Drop
'; $('#assignee_plain').html(_user_url); $('#assignee').val("{{ g.fas_user.username }}"); setup_btn_take_drop(); @@ -821,8 +987,8 @@ function drop_issue(){ var _data = {assignee: ""}; $.post( _url, _data ).done( function(data) { - var _user_url = '\nunassigned' - + ''; + var _user_url = '
\nNone' + + ' — Take
'; $('#assignee_plain').html(_user_url); $('#assignee').val(""); setup_btn_take_drop(); @@ -846,6 +1012,32 @@ function setup_btn_take_drop(){ $( document ).ready(function() { +$(".close_status_dropdown_action").click(function(event){ + var status = "{{issue.status}}"; + if (status == "Open") { + $("#changestatusform #statusform_status").val("Closed"); + $("#changestatusform #statusform_close_status").val($(this).attr("data-value")); + } else { + $("#changestatusform #statusform_status").val("Open"); + } + $("#changestatusform").submit(); + +}); + +$(".comment_and_close_action").click(function(event){ + var status = "{{issue.status}}"; + if (status == "Open") { + $(".mainform #status").val("Closed"); + $(".mainform #close_status").val($(this).attr("data-value")); + } else { + $(".mainform #status").val("Open"); + } + $(".mainform").submit(); + +}); + + + var emojiStrategy; $.getJSON( @@ -879,7 +1071,7 @@ $( document ).ready(function() { } ); - $('#blocking').selectize({ + $('.mainform #blocking').selectize({ plugins: ['remove_button'], valueField: 'id', labelField: 'id', @@ -910,7 +1102,7 @@ $( document ).ready(function() { } }); - $('#depending').selectize({ + $('.mainform #depending').selectize({ plugins: ['remove_button'], valueField: 'id', labelField: 'id', @@ -947,7 +1139,7 @@ $( document ).ready(function() { {%endfor%} var items = available_tags.map(function(x) { return { item: x }; }); - $('#tag').selectize({ + $('.mainform #tag').selectize({ delimiter: ',', options: items, persist: false, @@ -958,9 +1150,9 @@ $( document ).ready(function() { }); $( "#preview" ).hide(); - $( "#previewinmarkdown" ).click( + +$( "#previewinmarkdown" ).click( function(event, ui) { - if ($( "#previewinmarkdown" ).hasClass("inactive")){ var _text = $( "#comment" ).val(); var _url = "{{ url_for('ui_ns.markdown_preview', repo=repo.name, @@ -975,29 +1167,31 @@ $( document ).ready(function() { }, dataType: 'html', success: function(res) { - var preview = emojione.toImage(res) + var preview = emojione.toImage(res); $( "#preview" ).html(preview); - $( "#previewinmarkdown" ).removeClass("inactive"); - $( "#previewinmarkdown" ).addClass("active"); - $( "#previewinmarkdown" ).text("Edit"); + $( "#previewinmarkdown" ).toggleClass("active"); + $( "#editinmarkdown" ).toggleClass("active"); $( "#comment" ).hide(); $( "#preview" ).show(); }, error: function() { - alert('Unable to generate preview!'); + alert('Unable to generate preview!'+error); } }); return false; - } else if ($( "#previewinmarkdown" ).hasClass("active")){ - $( "#previewinmarkdown" ).addClass("inactive"); - $( "#previewinmarkdown" ).removeClass("active"); - $( "#previewinmarkdown" ).text("Preview"); - $( "#comment" ).show(); - $( "#preview" ).hide(); - } } ); + $( "#editinmarkdown" ).click( + function(event, ui) { + $( "#editinmarkdown" ).toggleClass("active"); + $( "#previewinmarkdown" ).toggleClass("active"); + $( "#comment" ).show(); + $( "#preview" ).hide(); + } + ); + + {% if g.authenticated and ( g.repo_user or issue.user.user == g.fas_user.username diff --git a/tests/test_pagure_flask_ui_issue_pr_link.py b/tests/test_pagure_flask_ui_issue_pr_link.py index de0e24c..cb6d8fe 100644 --- a/tests/test_pagure_flask_ui_issue_pr_link.py +++ b/tests/test_pagure_flask_ui_issue_pr_link.py @@ -143,7 +143,7 @@ class PagureFlaskPrIssueLinkTest(tests.Modeltests): output = self.app.get('/test/issue/1') self.assertEqual(output.status_code, 200) self.assertNotIn( - 'Related PR(s)', + 'Related Pull Requests', output.get_data(as_text=True)) def test_ticket_link(self): @@ -153,7 +153,7 @@ class PagureFlaskPrIssueLinkTest(tests.Modeltests): output = self.app.get('/test/issue/2') self.assertEqual(output.status_code, 200) self.assertIn( - 'Related PR(s)', + 'Related Pull Requests', output.get_data(as_text=True)) diff --git a/tests/test_pagure_flask_ui_issues.py b/tests/test_pagure_flask_ui_issues.py index 104330d..2c42fc5 100644 --- a/tests/test_pagure_flask_ui_issues.py +++ b/tests/test_pagure_flask_ui_issues.py @@ -129,8 +129,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) # Project w/o issue tracker @@ -189,8 +189,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) # Check the image was uploaded self.assertIn( @@ -280,9 +280,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue3 - test3 - Pagure', output_text) self.assertIn( - '', + '\n', output_text) # Check the image was uploaded self.assertIn( @@ -340,8 +339,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) # Check the image was uploaded self.assertIn( @@ -407,9 +406,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue3 - test3 - Pagure', output_text) self.assertIn( - '', + '\n', output_text) # Check the image was uploaded self.assertIn( @@ -530,21 +528,19 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue3 - test - Pagure', output_text) self.assertIn( - '', + '\n', output_text) # Check the metadata self.assertIn( 'title="comma separated list of tags"\n ' 'value="tag2" />', output_text) self.assertIn( - 'placeholder="username"\n value="foo" />', + 'placeholder="username"\n value="foo" />\n', output_text) self.assertIn( - '
\n ' - '\n ' - '\n v2.0\n', output_text) + 'href="/test/roadmap/v2.0/"', + output_text) @patch('pagure.lib.git.update_git', MagicMock(return_value=True)) @patch('pagure.lib.notify.send_email', MagicMock(return_value=True)) @@ -602,16 +598,15 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue3 - test - Pagure', output_text) self.assertIn( - '', + '\n', output_text) # Check the metadata self.assertNotIn( 'title="comma separated list of tags"\n ' 'value="tag2" />', output_text) self.assertNotIn( - 'placeholder="username"\n value="foo" />', + 'placeholder="username"\n value="foo" />\n', output_text) self.assertNotIn( '
\n ' @@ -1148,8 +1143,7 @@ class PagureFlaskIssuestests(tests.Modeltests): output_text = output.get_data(as_text=True) # Not authentified = No edit self.assertNotIn( - '', + '\n', output_text) self.assertIn( '' @@ -1191,8 +1185,8 @@ class PagureFlaskIssuestests(tests.Modeltests): output_text = output.get_data(as_text=True) # Not authentified = No edit self.assertNotIn( - '', + '\n', output_text) self.assertIn( '' @@ -1206,13 +1200,13 @@ class PagureFlaskIssuestests(tests.Modeltests): output_text = output.get_data(as_text=True) # Not author nor admin = No edit self.assertNotIn( - '', + '', output_text) self.assertNotIn( - '\n ' @@ -1743,11 +1737,11 @@ class PagureFlaskIssuestests(tests.Modeltests): # FIXME: There is likely something going wrong in the html # below self.assertIn( - '

Metadata Update from '\ - ''\ -'''@pingou:
-- Issue close_status updated to: Fixed
-- Issue status updated to: Closed (was: Open)

''', + '' + '

Metadata Update from ' + '@pingou:' + '
\n- Issue close_status updated to: Fixed
\n- Issue status updated to:' + ' Closed (was: Open)

\n', output_text) # Add new comment @@ -1765,8 +1759,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '\n Comment added', @@ -1782,10 +1776,10 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertTrue( '' in output_text) - # 2: one for the original comment, one for the new comment + # 3: one for the original comment, one for the new comment, one for the metadata update self.assertEqual( output_text.count('title="PY C (pingou)"'), - 2) + 3) # Add new tag data = { @@ -1802,8 +1796,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '

Woohoo a second comment!

', @@ -1829,8 +1823,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '
', + '', output_text) self.assertIn( '\n No user "ralph" found', @@ -1859,8 +1853,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '\n Issue assigned to pingou\n', @@ -1913,8 +1907,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #2: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '\n You cannot close a ticket ' @@ -1990,8 +1984,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) csrf_token = self.get_csrf(output=output) @@ -2009,8 +2003,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '\n Comment added', @@ -2054,8 +2048,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '\n Comment removed', @@ -2117,8 +2111,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) csrf_token = self.get_csrf(output=output) @@ -2136,8 +2130,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) # Add an invalid dependent ticket @@ -2153,8 +2147,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertNotIn( '\n ' @@ -2240,8 +2234,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) csrf_token = self.get_csrf(output=output) @@ -2259,8 +2253,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) # Add an invalid dependent ticket @@ -2276,8 +2270,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertNotIn( '\n ' @@ -2326,8 +2320,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) csrf_token = self.get_csrf(output=output) @@ -2675,8 +2669,8 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) self.assertIn( - '#1\n' - ' Test issue #1', + ' \n' + ' #1\n ', output_text) self.assertEqual(output_text.count( ''), 1) @@ -2740,8 +2734,8 @@ class PagureFlaskIssuestests(tests.Modeltests): self.assertEqual(output.status_code, 200) output_text = output.get_data(as_text=True) self.assertIn( - '#1\n' - ' Test issue', + ' \n' + ' #1\n ', output_text) self.assertEqual(output_text.count( ''), 1) @@ -3061,8 +3055,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '\n', output_text) csrf_token = self.get_csrf(output=output) @@ -3080,8 +3074,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '\n', output_text) self.assertIn( '\n Comment added', @@ -3129,8 +3123,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '\n Comment updated', @@ -3169,8 +3163,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '\n Comment updated', @@ -3227,7 +3221,9 @@ class PagureFlaskIssuestests(tests.Modeltests): output_text ) self.assertNotIn( - 'editmetadatatoggle">\n Edit Metadata', + '', + '', output_text) csrf_token = self.get_csrf(output=output) @@ -3823,8 +3821,8 @@ class PagureFlaskIssuestests(tests.Modeltests): 'Issue #1: Test issue - test - Pagure', output_text) self.assertIn( - '', + '', output_text) self.assertIn( '\n Comment added', diff --git a/tests/test_pagure_flask_ui_issues_acl_checks.py b/tests/test_pagure_flask_ui_issues_acl_checks.py index 8332513..aa93acc 100644 --- a/tests/test_pagure_flask_ui_issues_acl_checks.py +++ b/tests/test_pagure_flask_ui_issues_acl_checks.py @@ -113,8 +113,8 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): self.assertEqual(output.status_code, 200) # Not authentified = No edit self.assertNotIn( - '', + '\n', output.get_data(as_text=True)) self.assertTrue( '' @@ -128,18 +128,19 @@ class PagureFlaskIssuesACLtests(tests.Modeltests): output_text = output.get_data(as_text=True) # Not author nor admin = No edit self.assertNotIn( - '', + '\n', output_text) self.assertNotIn( - '\n ' 'Issue set to the milestone: %s\n' % mstone, output_text) self.assertIn( - '