From f8bd9f9f94e958263fcf630b4cfcae2e51312121 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 24 2015 10:49:29 +0000 Subject: [PATCH 1/2] Rework the commit list to allow showing the entire commit message This commit puts all the list of commits into a table instead of a list to make it pretty and while we hide the content of the commit message by default, we add a button to show it if the user wishes. Fixes https://pagure.io/pagure/issue/387 --- diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css index 8153dc7..de775ba 100644 --- a/pagure/static/pagure.css +++ b/pagure/static/pagure.css @@ -406,8 +406,30 @@ pre { font-family: "courier new"; } +.commit_list table, +.commit_list td { + border-collapse: collapse; + margin: 0; +} + +.commit_list table { + width: 100%; +} + +.commit_list table .commitid, +.commit_list table .commit_msg_btn +{ + width: 8%; +} + +.commit_list table .commitdate +{ + width: 12%; +} + .tree_list li:nth-child(odd), .commit_list li:nth-child(odd), +.commit_list tr:nth-child(odd), .tag_list li:nth-child(odd), table.list tr:nth-child(odd) td { @@ -419,16 +441,19 @@ table.list tr:nth-child(odd) td } .commit_list ul, +.commit_list td, .tag_list ul, { padding-left: 0; } .commit_list li, +.commit_list td, .tag_list li { list-style-type: none; } .commit_list li, +.commit_list td, .tree_list li, .tag_list li { padding:0 .5em; @@ -436,20 +461,24 @@ table.list tr:nth-child(odd) td .tree_list li:hover, .commit_list li:hover, +.commit_list tr:hover, .tag_list li:hover, table.list tr:hover td - { color: white; background-color: #0066cc; + border-color: #0066cc; } .tree_list li:hover a, .commit_list li:hover a, +.commit_list tr:hover a, .tag_list li:hover a, .commit_list li:hover > a > span.commitid, +.commit_list tr:hover > a > span.commitid, .tag_list li:hover > a > span.tagid, .commit_list li:hover > a > span.commitdate, +.commit_list tr:hover > a > span.commitdate, .tree_list li:hover > a > span.filehex, table.list tr:hover td > a { @@ -457,6 +486,7 @@ table.list tr:hover td > a } .commit_list li > a:first-child, +.commit_list td > a:first-child, .tree_list li > a:first-child, .tag_list li > a:first-child, table.list tbody td > a @@ -465,6 +495,7 @@ table.list tbody td > a } .commit_list li > a > span.commitid, +.commit_list td > a > span.commitid, .tag_list li > a > span.tagid, .tree_list li > a > span.filehex { @@ -497,7 +528,8 @@ table.list tbody td > a overflow: auto; } -.commit_list li > a > span.commitdate +.commit_list li > a > span.commitdate, +.commit_list td > .commitdate { color: #4d4d4d; display: inline-block; @@ -905,11 +937,15 @@ span.CONFLICTS { color: #666!important; } -.tabs .ui-widget-content a{ +.tabs .ui-widget-content a, +.tabs .ui-widget-content table tr td a +{ color: #0066CC!important; } -.tabs .commit_list a:hover { +.tabs .commit_list a:hover, +.tabs .ui-widget-content table tr:hover > td a +{ color: white!important; } diff --git a/pagure/templates/pull_request.html b/pagure/templates/pull_request.html index 145250a..64a26a6 100644 --- a/pagure/templates/pull_request.html +++ b/pagure/templates/pull_request.html @@ -201,30 +201,38 @@
- + + {% for commit in diff_commits %} + + + + {% if commit.message.strip().split('\n') | length > 1 %} + + {% else %} + + {% endif %} + + + {% else %} + + {% endfor %} +
{{ commit.oid.hex|short }} + {% if pull_request and pull_request.status and pull_request.project_from.is_fork %} + + {% elif pull_request and pull_request.remote %} + + {% else %} + + {% endif %} + {{ commit.message.strip().split('\n')[0] }} +
+ {{ commit.message.strip().split('\n')[2:] | join('\n') }} +
+
+
more + {{ commit.commit_time|humanize }}
No commits found
@@ -364,6 +372,12 @@ $(document).ready(function() { + $( ".commit_msg_txt" ).hide(); + $( ".commit_msg_btn" ).click(function() { + var msgid = $( this ).attr('data-id'); + $( '#commit_msg_' + msgid).toggle(); + }); + var folder = '{{url_for("static", filename="emoji/png/") }}'; var json_url = '{{ url_for("static", filename="emoji/emoji_strategy.json") }}'; From f34d4f1b621a644ace50cfca2d38a8fd9a20a1c4 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sep 24 2015 10:49:30 +0000 Subject: [PATCH 2/2] Adjust unit-tests for change in the list of commits displayed on a pull-request --- diff --git a/tests/test_progit_flask_ui_fork.py b/tests/test_progit_flask_ui_fork.py index e1f605c..b76f52b 100644 --- a/tests/test_progit_flask_ui_fork.py +++ b/tests/test_progit_flask_ui_fork.py @@ -583,7 +583,7 @@ class PagureFlaskForktests(tests.Modeltests): self.assertIn( 'PR#1: PR from the feature branch - test - ' 'Pagure', output.data) - self.assertTrue(output.data.count(''), 1) + self.assertTrue(output.data.count(''), 1) shutil.rmtree(newpath) @@ -1270,7 +1270,7 @@ index 0000000..2a552bb 'Diff from master to feature - test - Pagure', output.data) self.assertIn( - '

No commits found

', output.data) + ' No commits found ', output.data) output = self.app.get('/test/diff/master..feature') self.assertEqual(output.status_code, 200) diff --git a/tests/test_progit_flask_ui_slash_branch_name.py b/tests/test_progit_flask_ui_slash_branch_name.py index 02691e1..97d6dbf 100644 --- a/tests/test_progit_flask_ui_slash_branch_name.py +++ b/tests/test_progit_flask_ui_slash_branch_name.py @@ -333,7 +333,7 @@ class PagureFlaskSlashInBranchtests(tests.Modeltests): output = self.app.get('/test/diff/master..maxamilion/feature') self.assertEqual(output.status_code, 200) self.assertEqual( - output.data.count(''), 1) + output.data.count(''), 1) self.assertIn('

.gitignore

', output.data)