From e57b081b0e1733ef5e7617dc3ac4b8eeff34368f Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Oct 20 2016 14:22:25 +0000 Subject: Add a link to the user on the commit list This adds a link to the user on the commit list. It required a little more playing than just adding the link, as the previous iteration had a single tag that just wrapped everything. So we had to pull this out, and add a link to the user on the username text. --- diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css index b7a79c6..04be8fd 100644 --- a/pagure/static/pagure.css +++ b/pagure/static/pagure.css @@ -406,6 +406,10 @@ a.notblue { text-decoration:none; } +a.notblue:hover { + color: #888; +} + #headerSearch .selectize-control.single .selectize-input::after { content: "\e08f"; diff --git a/pagure/templates/commits.html b/pagure/templates/commits.html index 131c552..fd52698 100644 --- a/pagure/templates/commits.html +++ b/pagure/templates/commits.html @@ -121,12 +121,7 @@
{% for commit in last_commits %} - {% if diff_commits and commit.oid.hex in diff_commits %} @@ -138,19 +133,25 @@
{% endif %}
- {{ commit.message.split('\n')[0] }} -
- - {{ commit.commit_time|humanize }} - -
+
+ {{ commit.message.split('\n')[0] }} +
+ + {{ commit.commit_time|humanize }} + +
+
- {{ commit.author | author2avatar(20) | safe }} {{ commit.author.name }} + {{commit.author|author2user(cssclass="notblue")|safe}}
{{ commit.hex|short }}
- + {% endfor %} diff --git a/pagure/ui/filters.py b/pagure/ui/filters.py index 024730a..b84a94b 100644 --- a/pagure/ui/filters.py +++ b/pagure/ui/filters.py @@ -331,7 +331,7 @@ def patch_to_diff(patch): @APP.template_filter('author2user') -def author_to_user(author, size=16): +def author_to_user(author, size=16, cssclass=None): """ Template filter transforming a pygit2 Author object into a text either with just the username or linking to the user in pagure. """ @@ -340,11 +340,19 @@ def author_to_user(author, size=16): return output user = pagure.lib.search_user(SESSION, email=author.email) if user: - output = "%s %s" % ( - avatar(user.default_email, size), - flask.url_for('view_user', username=user.username), - author.name, - ) + if cssclass: + output = "%s %s" % ( + avatar(user.default_email, size), + flask.url_for('view_user', username=user.username), + cssclass, + author.name, + ) + else: + output = "%s %s" % ( + avatar(user.default_email, size), + flask.url_for('view_user', username=user.username), + author.name, + ) return output