Module: MaterialDesign::ButtonHelper
- Defined in:
- app/helpers/material_design/button_helper.rb
Instance Method Summary collapse
- #md_button_tag(name = nil, content_or_options = nil, html_options = {}) ⇒ Object
- #md_button_to(name = nil, options = nil, html_options = {}) ⇒ Object
Instance Method Details
#md_button_tag(name = nil, content_or_options = nil, html_options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/helpers/material_design/button_helper.rb', line 19 def (name = nil, = nil, = {}) variant = [:variant] || "filled" color = [:color] || "primary" icon = [:icon] [:class] = "button--container button__#{variant}--#{color}" (, .except(:variant, :color)) do content_tag(:div, class: "layer-state layer-state__#{variant}") do content_tag(:div, class: "button--content") do concat(render("material_design/icons/icon", locals: { icon: icon, size: 18 })) if icon concat(name) end end end end |
#md_button_to(name = nil, options = nil, html_options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'app/helpers/material_design/button_helper.rb', line 3 def (name = nil, = nil, = {}) variant = [:variant] || "filled" color = [:color] || "primary" icon = [:icon] [:class] = "button--container button__#{variant}--#{color}" (, .except(:variant, :color, :icon)) do content_tag(:div, class: "layer-state layer-state__#{variant}") do content_tag(:div, class: "button--content") do concat(render("material_design/icons/icon", locals: { icon: icon, size: 18 })) if icon concat(name) end end end end |