{% load i18n template_tools %}
{% if not training.version_state == training.VERSION_STATES.ARCHIVED %}
    <div class="btn-group">
        <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
            <i class="fa fa-{% nospaces %}
                {% if training.version_state == training.VERSION_STATES.DRAFT %}pencil{% endif %}
                {% if training.version_state == training.VERSION_STATES.COPIED %}files-o{% endif %}
                {% if training.version_state == training.VERSION_STATES.PUBLISHED %}check{% endif %}
            {% endnospaces %}"></i>
            {{ training.get_version_state_display }} <span class="caret"></span>
        </button>
        <ul class="dropdown-menu">
            {% if training.is_publishable %}
                <li>
                    <a href="{{ training.get_publish_version_state_url }}" class="dialog-box">
                        <i class="fa fa-check"></i> 
                        {% trans 'Publish' %}
                    </a>
                </li>
            {% endif %}
            {% if training.is_draftable %}
                <li>
                    <a href="{{ training.get_create_draft_url }}" class="dialog-box">
                        <i class="fa fa-pencil"></i> 
                        {% trans 'Create a draft' %}
                    </a>
                </li>
            {% endif %}
        </ul>
    </div>
{% else %}
    <button class="btn btn-default">
        <i class="fa fa-archive"></i> 
        {{ training.get_version_state_display }}
    </button>
{% endif %}