<div class="umb-editor umb-listview" ng-controller="Umbraco.PropertyEditors.ListViewController" ng-switch="isNew">

   <div class="row-fluid" ng-switch-when="true">

   </div>

   <div class="row-fluid" ng-switch-when="false">

       <umb-editor-sub-header>

           <umb-editor-sub-header-content-left>

               <umb-editor-sub-header-section ng-if="(listViewAllowedTypes && listViewAllowedTypes.length > 0 && !isAnythingSelected()) && currentNodePermissions.canCreate">
                   <div class="btn-group" ng-show="listViewAllowedTypes.length > 1">
                       <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
                           <localize key="actions_create">Create</localize>
                           <span class="caret"></span>
                       </a>
                       <ul class="dropdown-menu">
                           <li ng-repeat="contentType in listViewAllowedTypes | orderBy:'name':false">
                               <a href="#/{{entityType}}/{{entityType}}/edit/{{contentId}}?doctype={{contentType.alias}}&create=true">
                                   <i class="icon-{{contentType.cssClass}}"></i>
                                   {{contentType.name}}
                               </a>
                           </li>
                       </ul>
                   </div>
                   <div class="btn-group" ng-show="listViewAllowedTypes.length === 1">
                       <a class="btn" href="#/{{entityType}}/{{entityType}}/edit/{{contentId}}?doctype={{listViewAllowedTypes[0].alias}}&create=true">
                           <i class="icon-{{listViewAllowedTypes[0].cssClass}}"></i>
                           <localize key="actions_create">Create</localize> {{ listViewAllowedTypes[0].name }}
                       </a>
                   </div>
               </umb-editor-sub-header-section>

               <umb-editor-sub-header-section ng-if="isAnythingSelected()">
                   <umb-button
                       type="button"
                       label="Clear selection"
                       label-key="buttons_clearSelection"
                       action="clearSelection()"
                       disabled="actionInProgress">
                   </umb-button>
               </umb-editor-sub-header-section>

               <umb-editor-sub-header-section ng-if="isAnythingSelected()">
                   <strong ng-show="!actionInProgress">{{ selectedItemsCount() }} <localize key="general_of">of</localize> {{ listViewResultSet.items.length }} <localize key="general_selected">selected</localize></strong>
                   <strong ng-show="actionInProgress" ng-bind="bulkStatus"></strong>

                   <div class="umb-loader-wrapper -bottom" ng-show="actionInProgress">
                       <div class="umb-loader"></div>
                   </div>
               </umb-editor-sub-header-section>

           </umb-editor-sub-header-content-left>


           <umb-editor-sub-header-content-right>

               <umb-editor-sub-header-section ng-if="!isAnythingSelected()">

                   <umb-layout-selector
                       ng-if="options.layout.layouts"
                       layouts="options.layout.layouts"
                       active-layout="options.layout.activeLayout"
                       on-layout-select="selectLayout">
                   </umb-layout-selector>

               </umb-editor-sub-header-section>

               <umb-editor-sub-header-section ng-if="!isAnythingSelected()">
                   <form class="form-search -no-margin-bottom pull-right" novalidate>
                       <div class="inner-addon left-addon">
                           <i class="icon icon-search" ng-click="enterSearch($event)"></i>
                           <input
                               class="form-control search-input"
                               type="text"
                               localize="placeholder"
                               placeholder="@general_typeToSearch"
                               ng-model="options.filter"
                               ng-change="enterSearch()"
                               ng-keydown="forceSearch($event)"
                               prevent-enter-submit
                               no-dirty-check>
                       </div>
                   </form>
               </umb-editor-sub-header-section>

               <umb-editor-sub-header-section ng-if="isAnythingSelected()">

                   <umb-button
                       ng-if="options.allowBulkPublish && (buttonPermissions == null || buttonPermissions.canPublish)"
                       type="button"
                       button-style="link"
                       label="Publish"
                       label-key="actions_publish"
                       icon="icon-globe"
                       action="publish()"
                       disabled="actionInProgress">
                   </umb-button>

                   <umb-button
                       ng-if="options.allowBulkUnpublish && (buttonPermissions == null || buttonPermissions.canUnpublish)"
                       type="button"
                       button-style="link"
                       label="Unpublish"
                       label-key="actions_unpublish"
                       icon="icon-block"
                       action="unpublish()"
                       disabled="actionInProgress">
                   </umb-button>

                   <umb-button
                       ng-if="options.allowBulkCopy && (buttonPermissions == null || buttonPermissions.canCopy)"
                       type="button"
                       button-style="link"
                       label="Copy"
                       label-key="actions_copy"
                       icon="icon-documents"
                       action="copy()"
                       disabled="actionInProgress">
                   </umb-button>

                   <umb-button
                       ng-if="options.allowBulkMove && (buttonPermissions == null || buttonPermissions.canMove)"
                       type="button"
                       button-style="link"
                       label="Move"
                       label-key="actions_move"
                       icon="icon-enter"
                       action="move()"
                       disabled="actionInProgress">
                   </umb-button>

                   <umb-button
                       ng-if="options.allowBulkDelete && (buttonPermissions == null || buttonPermissions.canDelete)"
                       type="button"
                       button-style="link"
                       label="Delete"
                       label-key="actions_delete"
                       icon="icon-trash"
                       action="delete()"
                       disabled="actionInProgress">
                   </umb-button>

               </umb-editor-sub-header-section>

           </umb-editor-sub-header-content-right>

       </umb-editor-sub-header>

       <umb-list-view-layout
         ng-if="viewLoaded"
         content-id="contentId"
         folders="folders"
         items="listViewResultSet.items"
         selection="selection"
         options="options"
         entity-type="{{entityType}}"
         on-get-content="getContent">
      </umb-list-view-layout>

      <umb-load-indicator ng-show="!viewLoaded"></umb-load-indicator>

      <div class="flex justify-center">
          <umb-pagination
             ng-if="listViewResultSet.totalPages"
             page-number="options.pageNumber"
             total-pages="listViewResultSet.totalPages"
             on-next="next"
             on-prev="prev"
             on-go-to-page="goToPage">
          </umb-pagination>
      </div>

    </div>

    <umb-overlay
      ng-if="moveDialog.show"
      model="moveDialog"
      position="right"
      view="moveDialog.view">
    </umb-overlay>

    <umb-overlay
      ng-if="copyDialog.show"
      model="copyDialog"
      position="right"
      view="copyDialog.view">
    </umb-overlay>

    <umb-overlay
        ng-if="ysodOverlay.show"
        model="ysodOverlay"
        position="right"
        view="ysodOverlay.view">
    </umb-overlay>

</div>
