+
diff --git a/views/login.erb b/views/login.erb
index dc71df6..5a5f40c 100644
--- a/views/login.erb
+++ b/views/login.erb
@@ -1,19 +1,19 @@
-<%= _("Login") %>
+<%= _("Login") %>
<% if @error %>
- <%= @error %>
+ <%= @error %>
<% end %>
-
<%= _("Create account") %>
<%= _("Reset password") %>
diff --git a/views/reset.erb b/views/reset.erb
index 4e9beb9..ae4bdc2 100644
--- a/views/reset.erb
+++ b/views/reset.erb
@@ -1,9 +1,9 @@
-<%= _("Reset password") %>
+<%= _("Reset password") %>
diff --git a/views/reset_change.erb b/views/reset_change.erb
index 36caf8d..a8854cf 100644
--- a/views/reset_change.erb
+++ b/views/reset_change.erb
@@ -1,21 +1,21 @@
-<%= _("Reset password") %>
+<%= _("Reset password") %>
<% if @errors %>
<% @errors.each do |error| %>
<% if error.attribute == :password and error.type == :blank %>
- <%= _("Specify a password.") %>
+ <%= _("Specify a password.") %>
<% end %>
<% end %>
<% end %>
diff --git a/views/reset_invalid.erb b/views/reset_invalid.erb
index 47255cd..19e5ede 100644
--- a/views/reset_invalid.erb
+++ b/views/reset_invalid.erb
@@ -1,5 +1,5 @@
-<%= _("Reset password") %>
+<%= _("Reset password") %>
-<%= _("This password reset link has expired or is invalid.") %>
+<%= _("This password reset link has expired or is invalid.") %>
<%= _("Try resetting your password again.") %>
diff --git a/views/reset_sent.erb b/views/reset_sent.erb
index 57ec828..a632f46 100644
--- a/views/reset_sent.erb
+++ b/views/reset_sent.erb
@@ -1,4 +1,4 @@
-<%= _("Reset password") %>
+<%= _("Reset password") %>
<%= _("If an account exists for %{email}, you will get an email with a link
to reset your password.") % { email: params[:email] } %>
diff --git a/views/signup.erb b/views/signup.erb
index 7eb7ff3..8c759ef 100644
--- a/views/signup.erb
+++ b/views/signup.erb
@@ -1,9 +1,9 @@
-<%= _("Create account") %>
+<%= _("Create account") %>
<% if @errors %>
<% @errors.each do |error| %>
<% if error.attribute == :password and error.type == :blank %>
- <%= _("Specify a password.") %>
+ <%= _("Specify a password.") %>
<% end %>
<% end %>
<% end %>
@@ -11,22 +11,22 @@
<% if @user and @user.errors.any? %>
<% @user.errors.each do |error| %>
<% if error.attribute == :email and error.type == :invalid %>
-
<%= _("Email is not a valid email address.") %>
+
<%= _("Email is not a valid email address.") %>
<% end %>
<% if error.attribute == :email and error.type == :taken %>
-
<%= _("An account already exists for %{email}.") % { email: @user.email } %>
+
<%= _("An account already exists for %{email}.") % { email: @user.email } %>
<% end %>
<% end %>
<% end %>
diff --git a/views/style.erb b/views/style.erb
index 8b07e38..32d5dec 100644
--- a/views/style.erb
+++ b/views/style.erb
@@ -1,18 +1,20 @@
-.error {
- color: red;
-}
-
-p, li {
- max-width: 50em;
-}
-
-textarea {
- width: 80em;
- height: 20em;
-}
-
<% settings.values.each do |v| %>
-.value-<%= v[:id] %> {
- background: <%= v[:color] %>;
-}
+
+ .btn-check + .btn-radio-<%= v[:id] %> {
+ border-color: <%= 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 %>
diff --git a/views/votes.erb b/views/votes.erb
new file mode 100644
index 0000000..fe1f7a7
--- /dev/null
+++ b/views/votes.erb
@@ -0,0 +1,29 @@
+
<%= _("Votes") %>
+
+
+
+ <% @votes.reverse.each do |vote| %>
+
+ <%= format_date(vote.created_at) %>
+
+ <% case vote.state
+ when 'draft' %>
+ <%= _("Draft") %>
+ <% when 'open' %>
+ <%= _("Open") %>
+ <% when 'closed' %>
+ <%= _("Closed") %>
+ <% end %>
+ <% if vote.users.exists?(current_user.id) %>
+ <%= _("Organizer") %>
+ <% end %>
+
+ <%= vote.title %>
+
+ <% end %>
+
+
+
+
diff --git a/views/votes_edit.erb b/views/votes_edit.erb
index b4ddc38..03073a5 100644
--- a/views/votes_edit.erb
+++ b/views/votes_edit.erb
@@ -1,38 +1,76 @@
-
<%= @vote.title %>
+
+
<%= @vote.title %>
+
+
+ <%= _("Draft") %>
+ <%= _("Organizer") %>
+
+
+
-
Draft
+
+
+ <%= markdown(@vote.description) %>
+
+
+
-<%= markdown(@vote.description) %>
-
-
-
-
<%= _("Candidates") %>
+
<%= _("Candidates") %>
<% @vote.candidates.each do |candidate| %>
-
<%= candidate.name %>
-<%= markdown(candidate.description) %>
-
+
+
+
<%= candidate.name %>
+ <%= markdown(candidate.description) %>
+
+
+
<% end %>
-
<%= _("Add candidate") %>
+
+
+
<%= _("Add candidate") %>
+ <% if @vote.candidates.empty? %>
+
<%= _("This vote has no candidates yet. Add a first candidate.") %>
+ <% end %>
+
+
+
-
-
- <%= _("Name") %>
-
-
-
- <%= _("Description") %>
-
-
- <%= _("Add candidate") %>
+
+ <% if @vote.candidates.length < 2 %>
+ <%= _("Add at least 2 candidates before opening the vote to participants.") %>
+
+ <% end %>
+ <%= _("Open vote to participants") %>
+ <% if @vote.candidates.length < 2 %>
+
+ <% end %>
-
<%= _("Organizers") %>
+
+ <%= _("Delete vote") %>
+
+
+
<%= _("Organizers") %>
<% @vote.organizers.each do |organizer| %>
@@ -40,26 +78,12 @@
<% end %>
-
<%= _("Add organizer") %>
+
<%= _("Add organizer") %>
-
-
- <%= _("Email") %>
-
-
- <%= _("Add organizer") %>
-
-
-
<%= _("Actions for organizers") %>
-
-
- <% if @vote.candidates.length < 2 %>
- <%= _("Open vote to participants") %>
- <%= _("Add at least 2 candidates before opening the vote to participants.") %>
- <% else %>
- <%= _("Open vote to participants") %>
- <% end %>
-
-
- <%= _("Delete vote") %>
+
+
+ <%= _("Email") %>
+
+
+ <%= _("Add organizer") %>
diff --git a/views/votes_edit_description.erb b/views/votes_edit_description.erb
index 9429f1b..a4af2a5 100644
--- a/views/votes_edit_description.erb
+++ b/views/votes_edit_description.erb
@@ -1,13 +1,13 @@
-
<%= _("Edit vote description") %>
+
<%= _("Edit vote description") %>
-
- <%= _("Title") %>
-
-
-
- <%= _("Description") %>
- <%= @vote.description %>
-
- <%= _("Save") %>
+
+ <%= _("Title") %>
+
+
+
+ <%= _("Description") %>
+ <%= @vote.description %>
+
+ <%= _("Save") %>
diff --git a/views/votes_new.erb b/views/votes_new.erb
index 381eed8..2ef0ddf 100644
--- a/views/votes_new.erb
+++ b/views/votes_new.erb
@@ -1,13 +1,13 @@
-
<%= _("New vote") %>
+
<%= _("New vote") %>
-
- <%= _("Title") %>
-
-
-
- <%= _("Description") %>
-
-
- <%= _("Create new vote") %>
+
+ <%= _("Title") %>
+
+
+
+ <%= _("Description") %>
+
+
+ <%= _("Create new vote") %>
diff --git a/views/votes_open.erb b/views/votes_open.erb
index 6e3670e..25da43c 100644
--- a/views/votes_open.erb
+++ b/views/votes_open.erb
@@ -1,6 +1,15 @@
-
<%= _("Open vote") %>
+
+
<%= @vote.title %>
+
+
+ <%= _("Draft") %>
+
+
+
-
<%= _("Closing date: %{date}") % { date: format_date_and_time(@expire_on) } %>
+
+
+
<%= _("Closing date: %{date}") % { date: format_date_and_time(@expire_on) } %>
<%= _("The vote will automatically close on that date and the results will
be sent to all users by email.") %>
@@ -8,21 +17,29 @@ be sent to all users by email.") %>
<%= _("You won't be able to modify or delete this vote anymore after
opening it.") %>
-
- <%= _("Open vote to participants") %>
+
+ <%= _("Open vote to participants") %>
- <%= _("Cancel") %>
+ <%= _("Cancel") %>
-
<%= @vote.title %>
+
-<%= markdown(@vote.description) %>
+
+
+ <%= markdown(@vote.description) %>
+
+
-
<%= _("Candidates") %>
+
<%= _("Candidates") %>
<% @vote.candidates.each do |candidate| %>
-
<%= candidate.name %>
-<%= markdown(candidate.description) %>
+
+
+
<%= candidate.name %>
+ <%= markdown(candidate.description) %>
+
+
<% end %>
diff --git a/views/votes_show_closed.erb b/views/votes_show_closed.erb
index 788f38c..59e7441 100644
--- a/views/votes_show_closed.erb
+++ b/views/votes_show_closed.erb
@@ -1,38 +1,46 @@
-
<%= @vote.title %>
+
+
<%= @vote.title %>
+
+
+ <%= _("Closed") %>
+ <% if @vote.users.exists?(current_user.id) %>
+ <%= _("Organizer") %>
+ <% end %>
+
+ <% if @vote.expire_on %>
+ <%= _("Closed on %{date}") % { date: format_date_and_time(@vote.expire_on) } %>
+ <% end %>
+
+
-<% if @vote.expire_on %>
-
<%= _("Closing date: %{date}") % { date: format_date_and_time(@vote.expire_on) } %>
+
+
+ <%= markdown(@vote.description) %>
+
+
+
+
<%= _("Options") %>
+
+<% @vote.candidates.each do |candidate| %>
+
+
+
<%= candidate.name %>
+ <%= markdown(candidate.description) %>
+
+
<% end %>
-<%= markdown(@vote.description) %>
+
-<% unless @vote.ratings.blank? %>
+
<%= _("Results") %>
-
<%= _("All ratings") %>
+<% if @vote.ratings.blank? %>
-
-
- <%= _("Participant") %>
- <% @vote.candidates.each do |candidate| %>
- <%= candidate.name %>
- <% end %>
-
- <% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
-
- <%= user.email %>
- <% @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 %>
- <%= _(value[:label]) %>
- <% end %>
- <% end %>
-
- <% end %>
-
+<%= _("No results are available because nobody voted on this vote.") %>
-
<%= _("Results") %>
+<% else %>
-
+
<%= _("Rank") %>
<%= _("Candidate") %>
@@ -47,7 +55,7 @@
<%= i %>
<%= candidate.name %>
<% value = settings.values.select { |e| e[:id] == candidate.mj.mj }.first %>
- <%= _(value[:label]) %>
+ <%= _(value[:label]) %>
<%= candidate.mj.proponents %>
<%= candidate.mj.opponents %>
@@ -68,15 +76,43 @@ end
%>
<%= bar_chart data, colors: colors, stacked: true, legend: 'bottom' %>
-<% else %>
+
-<%= _("Results") %>
+<%= _("Ratings") %>
-<%= _("No results are available because nobody voted on this vote.") %>
+
+
+
+ <%= _("Participant") %>
+ <% @vote.candidates.each do |candidate| %>
+ <%= candidate.name %>
+ <% end %>
+
+
+ <% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
+
+ <%= user.email %>
+ <% @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 %>
+ <%= _(value[:label]) %>
+ <% end %>
+ <% end %>
+
+ <% end %>
+
<% end %>
-<%= _("Organizers") %>
+<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
+
+
+ <%= _("Reopen voting period") %>
+
+
+<% end %>
+
+<%= _("Organizers") %>
<% @vote.organizers.each do |organizer| %>
@@ -86,20 +122,14 @@ end
<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
-<%= _("Actions for organizers") %>
+<%= _("Add organizer") %>
-
- <%= _("Reopen voting period") %>
-
-
-<%= _("Add organizer") %>
-
-
-
- <%= _("Email") %>
-
-
- <%= _("Add organizer") %>
+
+
+ <%= _("Email") %>
+
+
+ <%= _("Add organizer") %>
<% end %>
diff --git a/views/votes_show_draft.erb b/views/votes_show_draft.erb
index c521143..19d114f 100644
--- a/views/votes_show_draft.erb
+++ b/views/votes_show_draft.erb
@@ -1,18 +1,35 @@
-<%= @vote.title %> <%= _("(Draft)") %>
+
+
<%= @vote.title %>
+
+
+ <%= _("Draft") %>
+
+
+
-<%= markdown(@vote.description) %>
+
+
+ <%= markdown(@vote.description) %>
+
+
-<%= _("Organizers") %>
+<%= _("Candidates") %>
+
+<% @vote.candidates.each do |candidate| %>
+
+
+
<%= candidate.name %>
+ <%= markdown(candidate.description) %>
+
+
+<% end %>
+
+
+
+<%= _("Organizers") %>
<% @vote.organizers.each do |organizer| %>
<%= organizer.user.email %>
<% end %>
-
-<%= _("Candidates") %>
-
-<% @vote.candidates.each do |candidate| %>
-<%= candidate.name %>
-<%= markdown(candidate.description) %>
-<% end %>
diff --git a/views/votes_show_open.erb b/views/votes_show_open.erb
index 9935f43..3596b3b 100644
--- a/views/votes_show_open.erb
+++ b/views/votes_show_open.erb
@@ -1,57 +1,82 @@
-<%= @vote.title %>
+
+
<%= @vote.title %>
+
+
+ <%= _("Open") %>
+
+ <% if @vote.expire_on %>
+ <%= _("Closes on %{date}") % { date: format_date_and_time(@vote.expire_on) } %>
+ <% end %>
+
+
+
+
+
+ <%= markdown(@vote.description) %>
+
+
+
+<%= _("Options") %>
<% if @errors %>
<% @errors.each do |error| %>
<% if error.attribute == :rating and error.type == :blank %>
- <%= _("Missing rating for candidate %{name} .") % { name: error.candidate.name } %>
+ <%= _("Missing rating for candidate %{name} .") % { name: error.candidate.name } %>
<% end %>
<% end %>
<% end %>
-<% if @vote.expire_on %>
-<%= _("Closing date: %{date}") % { date: format_date_and_time(@vote.expire_on) } %>
-<% end %>
+
-<%= markdown(@vote.description) %>
-
-<%= _("Your ratings") %>
-
-
-
<% @vote.candidates.each do |candidate| %>
- <% rating = @vote.ratings.find { |rating| rating.user == current_user and rating.candidate == candidate } %>
- <% if rating
- value = rating.value
- elsif @params[candidate.id.to_s]
- value = params[candidate.id.to_s].to_i
- else
- value = 0
- end %>
-
- <%= candidate.name %>
- <%= markdown(candidate.description) %>
-
-
+
+
+
<%= candidate.name %>
+ <%= markdown(candidate.description) %>
+ <% rating = @vote.ratings.find { |rating| rating.user == current_user and rating.candidate == candidate } %>
+ <% if rating
+ value = rating.value
+ elsif @params[candidate.id.to_s]
+ value = params[candidate.id.to_s].to_i
+ else
+ value = 0
+ end %>
+
+ <% settings.values.reverse.each do |v| %>
+ checked<% end %>>
+ <%= _(v[:label]) %>
+ <% end %>
+
+
+
<% end %>
-
-<%= _("Save") %>
+
+ <%= _("Vote") %>
-<%= _("Participants") %>
+<%= _("Participants") %>
-
+
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
<%= user.email %>
<% end %>
+<% if @vote.users.exists?(current_user.id) and @vote.expire_on.nil? %>
+
+
+ <%= _("Change back to draft vote") %>
+
+
+
+ <%= _("Close votes and show results") %>
+
+
+<% end %>
+
<% unless @vote.organizers.blank? %>
-<%= _("Organizers") %>
+<%= _("Organizers") %>
<% @vote.organizers.each do |organizer| %>
@@ -61,26 +86,16 @@
<% 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? %>
-<%= _("Actions for organizers") %>
+<%= _("Add organizer") %>
-
- <%= _("Change back to draft vote") %>
-
-
-
- <%= _("Close votes and show results") %>
-
-
-<%= _("Add organizer") %>
-
-
-
- <%= _("Email") %>
-
-
- <%= _("Add organizer") %>
+
+
+ <%= _("Email") %>
+
+
+ <%= _("Add organizer") %>
<% end %>