Rewrite views with Bootstrap
This commit is contained in:
parent
529f7118b1
commit
5a278fcddf
19 changed files with 424 additions and 279 deletions
|
|
@ -1,8 +1,8 @@
|
||||||
<h1><%= _("Admin") %></h1>
|
<h1 class="mb-5"><%= _("Admin") %></h1>
|
||||||
|
|
||||||
<h2><%= _("Users") %></h2>
|
<h2 class="mb-4"><%= _("Users") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul class="mb-5">
|
||||||
<% @users.reverse.each do |user| %>
|
<% @users.reverse.each do |user| %>
|
||||||
<li>
|
<li>
|
||||||
<a href="/admin/users/<%= user.id %>"><%= user.email %></a>
|
<a href="/admin/users/<%= user.id %>"><%= user.email %></a>
|
||||||
|
|
@ -10,20 +10,31 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2><%= _("Votes") %></h2>
|
<h2 class="mb-4"><%= _("Votes") %></h2>
|
||||||
|
|
||||||
<ul>
|
<table class="table table-striped mb-5">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td></td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
<% @votes.reverse.each do |vote| %>
|
<% @votes.reverse.each do |vote| %>
|
||||||
<li>
|
<tr>
|
||||||
<a href="/admin/votes/<%= vote.id %>"><%= vote.title %></a>
|
<td><%= format_date(vote.created_at) %></td>
|
||||||
|
<td class="text-nowrap">
|
||||||
<% case vote.state
|
<% case vote.state
|
||||||
when 'draft' %>
|
when 'draft' %>
|
||||||
<%= _("(Draft)") %>
|
<span class="badge bg-secondary"><%= _("Draft") %></span>
|
||||||
<% when 'open' %>
|
<% when 'open' %>
|
||||||
<%= _("(Open)") %>
|
<span class="badge bg-primary"><%= _("Open") %></span>
|
||||||
<% when 'closed' %>
|
<% when 'closed' %>
|
||||||
<%= _("(Closed)") %>
|
<SPAN class="badge bg-dark"><%= _("Closed") %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</td>
|
||||||
|
<td><a href="/admin/votes/<%= vote.id %>"><%= vote.title %></a></td>
|
||||||
|
</tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
<h1><%= _("Admin") %></h1>
|
<h1 class="mb-5"><%= _("Admin") %></h1>
|
||||||
|
|
||||||
<h2><%= @user.email %></h2>
|
<h2 class="mb-4"><%= @user.email %></h2>
|
||||||
|
|
||||||
<p><%= _("Created: %{date}") % { date: format_date(@user.created_at) } %></p>
|
<p><%= _("Created: %{date}") % { date: format_date(@user.created_at) } %></p>
|
||||||
|
|
||||||
<p><%= _("Updated: %{date}") % { date: format_date(@user.updated_at) } %></p>
|
<p><%= _("Updated: %{date}") % { date: format_date(@user.updated_at) } %></p>
|
||||||
|
|
||||||
<p><%= _("Admin: %{admin}") % { admin: @user.admin ? _("Yes") : _("No") } %></p>
|
<p class="mb-5"><%= _("Admin: %{admin}") % { admin: @user.admin ? _("Yes") : _("No") } %></p>
|
||||||
|
|
||||||
<h2><%= _("Organized votes") %></h2>
|
<h2 class="mb-4"><%= _("Organized votes") %></h2>
|
||||||
|
|
||||||
<% unless @user.organizers.blank? %>
|
<% unless @user.organizers.blank? %>
|
||||||
|
|
||||||
<ul>
|
<ul class="mb-5">
|
||||||
<% @user.organizers.each do |organizer| %>
|
<% @user.organizers.each do |organizer| %>
|
||||||
<li>
|
<li>
|
||||||
<%= organizer.user.email %>
|
<%= organizer.user.email %>
|
||||||
|
|
@ -23,15 +23,15 @@
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<p><%= _("No vote organized.") %></p>
|
<p class="mb-5"><%= _("No vote organized.") %></p>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<h2><%= _("Ratings") %></h2>
|
<h2 class="mb-4"><%= _("Ratings") %></h2>
|
||||||
|
|
||||||
<% unless @user.ratings.blank? %>
|
<% unless @user.ratings.blank? %>
|
||||||
|
|
||||||
<ul>
|
<ul class="mb-5">
|
||||||
<% @user.ratings.collect { |rating| rating.vote }.uniq.each do |vote| %>
|
<% @user.ratings.collect { |rating| rating.vote }.uniq.each do |vote| %>
|
||||||
<li>
|
<li>
|
||||||
<%= vote.title %>
|
<%= vote.title %>
|
||||||
|
|
@ -42,14 +42,14 @@
|
||||||
|
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
||||||
<p><%= _("No rating.") %></p>
|
<p class="mb-5"><%= _("No rating.") %></p>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @user.ratings.blank? and @user.organizers.blank? %>
|
<% if @user.ratings.blank? and @user.organizers.blank? %>
|
||||||
|
|
||||||
<form action="/admin/users/<%= @user.id %>/delete" method="post">
|
<form action="/admin/users/<%= @user.id %>/delete" method="post">
|
||||||
<button type="submit"><%= _("Delete user") %></button>
|
<button type="submit" class="btn btn-outline-danger"><%= _("Delete user") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<h1><%= _("Admin") %></h1>
|
<h1 class="mb-5"><%= _("Admin") %></h1>
|
||||||
|
|
||||||
<h2><%= @vote.title %></h2>
|
<h2 class="mb-4"><%= @vote.title %></h2>
|
||||||
|
|
||||||
<p><a href="/votes/<%= @vote.secure_id %>"><%= _("View vote") %></a></p>
|
<p><a href="/votes/<%= @vote.secure_id %>"><%= _("View vote") %></a></p>
|
||||||
|
|
||||||
|
|
@ -14,13 +14,13 @@
|
||||||
|
|
||||||
<p><%= _("Closing date: %{date}") % { date: @vote.expire_on ? format_date_and_time(@vote.expire_on) : _("None") } %></p>
|
<p><%= _("Closing date: %{date}") % { date: @vote.expire_on ? format_date_and_time(@vote.expire_on) : _("None") } %></p>
|
||||||
|
|
||||||
<p><%= _("State: %{state}") % { state: @vote.state } %></p>
|
<p class="mb-5"><%= _("State: %{state}") % { state: @vote.state } %></p>
|
||||||
|
|
||||||
<h2><%= _("Organizers") %></h2>
|
<h2 class="mb-4"><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<% unless @vote.organizers.blank? %>
|
<% unless @vote.organizers.blank? %>
|
||||||
|
|
||||||
<ul>
|
<ul class="mb-5">
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
<li>
|
<li>
|
||||||
<%= organizer.user.email %>
|
<%= organizer.user.email %>
|
||||||
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<h2><%= _("Ratings") %></h2>
|
<h2 class="mb-4"><%= _("Ratings") %></h2>
|
||||||
|
|
||||||
<% unless @vote.ratings.blank? %>
|
<% unless @vote.ratings.blank? %>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container py-4">
|
||||||
|
|
||||||
<header class="d-flex flex-wrap justify-content-center py-3 border-bottom">
|
<header class="d-flex flex-wrap justify-content-center py-3 border-bottom">
|
||||||
<a href="/" class="d-flex align-items-center pe-5 mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none">
|
<a href="/" class="d-flex align-items-center pe-5 mb-3 mb-md-0 me-md-auto link-body-emphasis text-decoration-none">
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
<h1><%= _("Login") %></h1>
|
<h1 class="mb-5"><%= _("Login") %></h1>
|
||||||
|
|
||||||
<% if @error %>
|
<% if @error %>
|
||||||
<p class="error"><%= @error %></p>
|
<p class="alert alert-warning mb-4"><%= @error %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<form action="/login" method="post">
|
<form action="/login" method="post" class="mb-5">
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="email"><%= _("Email") %></label>
|
<label for="email" class="form-label"><%= _("Email") %></label>
|
||||||
<input type="text" name="email">
|
<input type="text" name="email" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="password"><%= _("Password") %></label>
|
<label for="password" class="form-label"><%= _("Password") %></label>
|
||||||
<input type="password" name="password">
|
<input type="password" name="password" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<button type="submit"><%= _("Login") %></button>
|
<button type="submit" class="btn btn-primary"><%= _("Login") %></button>
|
||||||
</form>
|
</form>
|
||||||
<p><a href="/signup"><%= _("Create account") %></a></p>
|
<p><a href="/signup"><%= _("Create account") %></a></p>
|
||||||
<p><a href="/reset"><%= _("Reset password") %></a></p>
|
<p><a href="/reset"><%= _("Reset password") %></a></p>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<h1><%= _("Reset password") %></h1>
|
<h1 class="mb-5"><%= _("Reset password") %></h1>
|
||||||
|
|
||||||
<form action="/reset" method="post">
|
<form action="/reset" method="post">
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="email"><%= _("Email") %></label>
|
<label for="email" class="form-label"><%= _("Email") %></label>
|
||||||
<input type="text" name="email">
|
<input type="text" name="email" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<button type="submit"><%= _("Reset password") %></button>
|
<button type="submit" class="btn btn-primary"><%= _("Reset password") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,21 @@
|
||||||
<h1><%= _("Reset password") %></h1>
|
<h1 class="mb-5"><%= _("Reset password") %></h1>
|
||||||
|
|
||||||
<% if @errors %>
|
<% if @errors %>
|
||||||
<% @errors.each do |error| %>
|
<% @errors.each do |error| %>
|
||||||
<% if error.attribute == :password and error.type == :blank %>
|
<% if error.attribute == :password and error.type == :blank %>
|
||||||
<p class="error"><%= _("Specify a password.") %></p>
|
<p class="alert alert-warning mb-4"><%= _("Specify a password.") %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<form action="/reset/<%= params[:uuid] %>" method="post">
|
<form action="/reset/<%= params[:uuid] %>" method="post">
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="email"><%= _("Email") %></label>
|
<label for="email" class="form-label"><%= _("Email") %></label>
|
||||||
<span><%= @user.email %></span>
|
<p><strong><%= @user.email %></strong></p>
|
||||||
</p>
|
</div>
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="password"><%= _("Password") %></label>
|
<label for="password" class="form-label"><%= _("Password") %></label>
|
||||||
<input type="password" name="password" value="<%= params[:password] %>">
|
<input type="password" name="password" value="<%= params[:password] %>" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<button type="submit"><%= _("Reset password") %></button>
|
<button type="submit" class="btn btn-primary"><%= _("Reset password") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<h1><%= _("Reset password") %></h1>
|
<h1 class="mb-5"><%= _("Reset password") %></h1>
|
||||||
|
|
||||||
<p class="error"><%= _("This password reset link has expired or is invalid.") %></p>
|
<p class="alert alert-warning mb-4"><%= _("This password reset link has expired or is invalid.") %></p>
|
||||||
|
|
||||||
<p><a href="/reset"><%= _("Try resetting your password again.") %></p>
|
<p><a href="/reset"><%= _("Try resetting your password again.") %></p>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
<h1><%= _("Reset password") %></h1>
|
<h1 class="mb-5"><%= _("Reset password") %></h1>
|
||||||
|
|
||||||
<p><%= _("If an account exists for %{email}, you will get an email with a link
|
<p><%= _("If an account exists for %{email}, you will get an email with a link
|
||||||
to reset your password.") % { email: params[:email] } %></p>
|
to reset your password.") % { email: params[:email] } %></p>
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
<h1><%= _("Create account") %></h1>
|
<h1 class="mb-5"><%= _("Create account") %></h1>
|
||||||
|
|
||||||
<% if @errors %>
|
<% if @errors %>
|
||||||
<% @errors.each do |error| %>
|
<% @errors.each do |error| %>
|
||||||
<% if error.attribute == :password and error.type == :blank %>
|
<% if error.attribute == :password and error.type == :blank %>
|
||||||
<p class="error"><%= _("Specify a password.") %></p>
|
<p class="alert alert-warning mb-4"><%= _("Specify a password.") %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
@ -11,22 +11,22 @@
|
||||||
<% if @user and @user.errors.any? %>
|
<% if @user and @user.errors.any? %>
|
||||||
<% @user.errors.each do |error| %>
|
<% @user.errors.each do |error| %>
|
||||||
<% if error.attribute == :email and error.type == :invalid %>
|
<% if error.attribute == :email and error.type == :invalid %>
|
||||||
<p class="error"><%= _("Email is not a valid email address.") %></p>
|
<div class="alert alert-warning mb-4"><%= _("Email is not a valid email address.") %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if error.attribute == :email and error.type == :taken %>
|
<% if error.attribute == :email and error.type == :taken %>
|
||||||
<p class="error"><%= _("An account already exists for %{email}.") % { email: @user.email } %></p>
|
<div class="alert alert-warning mb-4"><%= _("An account already exists for %{email}.") % { email: @user.email } %></div>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<form action="/signup" method="post">
|
<form action="/signup" method="post">
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="email"><%= _("Email") %></label>
|
<label for="email" class="form-label"><%= _("Email") %></label>
|
||||||
<input type="text" name="email" value="<%= params[:email] %>">
|
<input type="text" name="email" value="<%= params[:email] %>" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="password"><%= _("Password") %></label>
|
<label for="password" class="form-label"><%= _("Password") %></label>
|
||||||
<input type="password" name="password" value="<%= params[:password] %>">
|
<input type="password" name="password" value="<%= params[:password] %>" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<button type="submit"><%= _("Create account") %></button>
|
<button type="submit" class="btn btn-primary"><%= _("Create account") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,20 @@
|
||||||
.error {
|
|
||||||
color: red;
|
|
||||||
}
|
|
||||||
|
|
||||||
p, li {
|
|
||||||
max-width: 50em;
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea {
|
|
||||||
width: 80em;
|
|
||||||
height: 20em;
|
|
||||||
}
|
|
||||||
|
|
||||||
<% settings.values.each do |v| %>
|
<% settings.values.each do |v| %>
|
||||||
.value-<%= v[:id] %> {
|
|
||||||
|
.btn-check + .btn-radio-<%= v[:id] %> {
|
||||||
|
border-color: <%= v[:color] %>;
|
||||||
background: <%= v[:color] %>;
|
background: <%= v[:color] %>;
|
||||||
|
opacity: 0.3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-check:checked + .btn-radio-<%= v[:id] %>,
|
||||||
|
.btn-check:hover + .btn-radio-<%= v[:id] %> {
|
||||||
|
background: <%= v[:color] %>;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bg-<%= v[:id] %> {
|
||||||
|
color: black;
|
||||||
|
background-color: <%= v[:color] %>;
|
||||||
|
}
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
29
views/votes.erb
Normal file
29
views/votes.erb
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
<h1 class="mb-5"><%= _("Votes") %></h1>
|
||||||
|
|
||||||
|
<table class="table table-striped mb-5">
|
||||||
|
<tbody>
|
||||||
|
<% @votes.reverse.each do |vote| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= format_date(vote.created_at) %></td>
|
||||||
|
<td class="text-nowrap">
|
||||||
|
<% case vote.state
|
||||||
|
when 'draft' %>
|
||||||
|
<span class="badge bg-secondary"><%= _("Draft") %></span>
|
||||||
|
<% when 'open' %>
|
||||||
|
<span class="badge bg-primary"><%= _("Open") %></span>
|
||||||
|
<% when 'closed' %>
|
||||||
|
<SPAN class="badge bg-dark"><%= _("Closed") %></span>
|
||||||
|
<% end %>
|
||||||
|
<% if vote.users.exists?(current_user.id) %>
|
||||||
|
<span class="badge bg-warning text-bg-warning"><%= _("Organizer") %></span>
|
||||||
|
<% end %>
|
||||||
|
</td>
|
||||||
|
<td><a href="/votes/<%= vote.secure_id %>"><%= vote.title %></a></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<form action="/votes/new" method="get">
|
||||||
|
<button type="submit" class="btn btn-primary"><%= _("Create new vote") %></button>
|
||||||
|
</form>
|
||||||
|
|
@ -1,38 +1,76 @@
|
||||||
|
<div class="mb-5">
|
||||||
<h1><%= @vote.title %></h1>
|
<h1><%= @vote.title %></h1>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li>
|
||||||
|
<span class="badge bg-secondary"><%= _("Draft") %></span>
|
||||||
|
<span class="badge bg-warning text-bg-warning"><%= _("Organizer") %></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p><span class="badge bg-primary">Draft</span></p>
|
<div class="mb-5">
|
||||||
|
<div class="lead">
|
||||||
<%= markdown(@vote.description) %>
|
<%= markdown(@vote.description) %>
|
||||||
|
</div>
|
||||||
<form action="/votes/<%= @vote.secure_id %>/edit" method="get">
|
<form action="/votes/<%= @vote.secure_id %>/edit" method="get" class="mb-5">
|
||||||
<button type="submit"><%= _("Edit") %></button>
|
<button type="submit" class="btn btn-outline-primary"><%= _("Edit") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2><%= _("Candidates") %></h2>
|
<h2 class="mb-4"><%= _("Candidates") %></h2>
|
||||||
|
|
||||||
<% @vote.candidates.each do |candidate| %>
|
<% @vote.candidates.each do |candidate| %>
|
||||||
<h3><%= candidate.name %></h3>
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="mb-3"><%= candidate.name %></h3>
|
||||||
<%= markdown(candidate.description) %>
|
<%= markdown(candidate.description) %>
|
||||||
<form action="/votes/<%= @vote.secure_id %>/candidates/<%= candidate.id %>/delete" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/candidates/<%= candidate.id %>/delete" method="post">
|
||||||
<button type="submit"><%= _("Delete") %></button>
|
<button type="submit" class="btn btn-outline-danger"><%= _("Delete") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<h3><%= _("Add candidate") %></h3>
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="mb-3"><%= _("Add candidate") %></h3>
|
||||||
|
<% if @vote.candidates.empty? %>
|
||||||
|
<div class="alert alert-primary mb-4"><%= _("This vote has no candidates yet. Add a first candidate.") %></div>
|
||||||
|
<% end %>
|
||||||
<form action="/votes/<%= @vote.secure_id %>/candidates" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/candidates" method="post">
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="name"><%= _("Name") %></label>
|
<label for="name" class="form-label"><%= _("Name") %></label>
|
||||||
<input type="text" name="name">
|
<input type="text" name="name" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="description"><%= _("Description") %></label>
|
<label for="description" class="form-label"><%= _("Description") %></label>
|
||||||
<textarea type="text" name="description"></textarea>
|
<textarea type="text" name="description" class="form-control"></textarea>
|
||||||
</p>
|
</div>
|
||||||
<button type="submit"><%= _("Add candidate") %></button>
|
<% if @vote.candidates.length < 2 %>
|
||||||
|
<button type="submit" class="btn btn-primary"><%= _("Add candidate") %></button>
|
||||||
|
<% else %>
|
||||||
|
<button type="submit" class="btn btn-outline-primary"><%= _("Add candidate") %></button>
|
||||||
|
<% end %>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<form action="/votes/<%= @vote.secure_id %>/open" method="get" class="mb-3">
|
||||||
|
<% if @vote.candidates.length < 2 %>
|
||||||
|
<p class="alert alert-warning mb-4"><%= _("Add at least 2 candidates before opening the vote to participants.") %></p>
|
||||||
|
<fieldset disabled="">
|
||||||
|
<% end %>
|
||||||
|
<button type="submit" class="btn btn-primary"><%= _("Open vote to participants") %></button>
|
||||||
|
<% if @vote.candidates.length < 2 %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2><%= _("Organizers") %></h2>
|
<form action="/votes/<%= @vote.secure_id %>/delete" method="post" class="mb-5">
|
||||||
|
<button type="submit" class="btn btn-outline-danger"><%= _("Delete vote") %></button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<h2 class="mb-4"><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
|
|
@ -40,26 +78,12 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3><%= _("Add organizer") %></h3>
|
<h3 class="mb-3"><%= _("Add organizer") %></h3>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post" class="mb-5">
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="email"><%= _("Email") %></label>
|
<label for="email" class="form-label"><%= _("Email") %></label>
|
||||||
<input type="text" name="email">
|
<input type="text" name="email" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<button type="submit"><%= _("Add organizer") %></button>
|
<button type="submit" class="btn btn-outline-primary"><%= _("Add organizer") %></button>
|
||||||
</form>
|
|
||||||
|
|
||||||
<h3><%= _("Actions for organizers") %></h2>
|
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/open" method="get">
|
|
||||||
<% if @vote.candidates.length < 2 %>
|
|
||||||
<button type="submit" disabled><%= _("Open vote to participants") %></button>
|
|
||||||
<p><%= _("Add at least 2 candidates before opening the vote to participants.") %></p>
|
|
||||||
<% else %>
|
|
||||||
<button type="submit"><%= _("Open vote to participants") %></button>
|
|
||||||
<% end %>
|
|
||||||
</form>
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/delete" method="post">
|
|
||||||
<button type="submit"><%= _("Delete vote") %></button>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<h1><%= _("Edit vote description") %></h1>
|
<h1 class="mb-5"><%= _("Edit vote description") %></h1>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/edit" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/edit" method="post">
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="title"><%= _("Title") %></label>
|
<label for="title" class="form-label"><%= _("Title") %></label>
|
||||||
<input type="text" name="title" value="<%= @vote.title %>">
|
<input type="text" name="title" value="<%= @vote.title %>" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="description"><%= _("Description") %></label>
|
<label for="description" class="form-label"><%= _("Description") %></label>
|
||||||
<textarea type="text" name="description"><%= @vote.description %></textarea>
|
<textarea type="text" name="description" class="form-control"><%= @vote.description %></textarea>
|
||||||
</p>
|
</div>
|
||||||
<button type="submit"><%= _("Save") %></button>
|
<button type="submit" class="btn btn-primary"><%= _("Save") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<h1><%= _("New vote") %></h1>
|
<h1 class="mb-5"><%= _("New vote") %></h1>
|
||||||
|
|
||||||
<form action="/votes/new" method="post">
|
<form action="/votes/new" method="post">
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="title"><%= _("Title") %></label>
|
<label for="title" class="form-label"><%= _("Title") %></label>
|
||||||
<input type="text" name="title">
|
<input type="text" name="title" class="form-control">
|
||||||
</p>
|
</div>
|
||||||
<p>
|
<div class="mb-3">
|
||||||
<label for="description"><%= _("Description") %></label>
|
<label for="description" class="form-label"><%= _("Description") %></label>
|
||||||
<textarea type="text" name="description"></textarea>
|
<textarea type="text" name="description" class="form-control"></textarea>
|
||||||
</p>
|
</div>
|
||||||
<button type="submit"><%= _("Create new vote") %></button>
|
<button type="submit" class="btn btn-primary"><%= _("Create new vote") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
<h1><%= _("Open vote") %></h1>
|
<div class="mb-5">
|
||||||
|
<h1><%= @vote.title %></h1>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li>
|
||||||
|
<span class="badge bg-secondary"><%= _("Draft") %></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
<p><%= _("Closing date: %{date}") % { date: format_date_and_time(@expire_on) } %></p>
|
<div class="alert alert-warning mb-5">
|
||||||
|
|
||||||
|
<p><strong><%= _("Closing date: %{date}") % { date: format_date_and_time(@expire_on) } %></strong></p>
|
||||||
|
|
||||||
<p><%= _("The vote will automatically close on that date and the results will
|
<p><%= _("The vote will automatically close on that date and the results will
|
||||||
be sent to all users by email.") %></p>
|
be sent to all users by email.") %></p>
|
||||||
|
|
@ -8,21 +17,29 @@ be sent to all users by email.") %></p>
|
||||||
<p><%= _("You won't be able to modify or delete this vote anymore after
|
<p><%= _("You won't be able to modify or delete this vote anymore after
|
||||||
opening it.") %></p>
|
opening it.") %></p>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/open" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/open" method="post" class="mb-3">
|
||||||
<button type="submit"><%= _("Open vote to participants") %></button>
|
<button type="submit" class="btn btn-primary"><%= _("Open vote to participants") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>" method="get">
|
<form action="/votes/<%= @vote.secure_id %>" method="get">
|
||||||
<button type="submit"><%= _("Cancel") %></button>
|
<button type="submit" class="btn btn-outline-secondary"><%= _("Cancel") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2><%= @vote.title %></h2>
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="lead">
|
||||||
<%= markdown(@vote.description) %>
|
<%= markdown(@vote.description) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2><%= _("Candidates") %></h2>
|
<h2 class="mb-4"><%= _("Candidates") %></h2>
|
||||||
|
|
||||||
<% @vote.candidates.each do |candidate| %>
|
<% @vote.candidates.each do |candidate| %>
|
||||||
<h3><%= candidate.name %></h3>
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="mb-3"><%= candidate.name %></h3>
|
||||||
<%= markdown(candidate.description) %>
|
<%= markdown(candidate.description) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,38 +1,46 @@
|
||||||
|
<div class="mb-5">
|
||||||
<h1><%= @vote.title %></h1>
|
<h1><%= @vote.title %></h1>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li>
|
||||||
|
<span class="badge bg-dark text-bg-dark"><%= _("Closed") %></span>
|
||||||
|
<% if @vote.users.exists?(current_user.id) %>
|
||||||
|
<span class="badge bg-warning text-bg-warning"><%= _("Organizer") %></span>
|
||||||
|
<% end %>
|
||||||
|
</li>
|
||||||
<% if @vote.expire_on %>
|
<% if @vote.expire_on %>
|
||||||
<p><%= _("Closing date: %{date}") % { date: format_date_and_time(@vote.expire_on) } %></p>
|
<li><%= _("Closed on %{date}") % { date: format_date_and_time(@vote.expire_on) } %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="lead">
|
||||||
<%= markdown(@vote.description) %>
|
<%= markdown(@vote.description) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<% unless @vote.ratings.blank? %>
|
<h2 class="mb-4"><%= _("Options") %></h2>
|
||||||
|
|
||||||
<h2><%= _("All ratings") %></h2>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th><%= _("Participant") %></th>
|
|
||||||
<% @vote.candidates.each do |candidate| %>
|
<% @vote.candidates.each do |candidate| %>
|
||||||
<th><%= candidate.name %></th>
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="mb-3"><%= candidate.name %></h3>
|
||||||
|
<%= markdown(candidate.description) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
|
||||||
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
|
|
||||||
<tr>
|
|
||||||
<td><%= user.email %></td>
|
|
||||||
<% @vote.candidates.each do |candidate| %>
|
|
||||||
<% if rating = @vote.ratings.find { |rating| rating.user == user and rating.candidate == candidate } %>
|
|
||||||
<% value = settings.values.select { |e| e[:id] == rating.value }.first %>
|
|
||||||
<td class="value-<%= value[:id] %>"><%= _(value[:label]) %></td>
|
|
||||||
<% end %>
|
|
||||||
<% end %>
|
|
||||||
</tr>
|
|
||||||
<% end %>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h2><%= _("Results") %></h2>
|
<div class="mb-5"></div>
|
||||||
|
|
||||||
<table>
|
<h2 class="mb-4"><%= _("Results") %></h2>
|
||||||
|
|
||||||
|
<% if @vote.ratings.blank? %>
|
||||||
|
|
||||||
|
<%= _("No results are available because nobody voted on this vote.") %>
|
||||||
|
|
||||||
|
<% else %>
|
||||||
|
|
||||||
|
<table class="table mb-4">
|
||||||
<tr>
|
<tr>
|
||||||
<th><%= _("Rank") %></th>
|
<th><%= _("Rank") %></th>
|
||||||
<th><%= _("Candidate") %></th>
|
<th><%= _("Candidate") %></th>
|
||||||
|
|
@ -47,7 +55,7 @@
|
||||||
<td><%= i %></td>
|
<td><%= i %></td>
|
||||||
<td><%= candidate.name %></td>
|
<td><%= candidate.name %></td>
|
||||||
<% value = settings.values.select { |e| e[:id] == candidate.mj.mj }.first %>
|
<% value = settings.values.select { |e| e[:id] == candidate.mj.mj }.first %>
|
||||||
<td class="value-<%= value[:id] %>"><%= _(value[:label]) %></td>
|
<td class="h5"><span class="badge bg-<%= value[:id] %>"><%= _(value[:label]) %></span></td>
|
||||||
<td><%= candidate.mj.proponents %></td>
|
<td><%= candidate.mj.proponents %></td>
|
||||||
<td><%= candidate.mj.opponents %></td>
|
<td><%= candidate.mj.opponents %></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
@ -68,15 +76,43 @@ end
|
||||||
%>
|
%>
|
||||||
<%= bar_chart data, colors: colors, stacked: true, legend: 'bottom' %>
|
<%= bar_chart data, colors: colors, stacked: true, legend: 'bottom' %>
|
||||||
|
|
||||||
<% else %>
|
<div class="mb-5"></div>
|
||||||
|
|
||||||
<h2><%= _("Results") %></h2>
|
<h2 class="mb-4"><%= _("Ratings") %></h2>
|
||||||
|
|
||||||
<%= _("No results are available because nobody voted on this vote.") %>
|
<table class="table table-striped mb-5">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th><%= _("Participant") %></th>
|
||||||
|
<% @vote.candidates.each do |candidate| %>
|
||||||
|
<th><%= candidate.name %></th>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
|
||||||
|
<tr>
|
||||||
|
<td><%= user.email %></td>
|
||||||
|
<% @vote.candidates.each do |candidate| %>
|
||||||
|
<% if rating = @vote.ratings.find { |rating| rating.user == user and rating.candidate == candidate } %>
|
||||||
|
<% value = settings.values.select { |e| e[:id] == rating.value }.first %>
|
||||||
|
<td class="h5"><span class="badge bg-<%= value[:id] %>"><%= _(value[:label]) %></td>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</table>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<h2><%= _("Organizers") %></h2>
|
<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
|
||||||
|
|
||||||
|
<form action="/votes/<%= @vote.secure_id %>/reopen" method="post" class="mb-5">
|
||||||
|
<button type="submit" class="btn btn-outline-primary"><%= _("Reopen voting period") %></button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<h2 class="mb-4"><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
|
|
@ -86,20 +122,14 @@ end
|
||||||
|
|
||||||
<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
|
<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
|
||||||
|
|
||||||
<h3><%= _("Actions for organizers") %></h3>
|
<h3 class="mb-3"><%= _("Add organizer") %></h3>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/reopen" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post" class="mb-5">
|
||||||
<button type="submit"><%= _("Reopen voting period") %></button>
|
<div class="mb-3">
|
||||||
</form>
|
<label for="email" class="form-label"><%= _("Email") %></label>
|
||||||
|
<input type="text" name="email" class="form-control">
|
||||||
<h3><%= _("Add organizer") %></h3>
|
</div>
|
||||||
|
<button type="submit" class="btn btn-outline-primary"><%= _("Add organizer") %></button>
|
||||||
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post">
|
|
||||||
<p>
|
|
||||||
<label for="email"><%= _("Email") %></label>
|
|
||||||
<input type="text" name="email">
|
|
||||||
</p>
|
|
||||||
<button type="submit"><%= _("Add organizer") %></button>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,35 @@
|
||||||
<h1><%= @vote.title %> <%= _("(Draft)") %></h1>
|
<div class="mb-5">
|
||||||
|
<h1><%= @vote.title %></h1>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li>
|
||||||
|
<span class="badge bg-secondary"><%= _("Draft") %></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="lead">
|
||||||
<%= markdown(@vote.description) %>
|
<%= markdown(@vote.description) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<h2><%= _("Organizers") %></h2>
|
<h2 class="mb-4"><%= _("Candidates") %></h2>
|
||||||
|
|
||||||
|
<% @vote.candidates.each do |candidate| %>
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="mb-3"><%= candidate.name %></h3>
|
||||||
|
<%= markdown(candidate.description) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
<div class="mb-5"></div>
|
||||||
|
|
||||||
|
<h2 class="mb-4"><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
<li><%= organizer.user.email %></li>
|
<li><%= organizer.user.email %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2><%= _("Candidates") %></h2>
|
|
||||||
|
|
||||||
<% @vote.candidates.each do |candidate| %>
|
|
||||||
<h3><%= candidate.name %></h3>
|
|
||||||
<%= markdown(candidate.description) %>
|
|
||||||
<% end %>
|
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,38 @@
|
||||||
|
<div class="mb-5">
|
||||||
<h1><%= @vote.title %></h1>
|
<h1><%= @vote.title %></h1>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li>
|
||||||
|
<span class="badge bg-primary"><%= _("Open") %></span>
|
||||||
|
</li>
|
||||||
|
<% if @vote.expire_on %>
|
||||||
|
<li><%= _("Closes on %{date}") % { date: format_date_and_time(@vote.expire_on) } %></li>
|
||||||
|
<% end %>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-5">
|
||||||
|
<div class="lead">
|
||||||
|
<%= markdown(@vote.description) %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<h2 class="mb-4"><%= _("Options") %></h2>
|
||||||
|
|
||||||
<% if @errors %>
|
<% if @errors %>
|
||||||
<% @errors.each do |error| %>
|
<% @errors.each do |error| %>
|
||||||
<% if error.attribute == :rating and error.type == :blank %>
|
<% if error.attribute == :rating and error.type == :blank %>
|
||||||
<p class="error"><%= _("Missing rating for candidate <i>%{name}</i>.") % { name: error.candidate.name } %></p>
|
<p class="alert alert-warning mb-4"><%= _("Missing rating for candidate <i>%{name}</i>.") % { name: error.candidate.name } %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @vote.expire_on %>
|
<form action="/votes/<%= @vote.secure_id %>/ratings" method="post" class="mb-5">
|
||||||
<p><%= _("Closing date: %{date}") % { date: format_date_and_time(@vote.expire_on) } %></p>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<%= markdown(@vote.description) %>
|
|
||||||
|
|
||||||
<h2><%= _("Your ratings") %></h2>
|
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/ratings" method="post">
|
|
||||||
<ul>
|
|
||||||
<% @vote.candidates.each do |candidate| %>
|
<% @vote.candidates.each do |candidate| %>
|
||||||
|
<div class="card mb-4">
|
||||||
|
<div class="card-body">
|
||||||
|
<h3 class="mb-3"><%= candidate.name %></h3>
|
||||||
|
<%= markdown(candidate.description) %>
|
||||||
<% rating = @vote.ratings.find { |rating| rating.user == current_user and rating.candidate == candidate } %>
|
<% rating = @vote.ratings.find { |rating| rating.user == current_user and rating.candidate == candidate } %>
|
||||||
<% if rating
|
<% if rating
|
||||||
value = rating.value
|
value = rating.value
|
||||||
|
|
@ -27,31 +41,42 @@
|
||||||
else
|
else
|
||||||
value = 0
|
value = 0
|
||||||
end %>
|
end %>
|
||||||
<li>
|
<div class="btn-group">
|
||||||
<p><b><%= candidate.name %></b></p>
|
|
||||||
<%= markdown(candidate.description) %>
|
|
||||||
<ul>
|
|
||||||
<% settings.values.reverse.each do |v| %>
|
<% settings.values.reverse.each do |v| %>
|
||||||
<li><input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-<%= v[:id] %>" value="<%= v[:id] %>" <% if value == v[:id] %>checked<% end %>><label for="<%= candidate.id %>-<%= v[:id] %>" class="value-<%= v[:id] %>"><%= _(v[:label]) %></label></li>
|
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-<%= v[:id] %>" value="<%= v[:id] %>" class="btn-check" <% if value == v[:id] %>checked<% end %>>
|
||||||
|
<label for="<%= candidate.id %>-<%= v[:id] %>" class="btn btn-radio-<%= v[:id] %>"><%= _(v[:label]) %></label>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</div>
|
||||||
</li>
|
</div>
|
||||||
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
|
||||||
<button type="submit"><%= _("Save") %></button>
|
<button type="submit" class="btn btn-primary"><%= _("Vote") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2><%= _("Participants") %></h2>
|
<h2 class="mb-4"><%= _("Participants") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul class="mb-5">
|
||||||
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
|
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
|
||||||
<li><%= user.email %></li>
|
<li><%= user.email %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
|
||||||
|
|
||||||
|
<form action="/votes/<%= @vote.secure_id %>/draft" method="post">
|
||||||
|
<button type="submit" class="btn btn-outline-danger mb-3"><%= _("Change back to draft vote") %></button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<form action="/votes/<%= @vote.secure_id %>/close" method="post" class="mb-5">
|
||||||
|
<button type="submit" class="btn btn-outline-primary mb-3"><%= _("Close votes and show results") %></button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<% unless @vote.organizers.blank? %>
|
<% unless @vote.organizers.blank? %>
|
||||||
|
|
||||||
<h2><%= _("Organizers") %></h2>
|
<h2 class="mb-4"><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
|
|
@ -61,26 +86,16 @@
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
|
<% if @vote.users.exists?(current_user.id) or @vote.expire_on.nil? %>
|
||||||
|
|
||||||
<h3><%= _("Actions for organizers") %></h3>
|
<h3 class="mb-3"><%= _("Add organizer") %></h3>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/draft" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post" class="mb-5">
|
||||||
<button type="submit"><%= _("Change back to draft vote") %></button>
|
<div class="mb-3">
|
||||||
</form>
|
<label for="email" class="form-label"><%= _("Email") %></label>
|
||||||
|
<input type="text" name="email" class="form-control">
|
||||||
<form action="/votes/<%= @vote.secure_id %>/close" method="post">
|
</div>
|
||||||
<button type="submit"><%= _("Close votes and show results") %></button>
|
<button type="submit" class="btn btn-outline-primary"><%= _("Add organizer") %></button>
|
||||||
</form>
|
|
||||||
|
|
||||||
<h3><%= _("Add organizer") %></h3>
|
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/organizers" method="post">
|
|
||||||
<p>
|
|
||||||
<label for="email"><%= _("Email") %></label>
|
|
||||||
<input type="text" name="email">
|
|
||||||
</p>
|
|
||||||
<button type="submit"><%= _("Add organizer") %></button>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue