mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-13 13:21:29 +00:00
Added possibility for Admins to check on votes wo querying the database manually
This commit is contained in:
parent
9c43c5cb8d
commit
50f74810ec
4 changed files with 25 additions and 1 deletions
|
@ -48,6 +48,10 @@ class PollsController < ApplicationController
|
||||||
redirect_to polls_url
|
redirect_to polls_url
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def showvotes
|
||||||
|
raise AccessError unless cuser.admin?
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def get_poll
|
def get_poll
|
||||||
|
|
|
@ -1 +1,4 @@
|
||||||
<%= render :partial => "show" %>
|
<%= render :partial => "show" %>
|
||||||
|
<% if cuser && cuser.admin? %>
|
||||||
|
<%= link_to "Show votes", polls_showvotes_url(@poll) ,class: "button" %>
|
||||||
|
<% end %>
|
16
app/views/polls/showvotes.html.erb
Normal file
16
app/views/polls/showvotes.html.erb
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<div>
|
||||||
|
<h1><%= @poll.question %></h1>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>Player</th>
|
||||||
|
<th>voted for</th>
|
||||||
|
<th>Time</th>
|
||||||
|
</tr>
|
||||||
|
<% @poll.real_votes.reverse_each do |vote| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= namelink vote.user %></td>
|
||||||
|
<td><%= vote.votable%></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
</div>
|
|
@ -130,6 +130,7 @@ Ensl::Application.routes.draw do
|
||||||
match "users/forgot", to: "users#forgot"
|
match "users/forgot", to: "users#forgot"
|
||||||
|
|
||||||
match "votes/create"
|
match "votes/create"
|
||||||
|
match "polls/showvotes/:id", to: "polls#showvotes", as: "polls_showvotes"
|
||||||
|
|
||||||
match ":controller/:action", requirements: { action: /A-Za-z/ }
|
match ":controller/:action", requirements: { action: /A-Za-z/ }
|
||||||
match ":controller/:action/:id"
|
match ":controller/:action/:id"
|
||||||
|
|
Loading…
Reference in a new issue