Module: Card::Set::All::NavbarLinks::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb

Instance Method Summary collapse

Instance Method Details



57
58
59
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 57

def dropdown_menu
  wrap_with :div, dropdown_menu_items, class: "dropdown-menu"
end


61
62
63
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 61

def dropdown_menu_items
  navbar_items view: :nav_link_in_dropdown, link_class: "dropdown-item"
end


52
53
54
55
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 52

def dropdown_toggle_link
  link_to(render_title, href: "#", class: "nav-link dropdown-toggle",
                        "data-bs-toggle": "dropdown")
end


43
44
45
46
47
48
49
50
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 43

def nav_dropdown
  wrap_with(:li, class: "nav-item dropdown") do
    [
      dropdown_toggle_link,
      dropdown_menu
    ]
  end
end

Iterates over all nests and links and renders them as bootstrap navbar items. Items that are pointer cards become dropdowns



17
18
19
20
21
22
23
24
25
26
27
28
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 17

def navbar_items view: :nav_item, link_class: "nav-link"
  process_content nil, chunk_list: :references do |chunk|
    case chunk
    when Card::Content::Chunk::Link
      navbar_link_chunk chunk, view, link_class
    when Card::Content::Chunk::Nest
      navbar_nest_chunk chunk, view
    else
      chunk.process_chunk
    end
  end
end

overridden in Abstract::Items to render dropdown



31
32
33
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 31

view :nav_item do
  wrap_with_nav_item link_view(class: "nav-link")
end


39
40
41
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 39

view :nav_link_in_dropdown do
  link_to_card card, render_title, class: "dropdown-item"
end


9
10
11
12
13
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 9

view :navbar_links, perms: :none do
  wrap_with :ul, class: "navbar-nav" do
    navbar_items
  end
end

#wrap_with_nav_item(content) ⇒ Object



35
36
37
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/navbar_links.rb', line 35

def wrap_with_nav_item content
  wrap_with(:li, content, class: "nav-item")
end