Module: MarkdownToolsHelper
- Defined in:
- app/helpers/markdown_tools_helper.rb
Instance Method Summary collapse
-
#md_button(name = nil, action: nil, label: nil, **attribs) {|context| ... } ⇒ ActiveSupport::SafeBuffer
Create a Markdown tool button.
-
#md_list_item(name = nil, action: nil, label: nil, **attribs) {|context| ... } ⇒ ActiveSupport::SafeBuffer
Create a Markdown tool list item.
Instance Method Details
#md_button(name = nil, action: nil, label: nil, **attribs) {|context| ... } ⇒ ActiveSupport::SafeBuffer
Create a Markdown tool button.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/markdown_tools_helper.rb', line 21 def (name = nil, action: nil, label: nil, **attribs, &block) attribs.merge! href: 'javascript:void(0)', class: "#{attribs[:class] || ''} button is-muted is-outlined js-markdown-tool", data_action: action, aria_label: label, title: label, role: 'button' attribs.transform_keys! { |k| k.to_s.tr('_', '-') }.symbolize_keys! if name.nil? && block_given? tag.a(**attribs, &block) else tag.a name, **attribs end end |
#md_list_item(name = nil, action: nil, label: nil, **attribs) {|context| ... } ⇒ ActiveSupport::SafeBuffer
Create a Markdown tool list item. Identical to
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'app/helpers/markdown_tools_helper.rb', line 41 def md_list_item(name = nil, action: nil, label: nil, **attribs, &block) attribs.merge! href: 'javascript:void(0)', class: "#{attribs[:class] || ''}js-markdown-tool", data_action: action, aria_label: label, title: label, role: 'button' attribs.transform_keys! { |k| k.to_s.tr('_', '-') }.symbolize_keys! if name.nil? && block_given? tag.a(**attribs, &block) else tag.a name, **attribs end end |