Skip to content

Commit

Permalink
feat(areabrick-overview): display number of (un)published pages (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreesen authored Oct 28, 2024
1 parent d5fca33 commit 12e7deb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 32 deletions.
45 changes: 13 additions & 32 deletions templates/bricks/overview.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -22,39 +22,20 @@
<td>{{ brick.description|trans }}</td>
<td>{{ brick.template }}</td>
<td>
{% set published_pages = brick.pages|filter(page => page.published) %}
{% set unpublished_pages = brick.pages|filter(page => not page.published) %}
{% embed "@NeustaPimcoreAreabrickConfig/bricks/pages_accordion.html.twig" with {
title: 'neusta_pimcore_areabrick_config.areabricks.overview.table.published_pages'|trans,
pages: brick.pages|filter(page => page.published),
} only %}
{% block page %}
{{ parent() }} (<a href="{{ page.url }}" target="_blank">Frontend</a>)
{% endblock %}
{% endembed %}

{% if published_pages is not empty %}
<details class="accordion">
<summary>{{ 'neusta_pimcore_areabrick_config.areabricks.overview.table.published_pages'|trans }}</summary>
<ul>
{% for page in published_pages %}
<li>
<a data-page-id="{{ page.id }}" data-page-type="{{ page.type }}">
{{ page.url }}
</a>
(<a href="{{ page.url }}" target="_blank">Frontend</a>)
</li>
{% endfor %}
</ul>
</details>
{% endif %}

{% if unpublished_pages is not empty %}
<details class="accordion">
<summary>{{ 'neusta_pimcore_areabrick_config.areabricks.overview.table.unpublished_pages'|trans }}</summary>
<ul>
{% for page in unpublished_pages %}
<li>
<a data-page-id="{{ page.id }}" data-page-type="{{ page.type }}">
{{ page.url }}
</a>
</li>
{% endfor %}
</ul>
</details>
{% endif %}
{% embed "@NeustaPimcoreAreabrickConfig/bricks/pages_accordion.html.twig" with {
title: 'neusta_pimcore_areabrick_config.areabricks.overview.table.unpublished_pages'|trans,
pages: brick.pages|filter(page => not page.published),
} only %}
{% endembed %}
</td>
{% if hasAdditionalProperties %}
<td>
Expand Down
14 changes: 14 additions & 0 deletions templates/bricks/pages_accordion.html.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{% if pages is not empty %}
<details class="accordion">
<summary>{{ title }} ({{ pages|length }})</summary>
<ul>
{% for page in pages %}
<li>
{% block page %}
<a data-page-id="{{ page.id }}" data-page-type="{{ page.type }}">{{ page.url }}</a>
{% endblock %}
</li>
{% endfor %}
</ul>
</details>
{% endif %}

0 comments on commit 12e7deb

Please sign in to comment.