-
Notifications
You must be signed in to change notification settings - Fork 34
/
index.html.erb
41 lines (40 loc) · 1.44 KB
/
index.html.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<h1 class="trip_index_header" id="headline">Choose Your Time Adventure!</h1>
<div class="trips_container">
<% @trips.each_with_index do |each, index| %>
<% last = (index + 1) % 3 == 0 %>
<div class="span-6 <%= last ? "last" : "" %> trip_entry">
<div class="trip_header"><%= link_to each.name, each %></div>
<div class="trip_tag"><%= h each.tag_line %></div>
<div class="trip_dates">
<%= each.start_date.to_s(:long) %> - <%= each.end_date.to_s(:long) %>
</div>
<div style="text-align: center">
<img src="assets/<%= h each.image_name %>" height="150" width="150">
</div>
<div class="trip_price"><%= number_to_currency each.price%></div>
<div class="trip_links">
<%= link_to "Show Details", each, :class => 'detail_toggle' %>
<div class="detail hidden">
<div>
<%= each.description %>
</div>
</div>
<br />
<% if current_user %>
<% purchased = false %>
<% current_user.purchases.each do |purchase| %>
<% if purchase.trip == each %>
<% purchased = true %>
<% end %>
<% end %>
<% if purchased %>
Bought!
<% else %>
<%= link_to "Go on #{each.name}", purchases_path(:id => each.id),
:method => :post, :class => "purchase_link" %>
<% end %>
<% end %>
</div>
</div>
<% end %>
</div>