Last active
August 29, 2015 13:55
-
-
Save radar/8769321 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def more_products_link | |
object = @store || @tag || @collection | |
link_to 'Load More Products', [object, :view], :class => 'load-more-products', :remote => true if @products.next_page | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tile | |
# /t/:tag Show all by tag | |
# /s/:store_slug Show all by store | |
# /c/:collection_slug Show all by collection | |
# Nothing passed Show all by rank | |
if params[:tag] | |
# find by tag | |
# to be implemented | |
# @tag = Tag.friendly.find(params[:tag_slug]) | |
elsif params[:store_slug] | |
@store = Store.friendly.find(params[:store_slug]) | |
@products = @store.products | |
elsif params[:collection_slug] | |
@collection = Collection.friendly.find(params[:collection_slug]) | |
@products = @collection.products | |
else | |
@products = Product | |
end | |
@products = @products.paginate(:page => params[:page]).order('rank DESC') | |
respond_to do |format| | |
format.html | |
format.json | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment