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
-
#board_icon ⇒ Object
-
#board_link(text: "", in_modal: true, confirm: false) ⇒ String
Generates a link to a board with optional parameters.
-
#confirm_edit_loss(opts) ⇒ Object
-
#edit_in_board_link(opts = {}) ⇒ Object
-
#edit_link(view = :edit, link_text: nil, text: "", modal: nil) ⇒ Object
-
#edit_link_opts(modal: nil) ⇒ Hash
Generates options hash for an edit link with optional parameters.
-
#edit_link_view ⇒ Object
-
#edit_view ⇒ Object
-
#full_page_card ⇒ Object
-
#full_page_icon ⇒ Object
-
#full_page_link(text: "") ⇒ Object
-
#help_link(text = nil, title = nil) ⇒ Object
-
#help_popover_opts(text = nil, title = nil) ⇒ Object
-
#help_title ⇒ Object
-
#menu_board_link ⇒ Object
-
#menu_edit_link ⇒ Object
-
#menu_icon ⇒ Object
-
#menu_items ⇒ Object
-
#menu_link_classes ⇒ Object
-
#modal_icon ⇒ Object
-
#modal_page_link(text: "") ⇒ Object
-
#modal_page_size ⇒ Object
-
#name_parts_links ⇒ Object
-
#new_window_card ⇒ Object
-
#new_window_icon ⇒ Object
-
#new_window_link(text: "") ⇒ Object
-
#view: board_link ⇒ Object
-
#view: edit_button ⇒ Object
-
#view: edit_link ⇒ Object
-
#view: full_page_link ⇒ Object
-
#view: help_link ⇒ Object
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.
-
#view: menu ⇒ Object
-
#view: menu_block ⇒ Object
Instance Method Details
#board_icon ⇒ Object
207 208 209 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 207 def board_icon icon_tag :board end |
#board_link(text: "", in_modal: true, confirm: false) ⇒ String
Generates a link to a board with optional parameters.
91 92 93 94 95 96 97 98 99 100 101 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 91 def board_link text: "", in_modal: true, confirm: false opts = { class: "board-link", title: "Advanced", "data-bs-toggle": "tooltip", "data-bs-placement": "bottom" } opts["data-slotter-mode"] = "modal-replace" if in_modal confirm_edit_loss opts if confirm link_to_view :board, "#{board_icon} #{text}", opts end |
#confirm_edit_loss(opts) ⇒ Object
211 212 213 214 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 211 def confirm_edit_loss opts add_class opts, "_confirm" opts["data-confirm-msg"] = t(:format_confirm_edit_loss) end |
#edit_in_board_link(opts = {}) ⇒ Object
153 154 155 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 153 def edit_in_board_link opts={} edit_link :board, *opts end |
#edit_link(view = :edit, link_text: nil, text: "", modal: nil) ⇒ Object
157 158 159 160 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 157 def edit_link view=:edit, link_text: nil, text: "", modal: nil link_to_view view, link_text || "#{} #{text}", edit_link_opts(modal: (modal || :lg)) end |
#edit_link_opts(modal: nil) ⇒ Hash
Generates options hash for an edit link with optional parameters.
173 174 175 176 177 178 179 180 181 182 183 184 185 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 173 def edit_link_opts modal: nil opts = { class: classy("edit-link"), title: "Edit", "data-bs-toggle": "tooltip", "data-bs-placement": "bottom" } if modal opts[:"data-slotter-mode"] = "modal" opts[:"data-modal-class"] = "modal-#{modal}" end opts end |
#edit_link_view ⇒ Object
75 76 77 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 75 def edit_link_view :edit end |
#edit_view ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 64 def edit_view case voo.edit when :inline :edit_inline when :full :edit else # :standard edit_link end end |
#full_page_card ⇒ Object
145 146 147 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 145 def full_page_card card end |
#full_page_icon ⇒ Object
195 196 197 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 195 def full_page_icon icon_tag :full_page end |
#full_page_link(text: "") ⇒ Object
125 126 127 128 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 125 def full_page_link text: "" link_to_card full_page_card, "#{full_page_icon} #{text}", class: classy("full-page-link") end |
#help_link(text = nil, title = nil) ⇒ Object
103 104 105 106 107 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 103 def help_link text=nil, title=nil opts = help_popover_opts text, title add_class opts, "_card-menu-popover" link_to icon_tag(:help), opts end |
#help_popover_opts(text = nil, title = nil) ⇒ Object
109 110 111 112 113 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 109 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_title ⇒ Object
115 116 117 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 115 def help_title "#{name_parts_links} (#{render_type}) #{full_page_link unless card.simple?}" end |
#menu_board_link ⇒ Object
56 57 58 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 56 def voo.show?(:board_link) ? board_link(in_modal: false) : nil end |
#menu_edit_link ⇒ Object
45 46 47 48 49 50 51 52 53 54 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 45 def case voo.edit when :inline edit_inline_link when :full edit_in_board_link else # :standard edit_link end end |
#menu_icon ⇒ Object
191 192 193 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 191 def icon_tag "edit" end |
#menu_items ⇒ Object
60 61 62 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 60 def [render_help_link, , ] end |
#menu_link_classes ⇒ Object
187 188 189 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 187 def "nodblclick#{show_view?(:hover_link) ? ' _show-on-hover' : ''}" end |
#modal_icon ⇒ Object
203 204 205 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 203 def modal_icon icon_tag :modal end |
#modal_page_link(text: "") ⇒ Object
136 137 138 139 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 136 def modal_page_link text: "" modal_link "#{modal_icon} #{text}", path: { mark: card }, size: modal_page_size, class: "_modal-page-link" end |
#modal_page_size ⇒ Object
141 142 143 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 141 def modal_page_size :xl end |
#name_parts_links ⇒ Object
119 120 121 122 123 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 119 def name_parts_links card.name.parts.map do |part| link_to_card part end.join Card::Name.joint end |
#new_window_card ⇒ Object
149 150 151 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 149 def new_window_card full_page_card end |
#new_window_icon ⇒ Object
199 200 201 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 199 def new_window_icon icon_tag :new_window end |
#new_window_link(text: "") ⇒ Object
130 131 132 133 134 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 130 def new_window_link text: "" link_to_card new_window_card, "#{new_window_icon} #{text}", class: classy("new-window-link"), target: "window_#{rand 999}" end |
#view: board_link ⇒ Object
35 36 37 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 35 view :board_link, unknown: true do board_link end |
#view: edit_button ⇒ Object
26 27 28 29 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 26 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 |
#view: edit_link ⇒ Object
22 23 24 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 22 view :edit_link, unknown: true, denial: :blank do edit_link edit_link_view end |
#view: full_page_link ⇒ Object
31 32 33 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 31 view :full_page_link do full_page_link end |
#view: help_link ⇒ Object
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.
41 42 43 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 41 view :help_link, cache: :never, unknown: true do help_link render_help_text, help_title end |
#view: menu ⇒ Object
15 16 17 18 19 20 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 15 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 #{}") { } end |
#view: menu_block ⇒ Object
9 10 11 12 13 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 9 view :menu_block do wrap_with :div, class: "menu-block position-relative py-2" do [, " "] end end |