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
208 209 210 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 208 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.
92 93 94 95 96 97 98 99 100 101 102 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 92 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
212 213 214 215 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 212 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
154 155 156 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 154 def edit_in_board_link opts={} edit_link :board, *opts end |
#edit_link(view = :edit, link_text: nil, text: "", modal: nil) ⇒ Object
158 159 160 161 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 158 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.
174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 174 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
76 77 78 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 76 def edit_link_view :edit end |
#edit_view ⇒ Object
65 66 67 68 69 70 71 72 73 74 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 65 def edit_view case voo.edit when :inline :edit_inline when :full :edit else # :standard edit_link end end |
#full_page_card ⇒ Object
146 147 148 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 146 def full_page_card card end |
#full_page_icon ⇒ Object
196 197 198 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 196 def full_page_icon icon_tag :full_page end |
#full_page_link(text: "") ⇒ Object
126 127 128 129 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 126 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
104 105 106 107 108 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 104 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
110 111 112 113 114 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 110 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
116 117 118 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 116 def help_title "#{name_parts_links} (#{render_type}) #{full_page_link unless card.simple?}" end |
#menu_board_link ⇒ Object
57 58 59 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 57 def voo.show?(:board_link) ? board_link(in_modal: false) : nil end |
#menu_edit_link ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 46 def case voo.edit when :inline edit_inline_link when :full edit_in_board_link else # :standard edit_link end end |
#menu_icon ⇒ Object
192 193 194 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 192 def icon_tag "edit" end |
#menu_items ⇒ Object
61 62 63 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 61 def [render_help_link, , ] end |
#menu_link_classes ⇒ Object
188 189 190 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 188 def "nodblclick#{show_view?(:hover_link) ? ' _show-on-hover' : ''}" end |
#modal_icon ⇒ Object
204 205 206 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 204 def modal_icon icon_tag :modal end |
#modal_page_link(text: "") ⇒ Object
137 138 139 140 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 137 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
142 143 144 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 142 def modal_page_size :xl end |
#name_parts_links ⇒ Object
120 121 122 123 124 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 120 def name_parts_links card.name.parts.map do |part| link_to_card part end.join Card::Name.joint end |
#new_window_card ⇒ Object
150 151 152 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 150 def new_window_card full_page_card end |
#new_window_icon ⇒ Object
200 201 202 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 200 def new_window_icon icon_tag :new_window end |
#new_window_link(text: "") ⇒ Object
131 132 133 134 135 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 131 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
36 37 38 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 36 view :board_link, unknown: true do board_link end |
#view: edit_button ⇒ Object
27 28 29 30 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 27 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
23 24 25 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 23 view :edit_link, unknown: true, denial: :blank do edit_link edit_link_view end |
#view: full_page_link ⇒ Object
32 33 34 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 32 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.
42 43 44 |
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/html/menu.rb', line 42 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 21 |
# 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 |