diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index c5d327b..aad35b2 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -48,6 +48,10 @@ class PollsController < ApplicationController redirect_to polls_url end + def showvotes + raise AccessError unless cuser.admin? + end + private def get_poll diff --git a/app/views/polls/show.html.erb b/app/views/polls/show.html.erb index 44552ee..eebdaa6 100644 --- a/app/views/polls/show.html.erb +++ b/app/views/polls/show.html.erb @@ -1 +1,4 @@ -<%= render :partial => "show" %> \ No newline at end of file +<%= render :partial => "show" %> +<% if cuser && cuser.admin? %> + <%= link_to "Show votes", polls_showvotes_url(@poll) ,class: "button" %> +<% end %> \ No newline at end of file diff --git a/app/views/polls/showvotes.html.erb b/app/views/polls/showvotes.html.erb new file mode 100644 index 0000000..f644c7e --- /dev/null +++ b/app/views/polls/showvotes.html.erb @@ -0,0 +1,16 @@ +
+

<%= @poll.question %>

+ + + + + + + <% @poll.real_votes.reverse_each do |vote| %> + + + + + <% end %> +
Playervoted forTime
<%= namelink vote.user %><%= vote.votable%>
+
\ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index d1d98fb..c0c9665 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -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"