webgui/app/views/pool/index.html.erb in tournament-2.6.0 vs webgui/app/views/pool/index.html.erb in tournament-3.0.0
- old
+ new
@@ -4,39 +4,46 @@
<% Pool.active_pools.each do |pool| -%>
<div class="poollistblock">
<span class="poollisthead"><%= pool.name %></span>
<small>
<% if current_user && pool.user_id == current_user.id %>
+<% if pool.tournament_entry -%>
<%= link_to '[Tourny Bracket]', :controller => 'admin', :action => 'bracket', :id => pool.tournament_entry.id %>
+<% end -%>
<%= link_to '[Recap]', :controller => 'admin', :action => 'recap', :id => pool.id%>
<%= link_to '[Edit]', :controller => 'admin', :action => 'pool', :id => pool.id %>
<%= link_to '[Entries]', :controller => 'admin', :action => 'entries', :id => pool.id %>
<% else %>
+<% if pool.tournament_entry -%>
<%= link_to '[Tourny Bracket]', :controller => 'entry', :action => 'show', :id => pool.tournament_entry.id %>
<% end %>
+<% end %>
<%= link_to '[Leader Board]', :controller => 'reports', :action => 'show', :id => pool.id, :report => 'leader' %>
<%= link_to '[Reports]', :controller => 'reports', :action => 'show', :id => pool.id %>
</small>
<div class="poollistinfo">
<div class="poollistinfodetail">
-<% if pool.starts_at < Time.zone.now %>Started<%else%>Starts<%end%>: <%= pool.starts_at.to_formatted_s(:long)%>
+<% if pool.starts_at < Time.zone.now %>Started<%else%>Starts<%end%>: <%= distance_of_time_in_words(pool.starts_at, Time.now)%>
+<% if pool.starts_at < Time.zone.now %>ago.<%else%>from now.<%end%>
Pending Entries: <%= pool.pending_entries.size%>
Total Entries: <%= pool.user_entries.size%>
</div>
<div class="poollistinfodetail">
Last Update: <%=pool.updated_at.to_formatted_s(:long)%>
</div>
<div class="poollistinfodetail">
Entry Fee: $<%=pool.fee%>
</div>
+<% if pool.user_entries.size > 0 -%>
<div class="poollistinfodetail">
Payouts:
<% take = pool.user_entries.size * pool.fee.to_f -
(pool.payouts.inject(0) {|sum, p| sum += p.kind == '$' ? p.payout.to_i : 0}) %>
<% pool.payouts.delete_if{|p| p.kind.blank?}.sort_by {|p| p.rank }.each do |p| -%>
<%=p.rank != 'L' ? p.rank.to_i.ordinal : 'Last'%>: $<%=p.kind == '$' ? p.payout : p.payout.to_f / 100.0 * take%>
<% end -%>
</div>
+<% end -%>
<div class="poollistinfodetail">
Scoring: <%=pool.pool.scoring_strategy.description%>
</div>
<div class="poollistinfodetail">
<% if current_user -%>