module Storefront # Encapsulates common browser hacks module ComponentHelper def component_image_tag capture_haml do haml_tag :span haml_concat image_tag() end end def popup_button(label, path, message, subtitle, submit = nil, kind = :group) link_to "#{label}", path, :class => "delete", "data-message" => message, "data-subtitle" => subtitle, "data-model" => kind.to_s, "data-submit" => submit.to_s end def component_button(*args, &block) options = args.extract_options! button_options = options.delete(:button_options) || {} if block_given? content = capture(&block) else label = args.shift path = args.shift content = link_to(label, path, button_options) end capture_haml do haml_tag :button, options.merge(:class => ["button", options[:class]].compact.uniq.join(" ")) do haml_concat content haml_tag :span end end end end end