From f8b87980d44c90e6c3f83e079f749fc7825dbb81 Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Jul 20 2016 16:16:22 +0000 Subject: [PATCH 1/2] Display pretty names of token ACLs Instead of displaying stringified python list, show nice HTML list with readable texts. --- diff --git a/pagure/lib/model.py b/pagure/lib/model.py index 93f9379..8766948 100644 --- a/pagure/lib/model.py +++ b/pagure/lib/model.py @@ -14,6 +14,7 @@ import pkg_resources import datetime import logging import json +import operator import sqlalchemy as sa @@ -1448,6 +1449,14 @@ class Token(BASE): ''' return sorted([str(acl.name) for acl in self.acls]) + @property + def acls_list_pretty(self): + ''' + Return a list containing the description of each ACLs this token has. + ''' + return [acl.description for acl in sorted( + self.acls, key=operator.attrgetter('name'))] + class TokenAcl(BASE): """ diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html index d68e456..b6a7e05 100644 --- a/pagure/templates/settings.html +++ b/pagure/templates/settings.html @@ -167,7 +167,11 @@ From 60ab63ea31a443466107935e64251da4c83af573 Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Jul 20 2016 16:27:18 +0000 Subject: [PATCH 2/2] Align token expiration with ACL button Define a custom class (based on .btn) that adds the same line height and vertical padding. This will make the two texts share a common baseline. --- diff --git a/pagure/static/pagure.css b/pagure/static/pagure.css index 5c430ad..7f17e4d 100644 --- a/pagure/static/pagure.css +++ b/pagure/static/pagure.css @@ -564,3 +564,9 @@ th[data-sort] { #watch_project a { cursor: pointer; } + +.btn-align { + padding: 6px 0; + line-height: 1.42857143; + vertical-align: middle; +} diff --git a/pagure/templates/settings.html b/pagure/templates/settings.html index b6a7e05..8e8b0c4 100644 --- a/pagure/templates/settings.html +++ b/pagure/templates/settings.html @@ -135,9 +135,9 @@ {% if token.expired %} - Expired since {{ token.expiration.date() }} + Expired since {{ token.expiration.date() }} {% else %} - Valid until: {{ token.expiration.date() }} + Valid until: {{ token.expiration.date() }}
diff --git a/tests/test_pagure_flask_ui_repo.py b/tests/test_pagure_flask_ui_repo.py index 0eb57b3..634bab7 100644 --- a/tests/test_pagure_flask_ui_repo.py +++ b/tests/test_pagure_flask_ui_repo.py @@ -2888,7 +2888,7 @@ index 0000000..fb7093d 'Settings - test - Pagure', output.data) self.assertIn('

Settings for test

', output.data) self.assertIn( - 'Valid until: ', + 'Valid until: ', output.data) @patch('pagure.ui.repo.admin_session_timedout')