Class: Matestack::Ui::Bootstrap::Layout::Sidebar

Inherits:
BaseVueJsComponent show all
Defined in:
lib/matestack/ui/bootstrap/layout/sidebar.rb

Instance Method Summary collapse

Instance Method Details

#responseObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/matestack/ui/bootstrap/layout/sidebar.rb', line 9

def response
  nav class: 'sidebar pt-4 px-3 shadow-sm bg-white' do
    div class: "sidebar-toggler" do
      bs_btn variant: :link, "@click": "vc.sidebarToggle" do
        bs_icon name: "list", size: 25, class: "text-muted"
      end
    end
    div class: "sidebar-top mb-3" do
      slot :sidebar_top if slots && slots[:sidebar_top].present?
    end
    div class: "sidebar-navigation my-3" do
      sidebar_navigation_partial
    end
  end
end


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/matestack/ui/bootstrap/layout/sidebar.rb', line 25

def sidebar_navigation_partial
  div class: "list-group" do
    context.sidebar_navigation_items.each do |item|
      if item[:type] == :link
        a class: "list-group-item list-group-item-action border-0 rounded", href: item[:path] do
          bs_icon name: item[:icon], size: 20 if item[:icon]
          span item[:text], class: "ps-3" if item[:text]
        end
      else
        transition class: "list-group-item list-group-item-action border-0 rounded", path: item[:path], delay: item[:delay] || 300 do
          bs_icon name: item[:icon], size: 20 if item[:icon]
          span item[:text], class: "ps-3" if item[:text]
        end
      end
    end
  end
end