Skip to content

Instantly share code, notes, and snippets.

@jparbros
Created February 11, 2014 23:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jparbros/8946393 to your computer and use it in GitHub Desktop.
Save jparbros/8946393 to your computer and use it in GitHub Desktop.
module ApplicationHelper
#
# Return the colums style
#
def get_column_style
return 3 if products_index
return 'left' if products_show || taxons_show
return 'right' if products_show
1
end
def render_left_col
render partial: 'shared/store_menus'
end
def render_right_col
''
end
def is_layout_fixed?
!products_show && !taxons_show
end
def get_open_closed_tag
is_layout_fixed? ? "closed" : "open"
end
def get_fluid_tag
is_layout_fixed? ? "fixed" : "fluid"
end
def footer_nav_categories_links(limit = nil)
Spree::Taxon.find_by_name("Categories").present? ?
Spree::Taxon.find_by_name("Categories").children.limit(limit) :
[]
end
def get_active_sitewide_nav
if controller_name == "home"
return "frontpage"
elsif controller_name == 'products'
return 'skate'
elsif controller_name == 'checkout'
return 'checkout'
else
return "hide"
end
end
def cart_link_text
'<span class="sprite_btn icon_cart"></span> &nbsp; &nbsp;'
# content_tag(:span, "", class: 'sprite_btn icon_cart')
end
def taxon_active?(taxon)
return true if products_index && taxon.name == 'All Longboards'
taxons_show && params[:id] == taxon.permalink
end
def products_show
controller_name == 'products' && action_name == 'show'
end
def products_index
controller_name == 'products' && action_name == 'index'
end
def taxons_show
controller_name == 'taxons' && action_name == 'show'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment