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 %} {% endif %}
<tbody> <tbody>
{% for team in teams|sort((a, b) => a.name <=> b.name) %} {% 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 %}> <tr{% if is_granted('edit', team) %} class="modal-ajax-form open-edit" data-href="{{ path('admin_team_member', {'id': team.id}) }}"{% endif %}>
<td> <td>
{{ team.name }} {{ team.name }}
</td> </td>
<td class="avatars"> <td class="avatars">
{% set userTeamCount = team.users|length %}
{{ macro.user_avatar(team.teamlead, ('label.teamlead'|trans ~ ': ' ~ team.teamlead.displayName), 'teamlead') }} {{ macro.user_avatar(team.teamlead, ('label.teamlead'|trans ~ ': ' ~ team.teamlead.displayName), 'teamlead') }}
{% set teamHiddenId = 'team_' ~ team.id ~ '_hiddenUser' ~ random() %} {% set teamHiddenId = 'team_' ~ team.id ~ '_hiddenUser' ~ random() %}
{% set counter = 0 %} {% set counter = 0 %}
{% for user in team.users %} {% for user in users %}
{% if user != team.teamlead %} {% if user != team.teamlead %}
{{ macro.user_avatar(user) }} {{ macro.user_avatar(user) }}
{% set counter = counter + 1 %} {% set counter = counter + 1 %}
{% endif %} {% 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> <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 }}"> <span class="hidden" id="{{ teamHiddenId }}">
{% set counter = counter + 1 %} {% set counter = counter + 1 %}
{% endif %} {% endif %}
{% if userTeamCount > 5 and counter != 4 and loop.last %} {% if userTeamCount > 5 and counter != 4 and loop.index == userTeamCount %}
</span> </span>
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@@ -18,8 +18,8 @@
<tbody> <tbody>
{% for stats in projectStats|sort((a, b) => a.project.name <=> b.project.name) %} {% for stats in projectStats|sort((a, b) => a.project.name <=> b.project.name) %}
{% set project = stats.project %} {% set project = stats.project %}
<tr> <tr{% if is_granted('details', stats.project) %} class="alternative-link open-edit" data-href="{{ path('project_details', {'id': stats.project.id}) }}"{% endif %}>
<td{% if is_granted('details', stats.project) %} class="alternative-link open-edit" data-href="{{ path('project_details', {'id': stats.project.id}) }}"{% endif %}> <td>
{{ widgets.label_project(stats.project) }} {{ widgets.label_project(stats.project) }}
<br> <br>
<small>{{ widgets.label_customer(stats.project.customer) }}</small> <small>{{ widgets.label_customer(stats.project.customer) }}</small>