mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-26 12:30:48 +00:00
57 lines
1.6 KiB
Text
57 lines
1.6 KiB
Text
<% vote_maps, vote_servers = false %>
|
|
|
|
<div class="data servers">
|
|
<div class="contents">
|
|
<h4>Server Votes</h4>
|
|
|
|
<ul class="votes">
|
|
<% @gather.gather_servers.ordered.each do |server| %>
|
|
<li>
|
|
<span class="count">
|
|
<%= if server.votes then server.votes else "0" end %>
|
|
</span>
|
|
<% if server.real_votes.build(user: cuser).can_create? cuser %>
|
|
<%= link_to server,
|
|
controller: "votes", action: "create",
|
|
vote: { votable_id: server.id, votable_type: "GatherServer" },
|
|
method: "post" %>
|
|
<% vote_servers = true else %>
|
|
<%= server %>
|
|
<% end %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<% if vote_servers %>
|
|
<p>Click to vote</p>
|
|
<p><%= link_to "More servers", { controller: :servers }, { class: 'button tiny' } %></p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="data">
|
|
<div class="contents">
|
|
<h4>Map Votes</h4>
|
|
|
|
<ul class="votes">
|
|
<% @gather.gather_maps.ordered.each do |map| %>
|
|
<li>
|
|
<span><%= map.votes %></span>
|
|
<% if map.real_votes.build(user: cuser).can_create? cuser %>
|
|
<%= link_to shorten(map, 30),
|
|
controller: "votes", action: "create",
|
|
vote: { votable_id: map.id, votable_type: "GatherMap" },
|
|
method: "post" %>
|
|
<% vote_maps = true %>
|
|
<% else %>
|
|
<%= shorten map, 30 %>
|
|
<% end %>
|
|
</li>
|
|
<% end %>
|
|
</ul>
|
|
|
|
<% if vote_maps %>
|
|
<p>Click to vote</p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|