Skip to content

Instantly share code, notes, and snippets.

@procload
Created April 29, 2013 20:19
Show Gist options
  • Save procload/5484462 to your computer and use it in GitHub Desktop.
Save procload/5484462 to your computer and use it in GitHub Desktop.
module Public::BidsHelper
def bid_status_for(item, user = nil)
user ||= current_user
if item.high_bid_user_id.eql?(user.id)
<<<<<<< HEAD
html = %Q{<i class="icon-trophy winning"></i>}
elsif item.bids.where(user_id: user.id).any?
html = %q{<i class="icon-ban-circle outbid"></i>}
=======
html = %Q{<span class="label label-success"></span>}
elsif item.bids.any? && item_bid_for?(item, user)
html = %q{<span class="label label-important"></span>}
>>>>>>> staging
else
html = %q{<i class="icon-eye-open watching"></i>}
end
end
<<<<<<< HEAD
end
=======
def item_bid_for?(item, user)
if defined?(current_followed_items)
@item_ids ||= Bid.where('bids.user_id = ? AND bids.item_id IN (?)', user.id, current_followed_items.collect(&:id)).pluck(:item_id)
@item_ids.include?(item.id)
else
item.bids.where(user_id: user.id).any?
end
end
end
>>>>>>> staging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment