Sha256: d0e64dd816a27680e1779e592eb92cfb3f7e2c0baa93daca5f8a860de5f31748

Contents?: true

Size: 1.82 KB

Versions: 3

Compression:

Stored size: 1.82 KB

Contents

- if authenticated?
  - Ditty::Components.navigation(request).each do |item|
    - if item[:type] == 'divider'
      %hr.sidebar-divider.my-0
    - elsif item[:target].nil? || policy(item[:target]).list?
      - if item[:group]
        %li.nav-item
          %a.nav-link.collapsed{ href: '#', 'data-toggle': 'collapse', 'data-target': "##{item[:group].parameterize}", 'aria-expanded': 'true', 'aria-controls': item[:group].parameterize }
            - if item[:icon]
              %i.fas.fa-fw{ class: "fa-#{item[:icon]}" }
            %span= item[:group]
          .collapse{ id: item[:group].parameterize, 'data-parent': '#accordionSidebar' }
            .bg-white.py-2.collapse-inner.rounded
              - item[:items].each do |sub_item|
                - next unless sub_item[:target] && policy(sub_item[:target]).list?
                %a.collapse-item{ href: "#{settings.map_path}#{sub_item[:link]}" }
                  - if sub_item[:icon]
                    %i.fa.fa-fw{ class: "fa-#{sub_item[:icon]}" }
                  = sub_item[:text]
      - else
        %li.nav-item
          %a.nav-link{ href: "#{settings.map_path}#{item[:link]}" }
            - if item[:icon]
              %i.fas.fa-fw{ class: "fa-#{item[:icon]}" }
            %span= item[:text]
  %hr.sidebar-divider.my-0
  %li.nav-item
    = delete_form_tag("#{settings.map_path}/auth", attributes: { id: 'logout-form' }) do
      %a.nav-link{ type: 'submit', onClick: 'document.getElementById("logout-form").submit()' }
        %i.fas.fa-fw.fa-sign-out-alt
        %span Logout
- else
  %li.nav-item
    %a.nav-link{ href: "#{settings.map_path}/auth/login" }
      %i.fas.fa-fw.fa-user
      %span Log In
  - if policy(::Ditty::User).register?
    %li.nav-item
      %a.nav-link{ href: "#{settings.map_path}/auth/register" }
        %i.fas.fa-fw.fa-pen-square
        %span Register

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ditty-0.11.1 views/partials/navitems.haml
ditty-0.10.2 views/partials/navitems.haml
ditty-0.10.1 views/partials/navitems.haml