Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

cart link icon class is replaced after ajax update of cart link #116

Open
frankiek3 opened this issue Jun 13, 2014 · 2 comments
Open

cart link icon class is replaced after ajax update of cart link #116

frankiek3 opened this issue Jun 13, 2014 · 2 comments

Comments

@frankiek3
Copy link

add_cart_link.html.erb.deface icon class is replaced after ajax update of cart link
<i class="icon-basket"></i> is then removed

Possible fixes:
override link_to_cart in basehelper
deface erbs with link_to_cart

@frankiek3
Copy link
Author

This works but doesn't seem clean (It will also include the image in the anchor tag)
Any thoughts?

base_helper_decorator.rb

Spree::BaseHelper.class_eval do
  def link_to_cart(text = nil)
      text = text ? h(text) : Spree.t('cart')
      css_class = nil

      if simple_current_order.nil? or simple_current_order.item_count.zero?
        text = "#{text}: (#{Spree.t('empty')})"
        css_class = 'empty'
      else
        text = "#{text}: (#{simple_current_order.item_count}) <span class='amount'>#{simple_current_order.display_total.to_html}</span>"
        css_class = 'full'
      end
      text = "<i class='icon-basket'></i> #{text}"
      link_to text.html_safe, spree.cart_path, :class => "cart-info #{css_class}"
  end
end

@radar
Copy link
Contributor

radar commented Jun 18, 2014

@frankiek3 We should probably deface the template that's sent back by the /cart_link route.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants