<script type="text/ng-template" id="tree_item_renderer"><div class="btn-group" dropdown is-open="isopen">
    <button id="{{domain.identifier}}" class="btn"
            x-ng-class="{'btn-parent-active': isParent(domain) && $state.params.domainId === domain.identifier,
                        'btn-info': $state.params.domainId === domain.identifier,
                        'btn-default': $state.params.domainId !== domain.identifier,
                        'btn-parent': isParent(domain)}"
            x-ui-sref="{domainId: domain.identifier, formState: 'edit', domainType: null, view: view}">
      {{domain.label | truncate:20 }}
      {{view}}
    </button>
    <button id="{{domain.identifier}}-add" class="btn btn-success dropdown-toggle" x-ng-show="canAddChildDomain(domain)">
      <span>&nbsp;<i class="fa fa-plus"></i><span>
    </button>
    <ul class="dropdown-menu" role="menu">
      <li x-ng-show="canAddTopDomain(domain)">
        <a id="{{domain.identifier}}-add-top"
           x-ui-sref="{domainId: domain.identifier, formState: 'create', domainType: 'TOPDOMAIN'}"
           x-ng-click="isopen=false">
          {{ 'MANAGE_DOMAINS.BOX_TREE.BUTTON_ADD.TOP_DOMAIN' | translate }}
        </a>
      </li>
      <li x-ng-show="canAddSubDomain(domain)">
        <a id="{{domain.identifier}}-add-sub"
           x-ui-sref="{domainId: domain.identifier, formState: 'create', domainType: 'SUBDOMAIN'}"
           x-ng-click="isopen=false">
          {{ 'MANAGE_DOMAINS.BOX_TREE.BUTTON_ADD.SUB_DOMAIN' | translate }}
        </a>
      </li>
      <li x-ng-show="canAddGuestDomain(domain)">
        <a id="{{domain.identifier}}-add-guest"
           x-ui-sref="{domainId: domain.identifier, formState: 'create', domainType: 'GUESTDOMAIN'}"
           x-ng-click="isopen=false">
          {{ 'MANAGE_DOMAINS.BOX_TREE.BUTTON_ADD.GUEST_DOMAIN' | translate }}
        </a>
      </li>
    </ul>
  </div>
  
  <ul>
    <li class="parent_li branch" x-ng-repeat="domain in domain.children | orderBy:'label'" x-ng-include="'tree_item_renderer'">
    </li>
  </ul></script><div class="box box-primary" id="tree"><div class="box-header"><h3 class="box-title">{{ title | translate }}</h3></div><div class="box-body box-tree-domain"><div class="tree"><ul><li class="branch" x-ng-repeat="domain in root" x-ng-include="'tree_item_renderer'"></li></ul></div></div><ul></ul></div>