ensl.org/app/views/gathers/_votes.html.erb

69 lines
1.8 KiB
Text
Raw Normal View History

<% vote_maps, vote_servers = false %>
<div class="box gatherMiddleBox left">
<h2 class="center">
Server voting
</h2>
<table class="gatherVotes">
<% @gather.gather_servers.ordered.each do |server| %>
<tr>
<td>
<%= if server.votes then server.votes else "0" end%>
</td>
<td>
<% if server.real_votes.build(:user => cuser).can_create? cuser %>
<%= link_to shorten(server, 15),
:controller => "votes", :action => "create",
:vote => {:votable_id => server.id, :votable_type => "GatherServer"},
:method => "post" %>
<% vote_servers = true else %>
<%= shorten server, 15 %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% if vote_servers %>
<p class="center">
Click to vote.
</p>
<p class="center">
<%= link_to "Moar servers", :controller => :servers %>
</p>
<% end %>
</div>
<div class="box gatherRightBox left">
<h2 class="center">
Vote Maps
</h2>
<table class="gatherVotes">
<% @gather.gather_maps.ordered.each do |map| %>
<tr>
<td>
<%= map.votes %>
</td>
<td>
<% if map.real_votes.build(:user => cuser).can_create? cuser %>
<%= link_to shorten(map, 15),
:controller => "votes", :action => "create",
:vote => {:votable_id => map.id, :votable_type => "GatherMap"},
:method => "post" %>
<% vote_maps = true else %>
<%= shorten map, 15 %>
<% end %>
</td>
</tr>
<% end %>
</table>
<% if vote_maps %>
<p class="center">
Click to vote.
</p>
<% end %>
</div>