Require being an organizer to edit a draft vote
This commit is contained in:
parent
97d4df395d
commit
a2e41bdc2d
3 changed files with 25 additions and 1 deletions
|
|
@ -41,6 +41,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h3>Add organizer</h3>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post">
|
||||||
<p>
|
<p>
|
||||||
<label for="email">Email</label>
|
<label for="email">Email</label>
|
||||||
|
|
|
||||||
18
views/votes_show_draft.erb
Normal file
18
views/votes_show_draft.erb
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<h1><%= @vote.title %> (Draft)</h1>
|
||||||
|
|
||||||
|
<p><%= @vote.description %></p>
|
||||||
|
|
||||||
|
<h2>Organizers</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<% @vote.organizers.each do |organizer| %>
|
||||||
|
<li><%= organizer.user.email %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<h2>Candidates</h2>
|
||||||
|
|
||||||
|
<% @vote.candidates.each do |candidate| %>
|
||||||
|
<h3><%= candidate.name %></h3>
|
||||||
|
<p><%= candidate.description %></p>
|
||||||
|
<% end %>
|
||||||
4
vote.rb
4
vote.rb
|
|
@ -116,7 +116,11 @@ get '/votes/:id' do
|
||||||
when "open"
|
when "open"
|
||||||
erb :votes_show
|
erb :votes_show
|
||||||
when "draft"
|
when "draft"
|
||||||
|
if @vote.users.exists?(current_user.id)
|
||||||
erb :votes_edit
|
erb :votes_edit
|
||||||
|
else
|
||||||
|
erb :votes_show_draft
|
||||||
|
end
|
||||||
when "closed"
|
when "closed"
|
||||||
erb :votes_results
|
erb :votes_results
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue