From d36a3553e23b3798b8978864f73faf059d1d3ee0 Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jul 10 2018 07:38:27 +0000 Subject: Re-style the compare commits page This restyles the compare commits page, removing the tabbed interface, and general style updates. Signed-off-by: Ryan Lerch --- diff --git a/pagure/templates/repo_comparecommits.html b/pagure/templates/repo_comparecommits.html index d8d835b..16764a3 100644 --- a/pagure/templates/repo_comparecommits.html +++ b/pagure/templates/repo_comparecommits.html @@ -17,123 +17,117 @@ {% endblock %} {% block repo %} -

Diff - (tree)

-
{{ commit1 }} .. {{ commit2 }}
- - - -
-
- - - -
- -
-
- {% for commit in diff_commits %} - - {% if pull_request and pull_request.status and pull_request.project_from.is_fork %} - {% set commit_link = url_for( - 'ui_ns.view_commit', - repo=pull_request.project_from.name, - username=pull_request.project_from.user.user, - namespace=repo.namespace, - commitid=commit.oid.hex)%} - {% set tree_link = url_for( - 'ui_ns.view_tree', username=pull_request.project_from.user.user, namespace=repo.namespace, - repo=repo.name, identifier=commit.hex) %} - {% elif pull_request and pull_request.remote %} - {% set commit_link = None %} - {% else %} - {% set commit_link = url_for('ui_ns.view_commit', - repo=repo.name, - username=username, - namespace=repo.namespace, - commitid=commit.oid.hex) %} - {% set tree_link = url_for( - 'ui_ns.view_tree', username=username, namespace=repo.namespace, - repo=repo.name, identifier=commit.hex) %} - {% endif %} -
-
-
- {% if commit_link %} - - {% endif %} - {{ commit.message.strip().split('\n')[0] }} - {% if commit_link %} - - {% endif %} -
- {{commit.author|author2user_commits( - link=url_for('ui_ns.view_commits', - repo=repo.name, - branchname=branchname, - username=username, - namespace=repo.namespace, - author=commit.author.email), - cssclass="notblue")|safe}} - • - {{ commit.commit_time|humanize }}   -
-
- +
+
+ {% block overviewtabs %}{{ super() }}{% endblock %} +
+
+

+
+
+ Commit Diff +
+
+
+ {{diff.stats.files_changed}} file{{'s' if diff.stats.files_changed > 1 }} changed
+
+
+ +{{diff.stats.insertions}} + -{{diff.stats.deletions}} +
+
+
+ {{ commit1 }} + .. + {{ commit2 }} +
+

+
+ {% for commit in diff_commits %} + {% if pull_request and pull_request.status and pull_request.project_from.is_fork %} + {% set commit_link = url_for( + 'ui_ns.view_commit', + repo=pull_request.project_from.name, + username=pull_request.project_from.user.user, + namespace=repo.namespace, + commitid=commit.oid.hex)%} + {% set tree_link = url_for( + 'ui_ns.view_tree', username=pull_request.project_from.user.user, namespace=repo.namespace, + repo=repo.name, identifier=commit.hex) %} + {% elif pull_request and pull_request.remote %} + {% set commit_link = None %} + {% else %} + {% set commit_link = url_for('ui_ns.view_commit', + repo=repo.name, + username=username, + namespace=repo.namespace, + commitid=commit.oid.hex) %} + {% set tree_link = url_for( + 'ui_ns.view_tree', username=username, namespace=repo.namespace, + repo=repo.name, identifier=commit.hex) %} + {% endif %} + {% if not loop.last and loop.index == 2 %} + + {% endif %} + {% if loop.first or loop.last%} +
+ {% else %} + + {% endfor %} +
+
+
+
+ + {{repo_renderdiff(diff=diff, + diff_commits=diff_commits, + pull_request=None, + repo=repo, + username=username, + namespace=namespace)}} + +
+
+
- -
- - {{repo_renderdiff(diff=diff, - diff_commits=diff_commits, - pull_request=None, - repo=repo, - username=username, - namespace=namespace)}} - -
-
-
{% endblock %} @@ -141,9 +135,12 @@ {{ super() }} diff --git a/pagure/ui/repo.py b/pagure/ui/repo.py index bce65c5..19d22d9 100644 --- a/pagure/ui/repo.py +++ b/pagure/ui/repo.py @@ -460,7 +460,7 @@ def compare_commits(repo, commit1, commit2, username=None, namespace=None): return flask.render_template( 'repo_comparecommits.html', - select='logs', + select='commits', origin='compare_commits', repo=repo, username=username, diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index 8ab08cd..69413f1 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -2049,14 +2049,11 @@ class PagureFlaskRepotests(tests.Modeltests): % (c2.oid.hex, c1.oid.hex), output_text) self.assertIn( - '
%s .. %s
' - % (c2.oid.hex, c1.oid.hex), + ' %s\n ..\n %s\n' % + (c2.oid.hex, c1.oid.hex), output_text) - self.assertIn( - 'Commits \n ' + - '' + - '\n 2\n ', + self.assertNotIn( + 'id="show_hidden_commits"', output_text) self.assertIn( '- ' + @@ -2069,14 +2066,11 @@ class PagureFlaskRepotests(tests.Modeltests): 'Diff from %s to %s - test\n - Pagure' % (c1.oid.hex, c2.oid.hex), output_text) - self.assertIn( - 'Commits \n ' + - '' + - '\n 2\n ', + self.assertNotIn( + 'id="show_hidden_commits"', output_text) self.assertIn( - '
%s .. %s
' % + ' %s\n ..\n %s\n' % (c1.oid.hex, c2.oid.hex), output_text) self.assertIn( @@ -2092,7 +2086,7 @@ class PagureFlaskRepotests(tests.Modeltests): 'Diff from %s to %s - test\n - Pagure' % (c1.oid.hex, c3.oid.hex), output_text) self.assertIn( - '
%s .. %s
' % + ' %s\n ..\n %s\n' % (c1.oid.hex, c3.oid.hex), output_text) self.assertIn( @@ -2103,10 +2097,7 @@ class PagureFlaskRepotests(tests.Modeltests): '+ Row 0'), 2) self.assertIn( - 'Commits \n ' + - '' + - '\n 3\n ', + '1 more commits...', output_text) self.assertIn( 'title="View file as of 4829cf">Šource', @@ -2125,7 +2116,7 @@ class PagureFlaskRepotests(tests.Modeltests): 'Diff from %s to %s - test\n - Pagure' % (c3.oid.hex, c1.oid.hex), output_text) self.assertIn( - '
%s .. %s
' % + ' %s\n ..\n %s\n' % (c3.oid.hex, c1.oid.hex), output_text) self.assertIn( @@ -2135,10 +2126,7 @@ class PagureFlaskRepotests(tests.Modeltests): '- ' + 'Row 0', output_text) self.assertIn( - 'Commits \n ' + - '' + - '\n 3\n ', + '1 more commits...', output_text) self.assertIn( 'title="View file as of 000000">Šource',