Project

General

Profile

0001-manager-add-a-disabled-badge-next-to-title-of-user-p.patch

Frédéric Péters (de retour le 10/10), 11 August 2022 09:51 AM

Download (2.8 KB)

View differences:

Subject: [PATCH] manager: add a disabled badge next to title of user page
 (#66869)

 .../static/authentic2/manager/css/style.scss        |  8 ++++++++
 .../templates/authentic2/manager/user_detail.html   |  6 +++++-
 tests/test_user_manager.py                          | 13 +++++++++++++
 3 files changed, 26 insertions(+), 1 deletion(-)
src/authentic2/manager/static/authentic2/manager/css/style.scss
230 230
    opacity: 0.5;
231 231
}
232 232

  
233
.disabled-badge {
234
	background: #cecece;
235
	border-radius: 10px;
236
	font-size: 50%;
237
	padding: 3px 8px;
238
	line-height: 1em;
239
}
240

  
233 241
/* role members */
234 242
.role-add {
235 243
    margin-left: 1ex; 
src/authentic2/manager/templates/authentic2/manager/user_detail.html
4 4
{% block page-title %}{{ block.super }} - {{ object }}{% endblock %}
5 5

  
6 6
{% block appbar %}
7
  {{ block.super }}
7
  <h2>{{ object }}
8
  {% if not object.is_active %}
9
  <span class="disabled-badge">{% trans "disabled" %}</span>
10
  {% endif %}
11
  </h2>
8 12
  <span class="actions">
9 13
    <a class="extra-actions-menu-opener"></a>
10 14
    <a href="{% url "a2-manager-user-journal" pk=object.pk %}">{% trans "Journal" %}</a>
tests/test_user_manager.py
977 977
    assert resp.html.find('span', {'class': 'disabled'}).text == 'Jôhn Dôe (disabled)'
978 978

  
979 979

  
980
def test_manager_user_disabled_user(app, superuser, simple_user):
981
    login(app, superuser, '/manage/')
982

  
983
    resp = app.get(reverse('a2-manager-user-detail', kwargs={'pk': simple_user.id}))
984
    assert resp.pyquery('h2').text() == 'Jôhn Dôe'
985

  
986
    simple_user.is_active = False
987
    simple_user.save()
988
    resp = app.get(reverse('a2-manager-user-detail', kwargs={'pk': simple_user.id}))
989
    assert resp.pyquery('h2').text() == 'Jôhn Dôe disabled'
990
    assert resp.pyquery('h2 .disabled-badge')
991

  
992

  
980 993
def test_manager_user_username_field(app, superuser, simple_user):
981 994
    login(app, superuser, '/manage/')
982 995

  
983
-