Module: Card::Set::All::Bar::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb

Instance Method Summary collapse

Instance Method Details

#bar_bottom(open: false) ⇒ Object

TODO: make card_stubs work



105
106
107
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 105

def bar_bottom open: false
  open ? render_bar_bottom : card_stub(view: :bar_bottom)
end

#bar_menu_itemsObject



73
74
75
76
77
78
79
80
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 73

def bar_menu_items
  [
    full_page_link(text: "page"),
    modal_page_link(text: "modal"),
    edit_link(:edit, text: card.new? ? "create" : "edit"),
    board_link(text: "advanced")
  ]
end

#bar_wrap_dataObject



100
101
102
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 100

def bar_wrap_data
  full_page_card == card ? wrap_data : full_page_card.format.wrap_data
end

#build_accordion_bar(open: false) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 57

def build_accordion_bar open: false
  prepare_bar mini_bar_cols
  class_up "accordion-item", "bar #{classy 'bar'}"
  wrap do
    accordion_item render_bar_body,
                   subheader: render_menu,
                   body: bar_bottom(open: open),
                   open: open,
                   context: :closed
  end
end

#build_barObject



69
70
71
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 69

def build_bar
  wrap { haml :bar }
end

#card_stub(path_args) ⇒ Object

TODO: move to a more general accessible place (or its own abstract module)



110
111
112
113
114
115
116
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 110

def card_stub path_args
  wrap_with :div,
            class: "card-slot card-slot-stub",
            data: { "stub-url": path(path_args) } do
    ""
  end
end

#class_up_cols(classes, cols, context = nil) ⇒ Object



94
95
96
97
98
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 94

def class_up_cols classes, cols, context=nil
  classes.each_with_index do |cls, i|
    class_up cls, ["col", context, cols[i]].compact.join("-")
  end
end

#prepare_bar(two_cols, three_cols = nil) ⇒ Object

NOTE: currently bar always turns to mini-bar at md



83
84
85
86
87
88
89
90
91
92
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 83

def prepare_bar two_cols, three_cols=nil
  class_up "bar", full_page_card.safe_set_keys
  class_up_cols %w[bar-left bar-right], two_cols
  class_up "bar-middle", "d-none d-md-flex"
  if three_cols
    class_up_cols %w[bar-left bar-middle bar-right], three_cols, "md"
  else
    voo.hide :bar_middle
  end
end

#view: accordion_barObject



49
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 49

view :accordion_bar, :closed

#view: barObject

drops bar-middle in small viewports



16
17
18
19
20
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 16

view :bar, unknown: :mini_bar, cache: :yes do
  cols = bar_cols.size == 3 ? [mini_bar_cols, bar_cols] : [bar_cols]
  prepare_bar(*cols)
  build_bar
end

#view: bar_bodyObject



43
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 43

view :bar_body, unknown: true, template: :haml

#view: bar_bottomObject



37
38
39
40
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 37

view :bar_bottom do
  view = nest_mode == :edit ? :edit : :content
  render view, home_view: view
end

#view: bar_leftObject



33
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 33

view(:bar_left, unknown: true) { render_title }

#view: bar_menuObject



42
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 42

view :bar_menu, unknown: true, template: :haml

#view: bar_middleObject



34
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 34

view(:bar_middle, unknown: :blank) { "" }

#view: bar_rightObject



35
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 35

view(:bar_right, unknown: :blank) { "" }

#view: closedObject



45
46
47
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 45

view :closed, unknown: :mini_bar, cache: :yes do
  build_accordion_bar
end

#view: closed_barObject



48
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 48

view :closed_bar, :closed

#view: expanded_barObject



55
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 55

view :expanded_bar, :open

#view: full_barObject



27
28
29
30
31
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 27

view :full_bar, unknown: :mini_bar, cache: :yes do
  class_up "bar", full_page_card.safe_set_keys
  class_up_cols %w[bar-left bar-middle bar-right], bar_cols
  build_bar
end

#view: mini_barObject



22
23
24
25
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 22

view :mini_bar, cache: :yes, unknown: true do
  prepare_bar mini_bar_cols
  build_bar
end

#view: openObject



51
52
53
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 51

view :open, cache: :yes do
  build_accordion_bar open: true
end

#view: open_barObject



54
# File 'platypus/tmp/set/gem-defaults/mod023-bar_and_box/all/bar.rb', line 54

view :open_bar, :open