Created
June 11, 2011 19:38
-
-
Save jonpaul/1020873 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<ul id="listings"> | |
<% @listings.each do |listing| %> | |
<li <%= "class=stickered" if listing.investor_car? || listing.sticker? %>> | |
<input type="hidden" name="listing_id" value="<%= listing.id %>" class="listing_id" /> | |
<% if listing.featured? %> | |
<%= image_tag("icons/featured_sticker.png", :class => "featuredSticker")%> | |
<% end %> | |
<div class="img"> | |
<% if listing.primary_photo_id.blank? && !listing.vehicle_listing_images.first.nil? %> | |
<%= link_to(image_tag(listing.vehicle_listing_images.first.vehicle.url(:search), :class => 'primary_image'), listing) %> | |
<% elsif !listing.primary_photo_id.blank? %> | |
<%= link_to(image_tag(VehicleListingImage.find(listing.primary_photo_id).vehicle.url(:search), :class => 'primary_image'), listing) %> | |
<% else %> | |
"Sorry, No Images for this Product." | |
<% end %> | |
</div> | |
. | |
. | |
. |
This file contains hidden or 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 search | |
. | |
. | |
. | |
@listings = WillPaginate::Collection.create(params[:page], 25) do |pager| | |
listings = VehicleListing.limit(25) | |
listings = listings.offset(params[:page].to_i) unless offset == false | |
listings = listings.search(params[:search]).all | |
pager.replace(listings) | |
pager.total_entries = @search_total.count | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment