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

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb,
card/tmpsets/set/mod031-card-mod-layout/all/overlay.rb

Constant Summary collapse

OVERLAY_CLOSE_OPTS =
{ class: "_close-overlay btn-sm",
"data-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 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 42

def add_open_guide_opts opts
  return unless card.guide_card

  slot_selector = ".bridge-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


57
58
59
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 57

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

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



97
98
99
100
101
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 97

def haml_overlay_frame slot=true, header=render_overlay_header
  overlay_framer slot, header, {} do
    haml_wrap_body { yield }
  end
end

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



61
62
63
64
65
66
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 61

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



68
69
70
71
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 68

def overlay_delete_button
  opts = { no_success: true }.merge OVERLAY_CLOSE_OPTS
  delete_button opts
end

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



90
91
92
93
94
95
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 90

def overlay_frame slot=true, header=render_overlay_header, slot_opts=nil
  slot_opts ||= {}
  overlay_framer slot, header, slot_opts do
    wrap_body { yield }
  end
end

#overlay_header(title = nil) ⇒ Object



83
84
85
86
87
88
# File 'card/tmpsets/set/mod030-card-mod-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 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 78

def overlay_menu_link icon, args={}
  add_class args, "border-light text-dark p-1 ml-1"
  button_link fa_icon(icon, class: "fa-lg"), args.merge(btn_type: "outline-secondary")
end

#overlay_save_and_close_buttonObject



73
74
75
76
# File 'card/tmpsets/set/mod030-card-mod-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


53
54
55
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 53

def slotify_overlay_link
  overlay_menu_link "external-link-square", card: card
end

#view: overlay_headerObject



22
23
24
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 22

view :overlay_header, unknown: true do
  overlay_header
end


36
37
38
39
40
# File 'card/tmpsets/set/mod030-card-mod-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 "question-circle", opts
end

#view: overlay_menuObject



30
31
32
33
34
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 30

view :overlay_menu do
  wrap_with :div, class: "btn-group btn-group-sm align-self-start ml-auto" do
    [render_overlay_help_link, slotify_overlay_link, close_overlay_link]
  end
end

#view: overlay_titleObject



26
27
28
# File 'card/tmpsets/set/mod030-card-mod-layout/all/overlay.rb', line 26

view :overlay_title do
  _render_title
end