+ votes#index

This commit is contained in:
Kiara Grouwstra 2023-01-24 16:36:42 +01:00
parent 217c76d0e4
commit 62c03379c9
2 changed files with 41 additions and 2 deletions

View File

@ -2,8 +2,18 @@ class VotesController < ApplicationController
http_basic_authenticate_with name: Rails.application.config.admin_name,
password: Rails.application.config.admin_password
before_action :set_room, only: [:bulk, :destroy_for_room]
before_action :set_votes, only: [:bulk, :destroy_for_room]
before_action :set_room, only: [:index, :bulk, :destroy_for_room]
before_action :set_votes, only: [:index, :bulk, :destroy_for_room]
# GET /rooms/:room_id/votes
# GET /rooms/:room_id/votes.json
def index
respond_to do |format|
format.html { render :index }
# let's protect voter credentials
format.json { render json: [], status: :unauthorized }
end
end
# GET /rooms/:room_id/votes/bulk
def bulk

View File

@ -0,0 +1,29 @@
<p id="notice"><%= notice %></p>
<h1>Votes: <%= @room.name %></h1>
<table>
<thead>
<tr>
<th>ID</th>
<th>User ID</th>
<th>Election Slug</th>
<th>Login ID</th>
</tr>
</thead>
<tbody>
<% @votes.each do |vote| %>
<tr>
<td><%= vote.id %></td>
<td><%= vote.user_id %></td>
<td><%= vote.election_slug %></td>
<td><%= vote.voter_login_id %></td>
</tr>
<% end %>
</tbody>
</table>
<br>
<%= link_to 'Back', room_path(@room) %>