Use Bootstrap badge
This commit is contained in:
parent
d87d191cc9
commit
134ebec01f
5 changed files with 11 additions and 36 deletions
12
vedia.rb
12
vedia.rb
|
|
@ -76,9 +76,7 @@ enable :sessions
|
|||
MajorityJudgment.values = settings.values
|
||||
|
||||
get '/' do
|
||||
require_login
|
||||
@votes = Vote.all
|
||||
erb :home
|
||||
redirect '/votes'
|
||||
end
|
||||
|
||||
get '/style.css' do
|
||||
|
|
@ -266,12 +264,18 @@ post '/admin/votes/:id/delete' do
|
|||
redirect '/admin'
|
||||
end
|
||||
|
||||
get '/votes' do
|
||||
require_login
|
||||
@votes = Vote.all
|
||||
erb :votes
|
||||
end
|
||||
|
||||
get '/votes/new' do
|
||||
require_login
|
||||
erb :votes_new
|
||||
end
|
||||
|
||||
post '/votes' do
|
||||
post '/votes/new' do
|
||||
require_login
|
||||
@vote = Vote.create(secure_id: SecureRandom.hex(8),
|
||||
title: params[:title],
|
||||
|
|
|
|||
|
|
@ -1,29 +0,0 @@
|
|||
<h1><%= _("Home") %></h1>
|
||||
|
||||
<h2><%= _("Votes") %></h2>
|
||||
|
||||
<ul>
|
||||
<% @votes.reverse.each do |vote| %>
|
||||
<li>
|
||||
<a href="/votes/<%= vote.secure_id %>"><%= vote.title %></a>
|
||||
<% case vote.state
|
||||
when 'draft' %>
|
||||
<% if vote.users.exists?(current_user.id) %><%= _("(Draft, organized by you)") %>
|
||||
<% else %><%= _("(Draft)") %>
|
||||
<% end %>
|
||||
<% when 'open' %>
|
||||
<% if vote.users.exists?(current_user.id) %><%= _("(Open, organized by you)") %>
|
||||
<% else %><%= _("(Open)") %>
|
||||
<% end %>
|
||||
<% when 'closed' %>
|
||||
<% if vote.users.exists?(current_user.id) %><%= _("(Closed, organized by you)") %>
|
||||
<% else %><%= _("(Closed)") %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<form action="/votes/new" method="get">
|
||||
<button type="submit"><%= _("Create new vote") %></button>
|
||||
</form>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
</a>
|
||||
<ul class="nav nav-pills">
|
||||
<li class="nav-item">
|
||||
<a href="/" class="nav-link"><%= _("Inici") %></a>
|
||||
<a href="/votes" class="nav-link"><%= _("Votes") %></a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<% if is_admin %>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<h1><%= @vote.title %></h1>
|
||||
|
||||
<p>Draft</p>
|
||||
<p><span class="badge bg-primary">Draft</span></p>
|
||||
|
||||
<%= markdown(@vote.description) %>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<h1><%= _("New vote") %></h1>
|
||||
|
||||
<form action="/votes" method="post">
|
||||
<form action="/votes/new" method="post">
|
||||
<p>
|
||||
<label for="title"><%= _("Title") %></label>
|
||||
<input type="text" name="title">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue