Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-497: Redesign tabs for 4.0 #98

Merged
merged 2 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@
{% block content %}
{{ ez_render_component_group('systeminfo-tab-groups') }}
{% endblock %}

{% block javascripts %}
{{ encore_entry_script_tags('ezplatform-admin-ui-tabs-js', null, 'ezplatform') }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
<div class="row ez-header pt-3">
<div class="container ez-container">
<ul class="nav nav-tabs ez-tabs nav-tabs-{{ group }}" role="tablist" id="ez-tab-list-{{ group }}">
{% for tab in tabs %}
{% set id = group ~ '-' ~ tab.identifier %}
{% set active = loop.first %}
<li class="nav-item">
<a class="nav-link{% if active %} active{% endif %}" id="ez-tab-label-{{ group }}"
data-toggle="tab" href="#ez-tab-{{ id }}" role="tab" aria-controls="ez-tab-{{ id }}"
aria-expanded="{{ active }}">{{ tab.name }}</a>
</li>
{% endfor %}
</ul>
</div>
</div>
<div class="tab-content container ez-container" id="ez-tab-list-content-{{ group }}">
{% for tab in tabs %}
{% set id = group ~ '-' ~ tab.identifier %}
{% set active = loop.first %}

<div class="tab-pane{% if active %} active{% endif %}" id="ez-tab-{{ id }}" role="tabpanel"
aria-labelledby="ez-tab-label-{{ group }}">
{{ tab.view|raw }}
</div>
{% endfor %}
</div>
{% set tabs_to_show = [] %}
{% for tab in tabs %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be cleaner to use map here

set tabs_to_show = tabs|map((tab, index) => {
        id: group ~ '-' ~ tab.identifier,
        label: tab.name,
        content: tab.view,
        active: index == 0,
    })

{% set tabs_to_show = tabs_to_show|merge([{
id: group ~ '-' ~ tab.identifier,
label: tab.name,
content: tab.view,
active: loop.first,
}]) %}
{% endfor %}
{% include '@ezdesign/ui/component/tab/tabs.html.twig' with {
tabs: tabs_to_show,
include_tab_more: true,
} %}