<div id="umb-nested-content--{{model.id}}" class="umb-nested-content"
     ng-controller="Umbraco.PropertyEditors.NestedContent.PropertyEditorController"
     ng-class="{'umb-nested-content--narrow':!wideMode, 'umb-nested-content--wide':wideMode}">
    <ng-form>

        <div class="umb-nested-content__items" ng-hide="nodes.length == 0" ui-sortable="sortableOptions" ng-model="nodes">

            <div class="umb-nested-content__item" ng-repeat="node in nodes" ng-class="{ 'umb-nested-content__item--active' : $parent.realCurrentNode.key == node.key, 'umb-nested-content__item--single' : $parent.singleMode }">

                <div class="umb-nested-content__header-bar" ng-click="$parent.editNode($index)" ng-hide="$parent.singleMode">

                    <div class="umb-nested-content__heading" ng-class="{'-with-icon': showIcons}"><i ng-if="showIcons" class="icon" ng-class="$parent.getIcon($index)"></i><span class="umb-nested-content__item-name" ng-bind="$parent.getName($index)"></span></div>

                    <div class="umb-nested-content__icons">
                        <a class="umb-nested-content__icon umb-nested-content__icon--edit" title="{{editIconTitle}}" ng-class="{ 'umb-nested-content__icon--active' : $parent.realCurrentNode.id == node.id }" ng-click="$parent.editNode($index); $event.stopPropagation();" ng-show="$parent.maxItems > 1" prevent-default>
                            <i class="icon icon-edit"></i>
                        </a>
                        <a class="umb-nested-content__icon umb-nested-content__icon--move" title="{{moveIconTitle}}" ng-click="$event.stopPropagation();" ng-show="$parent.nodes.length > 1" prevent-default>
                            <i class="icon icon-navigation"></i>
                        </a>
                        <a class="umb-nested-content__icon umb-nested-content__icon--delete" title="{{deleteIconTitle}}" ng-class="{ 'umb-nested-content__icon--disabled': $parent.nodes.length <= $parent.minItems }" ng-click="$parent.deleteNode($index); $event.stopPropagation();" prevent-default>
                            <i class="icon icon-trash"></i>
                        </a>
                    </div>

                </div>

                <div class="umb-nested-content__content" ng-if="$parent.realCurrentNode.key == node.key && !$parent.sorting">
                    <umb-nested-content-editor ng-model="node" tab-alias="ncTabAlias" />
                </div>
            </div>

        </div>

        <div class="umb-nested-content__help-text" ng-show="nodes.length == 0">
            <localize key="grid_addElement"></localize>
        </div>

        <div class="umb-nested-content__footer-bar" ng-hide="nodes.length >= maxItems">
            <a href class="umb-nested-content__icon" ng-click="openNodeTypePicker($event)" prevent-default>
                <i class="icon icon-add"></i>
            </a>
        </div>

    </ng-form>

    <umb-overlay
        ng-if="overlayMenu.show"
        position="target"
        view="overlayMenu.view"
        model="overlayMenu">
    </umb-overlay>

</div>
