Module: Card::Set::All::Overlay::HtmlFormat

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

Constant Summary collapse

OVERLAY_CLOSE_OPTS =
{ class: "_close-overlay btn-sm",
"data-bs-dismiss": "overlay",
type: "button" }.freeze

Instance Method Summary collapse

Instance Method Details

#add_open_guide_opts(opts) ⇒ Object



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

def add_open_guide_opts opts
  return unless card.guide_card

  slot_selector = ".board-sidebar > ._overlay-container-placeholder > .card-slot"
  opts.merge! remote: true,
              href: path(mark: card, view: :overlay_guide),
              "data-slot-selector": slot_selector,
              "data-slotter-mode": "overlay"
  add_class opts, "slotter"
end


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

def close_overlay_link
  overlay_menu_link :close, path: "#", "data-bs-dismiss": "overlay"
end

#haml_overlay_frame(slot = true, header = render_overlay_header, &block) ⇒ Object



97
98
99
100
101
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 97

def haml_overlay_frame slot=true, header=render_overlay_header, &block
  overlay_framer slot, header, {} do
    haml_wrap_body(&block)
  end
end

#overlay_close_button(link_text = "Close", opts = {}) ⇒ Object



62
63
64
65
66
67
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 62

def overlay_close_button link_text="Close", opts={}
  classes = opts.delete(:class)
  button_opts = opts.merge(OVERLAY_CLOSE_OPTS)
  add_class button_opts, classes if classes
  button_tag link_text, button_opts
end

#overlay_delete_buttonObject



69
70
71
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 69

def overlay_delete_button
  delete_button OVERLAY_CLOSE_OPTS.merge(success: {})
end

#overlay_frame(slot = true, header = render_overlay_header, slot_opts = nil, &block) ⇒ Object



90
91
92
93
94
95
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 90

def overlay_frame slot=true, header=render_overlay_header, slot_opts=nil, &block
  slot_opts ||= {}
  overlay_framer slot, header, slot_opts do
    wrap_body(&block)
  end
end

#overlay_header(title = nil) ⇒ Object



83
84
85
86
87
88
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 83

def overlay_header title=nil
  title ||= _render_overlay_title
  class_up "d0-card-header", "bg-body"
  class_up "d0-card-header-title", "d-flex"
  header_wrap [title, _render_overlay_menu]
end


78
79
80
81
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 78

def overlay_menu_link icon, args={}
  add_class args, "text-muted p-1 ms-1"
  smart_link_to icon_tag(icon), args
end

#overlay_save_and_close_buttonObject



73
74
75
76
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 73

def overlay_save_and_close_button
  submit_button text: "Save and Close", class: "_close-on-success",
                "data-cy": "submit-overlay"
end

FIXME: probably shouldn’t be new window. overlay?



54
55
56
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 54

def slotify_overlay_link
  overlay_menu_link :new_window, card: card
end

#view: overlay_headerObject



22
23
24
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 22

view :overlay_header, unknown: true do
  overlay_header
end


36
37
38
39
40
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 36

view :overlay_help_link, cache: :never, unknown: true do
  opts = help_popover_opts
  add_open_guide_opts opts
  overlay_menu_link :help, opts
end

#view: overlay_menuObject



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

view :overlay_menu do
  wrap_with :div, class: "overlay-menu" do
    [render_overlay_help_link, slotify_overlay_link, close_overlay_link]
  end
end

#view: overlay_titleObject



26
27
28
# File 'platypus/tmp/set/gem-defaults/mod031-layout/all/overlay.rb', line 26

view :overlay_title do
  _render_title
end