#history-menu.sn-component
  .sk-menu-panel.dropdown-menu
    .sk-menu-panel-header
      .sk-menu-panel-header-title Session
        .sk-menu-panel-header-subtitle {{ctrl.state.sessionHistory.length || 'No'}} revisions
      a.sk-a.info.sk-h5(
        ng-click='ctrl.showSessionOptions = !ctrl.showSessionOptions; $event.stopPropagation();'
        ) Options
    div(ng-if='ctrl.showSessionOptions')
      menu-row(
        action='ctrl.clearItemSessionHistory()'
        label="'Clear note local history'"
        )
      menu-row(
        action='ctrl.clearAllSessionHistory()'
        label="'Clear all local history'"
        )
      menu-row(
        action='ctrl.toggleSessionHistoryAutoOptimize()'
        label="(ctrl.state.autoOptimize ? 'Disable' : 'Enable') + ' auto cleanup'")
        .sk-sublabel
          | Automatically cleans up small revisions to conserve space.
      menu-row(
        action='ctrl.toggleSessionHistoryDiskSaving()'
        label="(ctrl.state.diskEnabled ? 'Disable' : 'Enable') + ' saving history to disk'"
        )
        .sk-sublabel
          | Saving to disk is not recommended. Decreases performance and increases app
          | loading time and memory footprint.
    menu-row(
      ng-repeat='revision in ctrl.state.sessionHistory track by $index'
      action='ctrl.openSessionRevision(revision);'
      label='revision.previewTitle()'
      )
      .sk-sublabel.opaque(ng-class='ctrl.classForSessionRevision(revision)')
        | {{revision.previewSubTitle()}}
    .sk-menu-panel-header
      .sk-menu-panel-header-title Remote
        .sk-menu-panel-header-subtitle {{ctrl.state.remoteHistory.length || 'No'}} revisions
      a.sk-a.info.sk-h5(
        ng-click='ctrl.showRemoteOptions = !ctrl.showRemoteOptions; $event.stopPropagation();'
        ) Options
    div(ng-if='ctrl.showRemoteOptions')
      menu-row(
        action='ctrl.fetchRemoteHistory()'
        label="'Refresh'"
        disabled="ctrl.isfetchingRemoteHistory"
        spinner-class="ctrl.isfetchingRemoteHistory ? 'info' : null")
        .sk-sublabel
          | Fetch history from server.
    menu-row(
      ng-repeat='revision in ctrl.state.remoteHistory track by $index'
      action='ctrl.openRemoteRevision(revision);'
      label='ctrl.previewRemoteHistoryTitle(revision);'
      )
