.ui.grid: .computer.tablet.only.row: .ui.inverted.menu.fixed
  = link-to 'index' class='header item'
    img src='/panda/app/assets/favicons/source.svg'
  if globals.current_user
    if (can 'read' 'model' 'panda/project')
      = link-to 'project' class='item'
        span= t 'models.plural.project'
    /= link-to 'tracker-subject.index' class='item'
      span= t 'models.plural.tracker_subject'
    if (can 'manage' 'model' 'panda/organization')
      = link-to 'organization' class='item'
        span= t 'models.plural.organization'
    if (can 'manage' 'model' 'user')
      = link-to 'user' class='item'
        span= t 'models.plural.user'
    = link-to 'event' class='item'
      span= t 'models.plural.event'
    = link-to 'action-list' class='item'
      span= t 'action_list.title'
    if (any-permission-starts-with 'source-file')
      a.computer.only.item href="/source_files/": span= t 'models.plural.source_file'
    if (has-permission-of-type 'adapter')
      ui-dropdown class='item'
        span Adapters
        i.dropdown.icon
        .menu
          each globals.adapters as |adapter|
            a.item href="{{concat '/adapters/' adapter.id}}" class='item'
              span= adapter.title
  .right.menu
    if globals.current_user
      ui-dropdown class='item'
        span= globals.current_user.nickname
        i.dropdown.icon
        .menu
          = link-to 'user.profile' class='item'
            i.user.icon
            span.text= t 'user.profile'
          = link-to 'manual' class='item'
            i.book.icon
            span.text= t 'manual.title'
          a.item{ action 'signOut'}
            i.toggle.right.icon
            span.text= t 'user.sign_out'
    else
      = link-to 'Login' 'login' class='item'
.ui.grid: .mobile.only.row
  .ui.inverted.menu.fixed
    = link-to 'index' class='header item'
      img src='/panda/app/assets/favicons/source.svg'
    if globals.current_user
      ui-dropdown class='item'
        span Menu
        i.dropdown.icon
        .menu
          = link-to 'action-list' class='item'
            span= t 'action_list.title'
          if (can 'read' 'model' 'panda/project')
            = link-to 'project' class='item'
              span= t 'models.plural.project'
          /= link-to 'tracker-subject.index' class='item'
            span= t 'models.plural.tracker_subject'
          if (can 'manage' 'model' 'panda/organization')
            = link-to 'organization' class='item'
              span= t 'models.plural.organization'
          if (can 'manage' 'model' 'user')
            = link-to 'user' class='item'
              span= t 'models.plural.user'
          = link-to 'event' class='item'
            span= t 'models.plural.event'
          if (any-permission-starts-with 'source-file')
            a.item href="/source_files/": span= t 'models.plural.source_file'
          if (has-permission-of-type 'adapter')
            .item
              i.dropdown.icon
              span.text Adapters
              .right.menu
                each globals.adapters as |adapter|
                  a.item href="{{concat '/adapters/' adapter.id}}" class='item'
                    span= adapter.title
    .right.menu
      if globals.current_user
        ui-dropdown class='item'
          span= globals.current_user.nickname
          i.dropdown.icon
          .menu
            = link-to 'user.profile' class='item'
              i.user.icon
              span.text= t 'user.profile'
            = link-to 'manual' class='item'
              i.book.icon
              span.text= t 'manual.title'
            a.item{ action 'signOut'}
              i.toggle.right.icon
              span.text= t 'user.sign_out'
      else
        = link-to 'Login' 'login' class='item'
