Module: Cartify::ApplicationHelper

Defined in:
app/helpers/cartify/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#active_class(link_path) ⇒ Object



8
9
10
11
# File 'app/helpers/cartify/application_helper.rb', line 8

def active_class(link_path)
  return '' if request.GET.empty?
  link_path.include? request.GET.first.join('=') ? 'active' : ''
end

#country_name(object) ⇒ Object



13
14
15
16
# File 'app/helpers/cartify/application_helper.rb', line 13

def country_name(object)
  country = ISO3166::Country[object.country]
  country.translations[I18n.locale.to_s] || country.name
end

#shop_icon_quantityObject



3
4
5
6
# File 'app/helpers/cartify/application_helper.rb', line 3

def shop_icon_quantity
  qty = current_order.order_items.reload.collect(&:quantity).compact.sum
  "<span class='shop-quantity'>#{qty}</span>".html_safe unless qty.zero?
end