Sha256: 15b3d98464bb7ab3ecfa9e4a9be7cd5ba2014ff0eac03db6151e63c8ffd704ee

Contents?: true

Size: 769 Bytes

Versions: 4

Compression:

Stored size: 769 Bytes

Contents

Spree::BaseHelper.module_eval do
  def link_to_cart(text = t('cart'))
    item_count =  (current_order.nil? or current_order.line_items.empty?) ? 0 : current_order.item_count
    text = "<h4>#{text} <span class=\"badge badge-info\">#{item_count}</span></h4>"

    link_to text.html_safe, cart_path
  end

  # Outputs the corresponding flash message if any are set
  def flash_messages
    bootstrap_class = {"notice" => "alert alert-success", "error" => "alert alert-error", "warning" => "alert"}
    bootstrap_class.keys.map do |msg|
      content_tag(:div, ("<a class=\"close\" data-dismiss=\"alert\">&#215;</a>".html_safe + flash.delete(msg.to_sym).html_safe), {:class => bootstrap_class[msg]}) unless flash[msg.to_sym].blank?
    end.join("\n").html_safe
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
synergy_bootstrap_theme-0.0.4 app/helpers/base_helper_decorator.rb
synergy_bootstrap_theme-0.0.3 app/helpers/base_helper_decorator.rb
synergy_bootstrap_theme-0.0.2 app/helpers/base_helper_decorator.rb
synergy_bootstrap_theme-0.0.1 app/helpers/base_helper_decorator.rb