mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-11-15 01:11:23 +00:00
Added possibility for Admins to check on votes wo querying the database manually
This commit is contained in:
parent
c882419af2
commit
624da53bb6
4 changed files with 25 additions and 1 deletions
|
@ -48,6 +48,10 @@ class PollsController < ApplicationController
|
|||
redirect_to polls_url
|
||||
end
|
||||
|
||||
def showvotes
|
||||
raise AccessError unless cuser.admin?
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
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 "votes/create"
|
||||
match "polls/showvotes/:id", to: "polls#showvotes", as: "polls_showvotes"
|
||||
|
||||
match ":controller/:action", requirements: { action: /A-Za-z/ }
|
||||
match ":controller/:action/:id"
|
||||
|
|
Loading…
Reference in a new issue