<div class="at-List-toolbar">
    <smart-search
        class="at-List-search"
        django-model="tokens"
        base-path="tokens"
        iterator="token"
        list="list"
        dataset="token_dataset"
        collection="collection"
        search-tags="searchTags">
    </smart-search>
    <div class="at-List-toolbarAction">
        <button
            type="button"
            ui-sref=".add"
            class="at-Button--add"
            id="button-add"
            aria-haspopup="true"
            aria-expanded="false">
        </button>
    </div>
</div>

<at-list results="tokens">
    <at-row ng-repeat="token in tokens">
        <div class="at-Row-items">
            <at-row-item
                header-value="{{ token.summary_fields.application.name ?
                    vm.strings.get('list.HEADER', token.summary_fields.application.name) :
                    vm.strings.get('list.PERSONAL_ACCESS_TOKEN')
                }}">
            </at-row-item>
            <at-row-item
                label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_DESCRIPTION') }}"
                value="{{ token.description | sanitize }}">
            </at-row-item>
            <at-row-item
                label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_SCOPE') }}"
                value="{{ vm.getScopeString(token.scope) }}">
            </at-row-item>
            <at-row-item
                label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_APPLICATION') }}"
                value="{{ token.summary_fields.application.name }}"
                value-link="/#/applications/{{ token.summary_fields.application.id }}">
            </at-row-item>
            <at-row-item
                label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_EXPIRED') }}"
                value="{{ token.expires | longDate }}">
            </at-row-item>
            <at-row-item
                label-value="{{:: vm.strings.get('list.ROW_ITEM_LABEL_USED') }}"
                value="{{ vm.getLastUsed(token) }}">
            </at-row-item>
        </div>
        <div class="at-Row-actions">
            <at-row-action icon="fa-trash" ng-click="vm.deleteToken(token)">
            </at-row-action>
        </div>
    </at-row>
</at-list>
<paginate
    collection="tokens"
    dataset="token_dataset"
    iterator="token"
    base-path="tokens">
</paginate>