
<table class="table">
    <thead>
        <tr>
            <th width="30%">
                Relation type
            </th>
            <th>
                Entity
            </th>
            <th width="1%">
                <a gn-permission project="project" role="editor"
                    ng-disabled="!canAdd()"
                    href="#/p/{{entity.project.slug}}/relations/new?{{localName}}={{entity.id}}"
                    class="btn btn-xs btn-success pull-right"><i class="fa fa-plus"></i></button>
            </th>
        </tr>
    </thead>
    <tbody>
        <tr ng-hide="relations.results">
            <td colspan="3">
                <div class="alert alert-info">
                    <span ng-show="direction=='outbound'">
                        This entity does not have any outbound connections.
                    </span>
                    <span ng-show="direction=='inbound'">
                        This entity does not have any inbound connections.
                    </span>
                </div>
            </td>
        </tr>
        <tr ng-repeat="relation in relations.results">
            <td width="30%">
                <a href="#/p/{{entity.project.slug}}/relations/{{relation.id}}">
                    {{relation.schema.label}}</a>
            </td>
            <td>
                <a href="#/p/{{entity.project.slug}}/entities/{{relation[oppositeName].id}}">
                    {{relation[oppositeName].properties.name.value}}</a>
            </td>
            <td>
                <gn-permission project="project" role="editor">
                    <a class="btn btn-xs btn-default"
                       tooltip-placement="bottom" tooltip="Remove"
                       ng-click="deleteRelation(relation)"><i class="fa fa-minus"></i></a>
                </gn-permission>
            </td>
        </tr>
    </tbody>
</table>
<gn-pager class="pull-right" response="relations" load="load(url)"></gn-pager>
