Widget fixes (#2373)

* fix click on row in team-projects
* hide deactivated users in team listing
This commit is contained in:
Kevin Papst
2021-02-21 00:51:46 +01:00
committed by GitHub
parent 607d09aefb
commit 2e7bfc822c
2 changed files with 7 additions and 6 deletions

View File

@@ -432,26 +432,27 @@
{% endif %}
<tbody>
{% for team in teams|sort((a, b) => a.name <=> b.name) %}
{% set users = team.users|filter(u => u.enabled) %}
{% set userTeamCount = users|length %}
<tr{% if is_granted('edit', team) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_team_member', {'id': team.id}) }}"{% endif %}>
<td>
{{ team.name }}
</td>
<td class="avatars">
{% set userTeamCount = team.users|length %}
{{ macro.user_avatar(team.teamlead, ('label.teamlead'|trans ~ ': ' ~ team.teamlead.displayName), 'teamlead') }}
{% set teamHiddenId = 'team_' ~ team.id ~ '_hiddenUser' ~ random() %}
{% set counter = 0 %}
{% for user in team.users %}
{% for user in users %}
{% if user != team.teamlead %}
{{ macro.user_avatar(user) }}
{% set counter = counter + 1 %}
{% endif %}
{% if userTeamCount > 5 and counter == 4 and not loop.last %}
{% if userTeamCount > 5 and counter == 4 and loop.index != userTeamCount %}
<a href="#" onclick="$('#{{ teamHiddenId }}').toggleClass('hidden');$(this).hide();return false;" class="badge">{{ 'label.plus_more'|trans({'%count%': (userTeamCount - 5)}) }}</a>
<span class="hidden" id="{{ teamHiddenId }}">
{% set counter = counter + 1 %}
{% endif %}
{% if userTeamCount > 5 and counter != 4 and loop.last %}
{% if userTeamCount > 5 and counter != 4 and loop.index == userTeamCount %}
</span>
{% endif %}
{% endfor %}