module Storefront # Encapsulates common browser hacks module ComponentHelper def rich_image_tag(label, path, options = {}) capture_haml do haml_tag :span haml_concat image_tag(label, path, options) end end def rich_button(*args, &block) attributes = args.extract_options! label = args.shift path = args.shift tag = attributes.delete(:as) #locale_options = attributes.delete(:locale_options) || {} #label = t?(label, locale_options.reverse_merge(:scope => :"buttons")) inner_html = attributes.delete(:inner_html) || {} outer_html = attributes.delete(:outer_html) || {} inner_html.merge! clone_attributes(attributes) outer_html.merge! clone_attributes(attributes.except(:rel, :target)) merge_class! outer_html, "button" capture_haml do haml_tag :div, :<, outer_html do result = succeed "".html_safe do if block_given? haml_concat capture_haml(&block).gsub("\n", "").strip else if tag haml_tag tag, :>, :<, inner_html else haml_concat link_to(label, path, inner_html) end end end haml_concat result end end end def rich_input(*args, &block) end end end