repman-io/repman

View on GitHub
templates/organization/overview.html.twig

Summary

Maintainability
Test Coverage
{% extends "base.html.twig" %}

{% block header %}{{ organization.name }} overview: {% endblock %}

{% block header_btn %}
    {% if is_granted('ROLE_ORGANIZATION_MEMBER', organization) %}
        <a href="{{ url('organizations_stats', {"organization":organization.alias}) }}" class="btn btn-primary">
            {% include 'svg/bar-chart.svg' %} Package stats
        </a>
    {% endif %}
{% endblock %}

{% block token %}
    {% if tokenCount <= 1 %}
        <span class="token d-none" data-type="token">{{ token }}</span>
        <button class="btn btn-primary btn-sm show-token">Show token</button>
    {% else %}
        <a href="{{ path('organization_tokens', {organization: organization.alias}) }}" class="btn btn-primary btn-sm">Get token</a>
    {% endif %}
{% endblock %}

{% block repositories %}
<p>
    Add these lines to your composer.json file, or add a new repository URL if you already have one or more:
</p>
<div class="highlight">
<pre>
{
    "repositories": [
        {"type": "composer", "url": "{{ url('organization_repo_url', {organization: organization.alias}) | trim('/') }}"}
    ]
}
</pre>
</div>
{% endblock %}

{% block content %}
    <div class="markdown">
        {% if is_granted('ROLE_ORGANIZATION_MEMBER', organization) %}
            {% if tokenCount > 0 %}
                <p>Configure global authentication to access this organization's packages:</p>
                <div class="highlight">
                    <pre>composer config --global --auth http-basic.{{ url('organization_repo_url', {organization: organization.alias}, true) | trim('/') }} token {{ block('token') | spaceless }}</pre>
                </div>
                {{ block('repositories') }}
                <p>
                    You can also use the <code>COMPOSER_AUTH</code> environment variable to authenticate Composer:
                </p>
                <pre>COMPOSER_AUTH={"http-basic": {"{{ url('organization_repo_url', {organization: organization.alias}, true) | trim('/') }}": {"username": "token", "password": "{{ block('token') | spaceless }}"}}}</pre>
            {% else %}
                Missing authentication tokens,
                <a class="btn btn-primary" href="{{ path('organization_token_new', {organization: organization.alias}) }}">
                    generate new token
                </a> to allow users to access your organization packages
            {% endif %}
        {% else %}
            {{ block('repositories') }}
        {% endif %}
    </div>
{% endblock %}