{% extends mode is defined and mode == 'user' ? "user.twig" : "admin.twig" %}
{% import '@CorePluginsAdmin/macros.twig' as pluginsMacro %}

{% block content %}

    <div class="pluginslistActionBar">

        <h2 piwik-enriched-headline
            feature-name="{{ 'CorePluginsAdmin_Marketplace'|translate }}"
            >{{ 'CorePluginsAdmin_TeaserExtendPiwikByPlugin'|translate }}</h2>

        <div class="infoBox">
            {{ 'CorePluginsAdmin_PluginsExtendPiwik'|translate }}
            {{ 'CorePluginsAdmin_InstallingNewPluginViaMarketplaceOrUpload'|translate('<a href="#" class="uploadPlugin">','</a>')|raw }}
            <br/>
            {{ 'CorePluginsAdmin_BeCarefulUsingPlugins'|translate }}
        </div>

        {% include "@CorePluginsAdmin/browsePluginsActions.twig" %}
    </div>

    {% if not isSuperUser %}
        <div class="pluginslistNonSuperUserHint">
            {{ 'CorePluginsAdmin_NotAllowedToBrowseMarketplacePlugins'|translate }}
        </div>
    {% endif %}

    <div class="pluginslist">

        {% if plugins|length %}

            {% for plugin in plugins %}

                <div class="plugin">
                    <div class="content" data-pluginName="{{ plugin.name }}">
                        {% include "@CorePluginsAdmin/pluginOverview.twig" %}
                    </div>

                    <div class="footer" data-pluginName="{{ plugin.name }}">
                        {% if plugin.featured %}
                            {{ pluginsMacro.featuredIcon('right') }}
                        {% endif %}
                        {% include "@CorePluginsAdmin/pluginMetadata.twig" %}
                    </div>
                </div>

            {% endfor %}

        {% else %}
            {{ 'CorePluginsAdmin_NoPluginsFound'|translate }}
        {% endif %}
    </div>

    <div class="pluginFooterMessage">
    {% set marketplaceSellPluginSubject = 'CorePluginsAdmin_MarketplaceSellPluginSubject'|translate %}
        {{ 'CorePluginsAdmin_GetEarlyAccessForPaidPlugins'|translate("<a href='mailto:hello@piwik.org?subject=" ~ marketplaceSellPluginSubject ~ "'>", "</a>")|raw }}
        <br/>
        {{ 'CorePluginsAdmin_DevelopersLearnHowToDevelopPlugins'|translate('<a href="?module=Proxy&action=redirect&url=http://developer.piwik.org/plugins" target="_blank">', '</a>')|raw }}
    </div>
{% endblock %}
