Module: Workarea::Storefront::HavenSwatchesHelper
- Defined in:
- app/helpers/workarea/storefront/haven_swatches_helper.rb
Instance Method Summary collapse
Instance Method Details
#render_swatch_option(selection, swatch) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/workarea/storefront/haven_swatches_helper.rb', line 4 def render_swatch_option(selection, swatch) id = selection.optionize if swatch&.image? image_tag( swatch.image.process(:swatch_thumb).url, alt: selection, class: "option-button__image option-button__image--#{id}" ) elsif swatch&.hex? content_tag( :div, "", class: "option-button__swatch option-button__swatch--#{id}", style: "background-color: #{swatch.hex};" ) end end |