<div class="grav-update plugins"></div>

<h1>
    {{ installing ? "PLUGIN_ADMIN.AVAILABLE_PLUGINS"|tu : "PLUGIN_ADMIN.INSTALLED_PLUGINS"|tu }}
</h1>

<table>
    {% for slug, plugin in admin.plugins(not installing).toArray|ksort %}
        {% set data = admin.data('plugins/' ~ slug) %}

        <tr data-gpm-plugin="{{ slug|url_encode }}">
            <td class="gpm-name">
                <i class="fa fa-fw fa-{{ plugin.icon }}"></i>
                <a href="{{ base_url_relative }}/plugins/{{ slug|url_encode }}">{{ plugin.name }}</a>
                {% if admin.isTeamGrav(plugin) %}
                    <small><span class="info-reverse"><i class="fa fa-check-circle" title="{{ "PLUGIN_ADMIN.GRAV_OFFICIAL_PLUGIN"|tu }}"></i></span></small>
                {% endif %}
                {% if plugin.symlink %}
                <span class="hint--bottom"  data-hint="{{ "PLUGIN_ADMIN.PLUGIN_SYMBOLICALLY_LINKED"|tu }}">
                    <i class="fa fa-fw fa-link"></i>
                </span>
                {% endif %}
                <span class="gpm-version">v{{ plugin.version }}</span>
            </td>
            <td class="gpm-actions">
                {% if (not installing and (plugin.form.fields.enabled.type != 'hidden')) %}
                    <a class="{{ data.get('enabled') ? 'enabled' : 'disabled' }}" href="{{ base_url_relative }}/plugins/{{ slug }}/task{{ config.system.param_sep }}{{ data.get('enabled') ? 'disable' : 'enable' }}">
                        <i class="fa fa-fw fa-toggle-{{ data.get('enabled') ? 'on' : 'off' }}"></i>
                    </a>
                {% elseif (installing) %}
                    <a class="button" href="{{ base_url_relative }}/plugins/{{ slug }}/task{{ config.system.param_sep }}install"><i class="fa fa-plus"></i> Install</a>
                {% endif %}
                <span class="gpm-details-expand"><i class="fa fa-chevron-down"></i></span>
            </td>
            <td class="gpm-details">
                <div class="table-wrapper">
                    {% include 'partials/plugin-data.html.twig' with { plugin: plugin } %}
                </div>
            </td>
        </tr>
    {% endfor %}
</table>
