Display vote name even when unauthenticated
For example, when sharing the link in messaging apps.
This commit is contained in:
parent
33bc3e1446
commit
45c8e9b6b4
3 changed files with 33 additions and 11 deletions
5
vedia.rb
5
vedia.rb
|
|
@ -317,10 +317,12 @@ post '/votes/new' do
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/votes/:id' do
|
get '/votes/:id' do
|
||||||
require_login
|
|
||||||
find_vote
|
find_vote
|
||||||
if not @vote
|
if not @vote
|
||||||
erb :votes_show_unknown
|
erb :votes_show_unknown
|
||||||
|
else
|
||||||
|
if not current_user
|
||||||
|
erb :votes_show_unauthenticated
|
||||||
else
|
else
|
||||||
case @vote.state
|
case @vote.state
|
||||||
when 'draft'
|
when 'draft'
|
||||||
|
|
@ -335,6 +337,7 @@ get '/votes/:id' do
|
||||||
erb :votes_show_closed
|
erb :votes_show_closed
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get '/votes/:id/edit' do
|
get '/votes/:id/edit' do
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@
|
||||||
<div class="d-flex flex-wrap justify-content-end pe-3 py-3 mb-4">
|
<div class="d-flex flex-wrap justify-content-end pe-3 py-3 mb-4">
|
||||||
<% if current_user %>
|
<% if current_user %>
|
||||||
<%= current_user.email %>
|
<%= current_user.email %>
|
||||||
|
<% else %>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
17
views/votes_show_unauthenticated.erb
Normal file
17
views/votes_show_unauthenticated.erb
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
<div class="mb-5">
|
||||||
|
<h1><%= @vote.title %></h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<p class="alert alert-warning mb-4"><%= _("You need to log in to see the details of this vote.") %></p>
|
||||||
|
|
||||||
|
<form action="/login" method="post" class="mb-5">
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="email" class="form-label"><%= _("Email") %></label>
|
||||||
|
<input type="text" name="email" class="form-control">
|
||||||
|
</div>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="password" class="form-label"><%= _("Password") %></label>
|
||||||
|
<input type="password" name="password" class="form-control">
|
||||||
|
</div>
|
||||||
|
<button type="submit" class="btn btn-primary"><%= _("Login") %></button>
|
||||||
|
</form>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue