Skip to content

Commit

Permalink
EZP-31961: Table header missing when the table is empty (#1586)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Grabowski authored and adamwojs committed Oct 22, 2020
1 parent fa9532a commit 316f33d
Show file tree
Hide file tree
Showing 15 changed files with 471 additions and 426 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
{% import _self as tab %}
{% include '@ezdesign/ui/table_header.html.twig' with { header_text: 'tab.policies.policies'|trans|desc('Policies') } %}

{% if policies_pager.currentPageResults is not empty %}
{{ include('@ezdesign/content/tab/policies/table.html.twig', {
'policies_pager': policies_pager,
}) }}
{% else %}
<p class="ez-table-no-content">
{{ 'tab.policies.no_policies'|trans|desc('This Content item has no Policies.') }}
</p>
{% endif %}
{{ include('@ezdesign/content/tab/policies/table.html.twig', {
'policies_pager': policies_pager,
}) }}

{% if policies_pager.haveToPaginate %}
{% include '@ezdesign/ui/pagination.html.twig' with {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,54 @@
</tr>
</thead>
<tbody>
{% for policy in policies_pager.currentPageResults %}
<tr>
<td>
<a href="{{ path('ezplatform.role.view', { roleId: policy.role_assignment.role.id}) }}">
{{ policy.role_assignment.role.identifier }}
</a>
</td>
<td>
{%- if policy.role_assignment.usergroup is defined -%}
{{ ez_content_name( policy.role_assignment.usergroup ) }}
{%- else -%}
{{ ez_content_name( policy.role_assignment.user ) }}
{%- endif -%}
</td>
<td>
{{ ('role.policy.' ~ policy.module)|trans({}, 'forms') }}
</td>
<td>
{{ policy.function|capitalize }}
</td>
<td>
{%- if policy.limitations is not empty -%}
<ul class="list-unstyled">
{%- for limitation in policy.limitations -%}
<li>
<span class="font-weight-bold" title="{{ 'policy.limitation.identifier_tooltip'|trans({'%identifier%': limitation.identifier})|desc('"%identifier%" Limitation') }}">
{{ ('policy.limitation.identifier.' ~ limitation.identifier|lower)|trans({'%identifier%': limitation.identifier}, 'ezplatform_content_forms_policies')|desc('%identifier%') }}:
</span>
{{ ez_render_limitation_value(limitation, {'template': '@ezdesign/content/tab/policies/limitation_values.html.twig'}) }}
</li>
{%- endfor -%}
</ul>
{%- else -%}
{{- 'policy.limitation.none'|trans|desc('None') -}}
{%- endif -%}
</td>
</tr>
{% endfor %}
{% if policies_pager.currentPageResults is not empty %}
{% for policy in policies_pager.currentPageResults %}
<tr>
<td>
<a href="{{ path('ezplatform.role.view', { roleId: policy.role_assignment.role.id}) }}">
{{ policy.role_assignment.role.identifier }}
</a>
</td>
<td>
{%- if policy.role_assignment.usergroup is defined -%}
{{ ez_content_name( policy.role_assignment.usergroup ) }}
{%- else -%}
{{ ez_content_name( policy.role_assignment.user ) }}
{%- endif -%}
</td>
<td>
{{ ('role.policy.' ~ policy.module)|trans({}, 'forms') }}
</td>
<td>
{{ policy.function|capitalize }}
</td>
<td>
{%- if policy.limitations is not empty -%}
<ul class="list-unstyled">
{%- for limitation in policy.limitations -%}
<li>
<span class="font-weight-bold" title="{{ 'policy.limitation.identifier_tooltip'|trans({'%identifier%': limitation.identifier})|desc('"%identifier%" Limitation') }}">
{{ ('policy.limitation.identifier.' ~ limitation.identifier|lower)|trans({'%identifier%': limitation.identifier}, 'ezplatform_content_forms_policies')|desc('%identifier%') }}:
</span>
{{ ez_render_limitation_value(limitation, {'template': '@ezdesign/content/tab/policies/limitation_values.html.twig'}) }}
</li>
{%- endfor -%}
</ul>
{%- else -%}
{{- 'policy.limitation.none'|trans|desc('None') -}}
{%- endif -%}
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td class="ez-table__cell ez-table__cell--no-content" colspan="5">
<p class="ez-table-no-content mb-0 py-0">
{{ 'tab.policies.no_policies'|trans|desc('This Content item has no Policies.') }}
</p>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,17 @@
header_text: 'tab.relations.related_content'|trans({
'%contentName%' : ez_content_name(content)
})|desc('Related content (Content items used by %contentName%)') } %}
{% if relations is not empty %}
{{ include('@ezdesign/content/tab/relations/table_relations.html.twig', {'relations': relations}) }}
{% else %}
<p class="ez-table-no-content">
{{ 'tab.relations.no_relations'|trans()|desc('This Content item has no related content.') }}
</p>
{% endif %}
{{ include('@ezdesign/content/tab/relations/table_relations.html.twig', {'relations': relations}) }}

{% if reverse_relation_pager is defined %}
{% include '@ezdesign/ui/table_header.html.twig' with {
header_text: 'tab.relations.reverse_relations'|trans({
'%contentName%' : ez_content_name(content)
})|desc('Reverse relations (Content items using %contentName%)')
} %}
{% if reverse_relation_pager.currentPageResults is not empty %}
{{ include('@ezdesign/content/tab/relations/table_relations_reverse.html.twig', {
'relations': reverse_relation_pager.currentPageResults
}) }}
{% else %}
<p class="ez-table-no-content">
{{ 'tab.relations.no_reverse_relations'|trans()|desc('This Content item has no reverse Relations.') }}
</p>
{% endif %}
{{ include('@ezdesign/content/tab/relations/table_relations_reverse.html.twig', {
'relations': reverse_relation_pager.currentPageResults
}) }}
{% if reverse_relation_pager.haveToPaginate %}
{% include '@ezdesign/ui/pagination.html.twig' with {
'pager': reverse_relation_pager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,39 @@
</tr>
</thead>
<tbody>
{% for relation in relations %}
{% set destination = relation.destinationContentInfo %}
<tr>
<td>
{% if destination.mainLocationId is not null %}
<a href="{{ path('_ez_content_view',
{ 'contentId': destination.id, 'locationId': relation.resolvedDestinationLocation.id }) }}"
>
{{ ez_content_name(destination) }}
</a>
{% else %}
{{ ez_content_name(destination) }}
{% endif %}
</td>
<td>{{ content_types[destination.contentTypeId].name }}</td>
<td>
{{ macros.relation_type(relation) }}
{% if (relation.relationFieldDefinitionName) %}
({{ relation.relationFieldDefinitionName }})
{% endif %}
</td>
</tr>
{% endfor %}
{% if relations is not empty %}
{% for relation in relations %}
{% set destination = relation.destinationContentInfo %}
<tr>
<td>
{% if destination.mainLocationId is not null %}
<a href="{{ path('_ez_content_view',
{ 'contentId': destination.id, 'locationId': relation.resolvedDestinationLocation.id }) }}"
>
{{ ez_content_name(destination) }}
</a>
{% else %}
{{ ez_content_name(destination) }}
{% endif %}
</td>
<td>{{ content_types[destination.contentTypeId].name }}</td>
<td>
{{ macros.relation_type(relation) }}
{% if (relation.relationFieldDefinitionName) %}
({{ relation.relationFieldDefinitionName }})
{% endif %}
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td class="ez-table__cell ez-table__cell--no-content" colspan="3">
<p class="ez-table-no-content mb-0 py-0">
{{ 'tab.relations.no_relations'|trans()|desc('This Content item has no related content.') }}
</p>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,53 @@
</tr>
</thead>
<tbody>
{% for relation in relations %}
{% if relation.isAccessible %}
{% set source = relation.sourceContentInfo %}
<tr>
<td>
{% if source.mainLocationId is not null %}
<a href="{{ path('_ez_content_view',
{ 'contentId': source.id, 'locationId': relation.resolvedSourceLocation.id }) }}"
>
{{ ez_content_name(source) }}
</a>
{% else %}
{{ ez_content_name(source) }}
{% endif %}
</td>
<td>{{ content_types[source.contentTypeId].name }}</td>
<td>
{{ macros.relation_type(relation) }}
{% if (relation.relationFieldDefinitionName) %}
({{ relation.relationFieldDefinitionName }})
{% endif %}
</td>
</tr>
{% if relations is not empty %}
{% for relation in relations %}
{% if relation.isAccessible %}
{% set source = relation.sourceContentInfo %}
<tr>
<td>
{% if source.mainLocationId is not null %}
<a href="{{ path('_ez_content_view',
{ 'contentId': source.id, 'locationId': relation.resolvedSourceLocation.id }) }}"
>
{{ ez_content_name(source) }}
</a>
{% else %}
{{ ez_content_name(source) }}
{% endif %}
</td>
<td>{{ content_types[source.contentTypeId].name }}</td>
<td>
{{ macros.relation_type(relation) }}
{% if (relation.relationFieldDefinitionName) %}
({{ relation.relationFieldDefinitionName }})
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td class="table__cell ez-table__cell--has-text-info" colspan="8">
{{
'dashboard.table.relation.unauthorized'|trans({
'%module%': relation.unauthorizedRelation.module,
'%function%': relation.unauthorizedRelation.function,
'%contentId%': relation.unauthorizedRelation.payload.contentId,
})|desc('You do not have the \'%function%\' \'%module%\' permission for content ID: %contentId%')
}}
</td>
</tr>
{% endif %}
{% endfor %}
{% else %}
<tr>
<td class="table__cell ez-table__cell--has-text-info" colspan="8">
{{
'dashboard.table.relation.unauthorized'|trans({
'%module%': relation.unauthorizedRelation.module,
'%function%': relation.unauthorizedRelation.function,
'%contentId%': relation.unauthorizedRelation.payload.contentId,
})|desc('You do not have the \'%function%\' \'%module%\' permission for content ID: %contentId%')
}}
<td class="ez-table__cell ez-table__cell--no-content" colspan="3">
<p class="ez-table-no-content mb-0 py-0">
{{ 'tab.relations.no_reverse_relations'|trans()|desc('This Content item has no reverse Relations.') }}
</p>
</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
{% import _self as tab %}
{% include '@ezdesign/ui/table_header.html.twig' with { header_text: 'tab.roles.roles'|trans|desc('Roles') } %}

{% if roles_pager.currentPageResults is not empty %}
{{ include('@ezdesign/content/tab/roles/table.html.twig', {
'roles_pager': roles_pager,
}) }}
{% else %}
<p class="ez-table-no-content">
{{ 'tab.roles.no_roles'|trans|desc('This Content item has no Roles.') }}
</p>
{% endif %}
{{ include('@ezdesign/content/tab/roles/table.html.twig', {
'roles_pager': roles_pager,
}) }}

{% if roles_pager.haveToPaginate %}
{% include '@ezdesign/ui/pagination.html.twig' with {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,36 @@
</tr>
</thead>
<tbody>
{% for role_assignment in roles_pager.currentPageResults %}
<tr>
<td>
<a href="{{ path('ezplatform.role.view', { roleId: role_assignment.role.id}) }}">
{{ role_assignment.role.identifier }}
</a>
</td>
<td>
{%- set limitation = role_assignment.rolelimitation -%}
{%- if limitation -%}
{{ ez_render_limitation_value(limitation, {'template': '@ezdesign/content/tab/roles/limitation_values.html.twig'}) }}
<span title="{{ 'policy.limitation.identifier_tooltip' | trans({'%identifier%': limitation.identifier})|desc('"%identifier%" Limitation') }}">
({{ ('policy.limitation.identifier.' ~ limitation.identifier|lower)|trans({'%identifier%': limitation.identifier}, 'ezplatform_content_forms_policies')|desc('%identifier%') }})
</span>
{%- else -%}
{{- 'policy.limitation.none'|trans|desc('None') -}}
{%- endif -%}
</td>
</tr>
{% endfor %}
{% if roles_pager.currentPageResults is not empty %}
{% for role_assignment in roles_pager.currentPageResults %}
<tr>
<td>
<a href="{{ path('ezplatform.role.view', { roleId: role_assignment.role.id}) }}">
{{ role_assignment.role.identifier }}
</a>
</td>
<td>
{%- set limitation = role_assignment.rolelimitation -%}
{%- if limitation -%}
{{ ez_render_limitation_value(limitation, {'template': '@ezdesign/content/tab/roles/limitation_values.html.twig'}) }}
<span title="{{ 'policy.limitation.identifier_tooltip' | trans({'%identifier%': limitation.identifier})|desc('"%identifier%" Limitation') }}">
({{ ('policy.limitation.identifier.' ~ limitation.identifier|lower)|trans({'%identifier%': limitation.identifier}, 'ezplatform_content_forms_policies')|desc('%identifier%') }})
</span>
{%- else -%}
{{- 'policy.limitation.none'|trans|desc('None') -}}
{%- endif -%}
</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td class="ez-table__cell ez-table__cell--no-content" colspan="3">
<p class="ez-table-no-content mb-0 py-0">
{{ 'tab.roles.no_roles'|trans|desc('This Content item has no Roles.') }}
</p>
</td>
</tr>
{% endif %}
</tbody>
</table>
</div>
Loading

0 comments on commit 316f33d

Please sign in to comment.