Module: Card::Set::All::Html::Menu::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb

Instance Method Summary collapse

Instance Method Details

#bridge_iconObject



157
158
159
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 157

def bridge_icon
  fa_icon :box
end


63
64
65
66
67
68
69
70
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 63

def bridge_link text: "", in_modal: true
  opts = { class: "bridge-link" }
  if in_modal
    # add_class opts, "close"
    opts["data-slotter-mode"] = "modal-replace"
  end
  link_to_view :bridge, "#{bridge_icon} #{text}", opts
end


122
123
124
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 122

def edit_in_bridge_link opts={}
  edit_link :bridge, *opts
end


126
127
128
129
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 126

def edit_link view=:edit, link_text: nil, text: "", modal: nil
  link_to_view view, link_text || "#{menu_icon} #{text}",
               edit_link_opts(modal: (modal || :lg))
end

Parameters:

  • modal (Symbol) (defaults to: nil)

    modal size



132
133
134
135
136
137
138
139
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 132

def edit_link_opts modal: nil
  opts = { class: classy("edit-link") }
  if modal
    opts[:"data-slotter-mode"] = "modal"
    opts[:"data-modal-class"] = "modal-#{modal}"
  end
  opts
end


51
52
53
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 51

def edit_link_view
  :edit
end

#edit_viewObject



31
32
33
34
35
36
37
38
39
40
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 31

def edit_view
  case voo.edit
  when :inline
    :edit_inline
  when :full
    :edit
  else # :standard
    edit_link
  end
end

#full_page_cardObject



118
119
120
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 118

def full_page_card
  card
end

#full_page_iconObject



149
150
151
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 149

def full_page_icon
  icon_tag :open_in_new
end


104
105
106
107
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 104

def full_page_link text: ""
  link_to_card full_page_card, "#{full_page_icon} #{text}",
               class: classy("full-page-link")
end

#help_iconObject



90
91
92
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 90

def help_icon
  material_icon("help")
end


78
79
80
81
82
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 78

def help_link text=nil, title=nil
  opts = help_popover_opts text, title
  add_class opts, "_card-menu-popover"
  link_to help_icon, opts
end

#help_popover_opts(text = nil, title = nil) ⇒ Object



84
85
86
87
88
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 84

def help_popover_opts text=nil, title=nil
  text ||= render_help_text
  opts = { "data-bs-placement": :left, class: "help-link" }
  popover_opts text, title, opts
end

#help_titleObject



94
95
96
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 94

def help_title
  "#{name_parts_links} (#{render_type}) #{full_page_link unless card.simple?}"
end


145
146
147
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 145

def menu_icon
  material_icon "edit"
end


20
21
22
23
24
25
26
27
28
29
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 20

def menu_link
  case voo.edit
  when :inline
    edit_inline_link
  when :full
    edit_in_bridge_link
  else # :standard
    edit_link
  end
end


141
142
143
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 141

def menu_link_classes
  "nodblclick#{show_view?(:hover_link) ? ' _show-on-hover' : ''}"
end


153
154
155
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 153

def modal_icon
  fa_icon :expand
end


109
110
111
112
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 109

def modal_page_link text: ""
  modal_link "#{modal_icon} #{text}",
             path: { mark: card }, size: modal_page_size, class: "_modal-page-link"
end


114
115
116
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 114

def modal_page_size
  :xl
end


98
99
100
101
102
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 98

def name_parts_links
  card.name.parts.map do |part|
    link_to_card part
  end.join Card::Name.joint
end


59
60
61
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 59

view :bridge_link, unknown: true do
  bridge_link
end

#view: edit_buttonObject



46
47
48
49
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 46

view :edit_button do
  view = voo.edit == :inline ? :edit_inline : :edit
  link_to_view view, "Edit", class: "btn btn-sm btn-outline-primary me-2"
end


42
43
44
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 42

view :edit_link, unknown: true, denial: :blank do
  edit_link edit_link_view
end


55
56
57
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 55

view :full_page_link do
  full_page_link
end

no caching because help_text view doesn’t cache, and we can’t have a stub in the data-content attribute or it will get html escaped.



74
75
76
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 74

view :help_link, cache: :never, unknown: true do
  help_link render_help_text, help_title
end


9
10
11
12
13
14
15
16
17
18
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 9

view :menu, denial: :blank, unknown: true do
  return "" unless card.known?
  # would be preferable to do this with unknown: :blank, but that fails with view
  # caching on, because voo always thinks it's the root.
  wrap_with :div, class: "card-menu #{menu_link_classes}" do
    [render_help_link,
     menu_link,
     (voo.show?(:bridge_link) ? bridge_link(in_modal: false) : nil)]
  end
end