{% extends ajax-suffix ? "@gantry-admin/partials/ajax.html.twig" : "@gantry-admin/partials/base.html.twig" %}

{% block gantry %}
<div class="g-grid">
    <div class="g-block sidebar-block particles-sidebar-block">
        <h2 class="page-title">
            <span class="title">{{ 'GANTRY5_PLATFORM_PARTICLES'|trans }}</span>
        </h2>
        <div class="g5-lm-particles-picker">
            <div class="search settings-block">
                <input type="text" placeholder="{{ 'GANTRY5_PLATFORM_FILTER_ELI'|trans }}" />
                <i class="fa fa-fw fa-search"></i>
            </div>
            <div class="particles-container">
                {% for key, list in particles %}
                    {{ key|capitalize|e }}
                    <ul>
                    {% for type, particle in list %}
                        {% for item_key, item in particle %}
                            <li class="g5-lm-particle-{{ type|e }}"
                                data-lm-blocktype="{{ type|e }}"
                                data-lm-subtype="{{ item_key|e }}"
                                {% if not gantry.config.get('particles.' ~ item_key ~ '.enabled', true) %}data-lm-disabled data-lm-nodrag title="{{ 'GANTRY5_PLATFORM_PARTICLE_DISABLED'|trans }}"{% endif %}>
                                {{ item|e }}
                            </li>
                        {%  endfor %}
                    {% endfor %}
                    </ul>
                {% endfor %}
            </div>
        </div>
    </div>
    <div class="g-block main-block">
        <span class="float-right">
            {#<a href="#" class="button"><i class="fa fa-fw fa-sign-in"></i> <span>{{ 'GANTRY5_PLATFORM_IMPORT'|trans }}</span></a>
            <a href="#" class="button"><i class="fa fa-fw fa-sign-out"></i> <span>{{ 'GANTRY5_PLATFORM_EXPORT'|trans }}</span></a>#}
            <a href="#" class="button" data-lm-switcher="{{ gantry.route(switcher_url)|e }}"><i class="fa fa-fw fa-code-fork"></i> <span>{{ 'GANTRY5_PLATFORM_LOAD'|trans }}</span></a>
            <a href="#" class="button" data-lm-clear><i class="fa fa-fw fa-trash-o"></i> <span>{{ 'GANTRY5_PLATFORM_CLEAR'|trans }}</span></a>
            <a href="#" class="button button-primary button-save" data-save="{{ 'GANTRY5_PLATFORM_LAYOUT'|trans }}"><i class="fa fa-fw fa-check"></i> <span>{{ 'GANTRY5_PLATFORM_SAVE_LAYOUT'|trans }}</span></a>
        </span>
        <h2 class="page-title layout-title">
            <span class="title">{{ 'GANTRY5_PLATFORM_LAYOUT'|trans }} <small>({{ preset_title|default('Unknown') }})</small></span>
        </h2>

        <div class="lm-newblocks clearfix" data-lm-blocktypes>
            {#<a class="button" href="{{ gantry.route('picker/particles')|e }}" data-lm-addparticle><i class="fa fa-plus"></i> <span>{{ 'GANTRY5_PLATFORM_NEW_PARTICLE'|trans }}</span></a>#}
            <span class="float-right">
                <a data-lm-back href="#" class="button disabled"><i class="fa fa-fw fa-arrow-left"></i> {{ 'GANTRY5_PLATFORM_UNDO'|trans }}</a>
                {#<a href="#" class="button"><i class="fa fa-fw fa-history"></i> <span>{{ 'GANTRY5_PLATFORM_HISTORY'|trans }}</span></a>#}
                <a data-lm-forward href="#" class="button disabled">{{ 'GANTRY5_PLATFORM_REDO'|trans }} <i class="fa fa-fw fa-arrow-right"></i></a>
            </span>
        </div>
        <div id="page">
            <div class="lm-blocks" data-lm-page="{{ page_id|e }}" data-lm-preset="{{ preset|json_encode|e('html_attr') }}" data-lm-root="{{ layout|json_encode|e('html_attr') }}"></div>
            {% if layout is empty %}
            <div id="lm-no-layout">
                <div class="card full-width">
                    <h4>{{ 'GANTRY5_PLATFORM_NO_LAYOUT'|trans }}</h4>
                    <div class="inner-params">
                        {{ 'GANTRY5_PLATFORM_NO_LAYOUT_DESC'|trans|raw }}
                    </div>
                </div>
            </div>
            {% endif %}

            <div class="g-footer-actions">
            <span class="float-right">
                <a href="#" class="button" data-lm-switcher="{{ gantry.route(switcher_url)|e }}"><i class="fa fa-fw fa-code-fork"></i> <span>{{ 'GANTRY5_PLATFORM_LOAD'|trans }}</span></a>
                <a href="#" class="button" data-lm-clear><i class="fa fa-fw fa-trash-o"></i> <span>{{ 'GANTRY5_PLATFORM_CLEAR'|trans }}</span></a>
                <a href="#" class="button button-primary button-save" data-save="{{ 'GANTRY5_PLATFORM_LAYOUT'|trans }}"><i class="fa fa-fw fa-check"></i> <span>{{ 'GANTRY5_PLATFORM_SAVE_LAYOUT'|trans }}</span></a>
            </span>
            </div>
        </div>
    </div>

    <div id="trash" data-lm-eraseblock><div class="trash-zone">&times;</div><span>{{ 'GANTRY5_PLATFORM_DROP_DELETE'|trans }}</span></div>
{% endblock %}
