Translate to Catalan
This commit is contained in:
parent
3fa8c69a49
commit
e826d79240
12 changed files with 502 additions and 110 deletions
206
po/ca/vote.po
206
po/ca/vote.po
|
|
@ -7,7 +7,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2025-03-29 21:18-0600\n"
|
"POT-Creation-Date: 2025-03-30 12:01-0600\n"
|
||||||
"PO-Revision-Date: 2025-03-29 20:41-0600\n"
|
"PO-Revision-Date: 2025-03-29 20:41-0600\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
@ -17,14 +17,212 @@ msgstr ""
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
||||||
|
|
||||||
#: ../views/login.erb:1
|
#: ../views/home.erb:1 ../views/layout.erb:10
|
||||||
|
msgid "Home"
|
||||||
|
msgstr "Inici"
|
||||||
|
|
||||||
|
#: ../views/home.erb:3
|
||||||
|
msgid "Votes"
|
||||||
|
msgstr "Votacions"
|
||||||
|
|
||||||
|
#: ../views/home.erb:11
|
||||||
|
msgid "(Draft, organized by you)"
|
||||||
|
msgstr "(Esborrany, organitzada per tu)"
|
||||||
|
|
||||||
|
#: ../views/home.erb:12 ../views/votes_show_draft.erb:1
|
||||||
|
msgid "(Draft)"
|
||||||
|
msgstr "(Esborrany)"
|
||||||
|
|
||||||
|
#: ../views/home.erb:15
|
||||||
|
msgid "(Open, organized by you)"
|
||||||
|
msgstr "(Oberta, organitzada per tu)"
|
||||||
|
|
||||||
|
#: ../views/home.erb:16
|
||||||
|
msgid "(Open)"
|
||||||
|
msgstr "(Oberta)"
|
||||||
|
|
||||||
|
#: ../views/home.erb:19
|
||||||
|
msgid "(Closed, organized by you)"
|
||||||
|
msgstr "(Tancada, organitzada per tu)"
|
||||||
|
|
||||||
|
#: ../views/home.erb:20
|
||||||
|
msgid "(Closed)"
|
||||||
|
msgstr "(Tancada)"
|
||||||
|
|
||||||
|
#: ../views/home.erb:28 ../views/votes_new.erb:12
|
||||||
|
msgid "Create new vote"
|
||||||
|
msgstr "Crear una nova votació"
|
||||||
|
|
||||||
|
#: ../views/layout.erb:5
|
||||||
|
msgid "Vote"
|
||||||
|
msgstr "Votació"
|
||||||
|
|
||||||
|
#: ../views/layout.erb:9
|
||||||
|
msgid "Logged in as %{email}."
|
||||||
|
msgstr "Estàs connectada com a %{email}."
|
||||||
|
|
||||||
|
#: ../views/layout.erb:9
|
||||||
|
msgid "Logout"
|
||||||
|
msgstr "Desconnexió"
|
||||||
|
|
||||||
|
#: ../views/layout.erb:12 ../views/login.erb:1 ../views/login.erb:14
|
||||||
msgid "Login"
|
msgid "Login"
|
||||||
msgstr "Connexió"
|
msgstr "Connexió"
|
||||||
|
|
||||||
#: ../views/login.erb:7
|
#: ../views/login.erb:7 ../views/signup.erb:5 ../views/votes_edit.erb:51
|
||||||
|
#: ../views/votes_show_closed.erb:69 ../views/votes_show_open.erb:58
|
||||||
msgid "Email"
|
msgid "Email"
|
||||||
msgstr "Correu"
|
msgstr "Correu"
|
||||||
|
|
||||||
#: ../views/login.erb:11
|
#: ../views/login.erb:11 ../views/signup.erb:9
|
||||||
msgid "Password"
|
msgid "Password"
|
||||||
msgstr "Contrasenya"
|
msgstr "Contrasenya"
|
||||||
|
|
||||||
|
#: ../views/login.erb:16 ../views/signup.erb:1 ../views/signup.erb:12
|
||||||
|
msgid "Create account"
|
||||||
|
msgstr "Crear un compte"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:1
|
||||||
|
msgid "Edit draft vote"
|
||||||
|
msgstr "Editar un esborrany de votació"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:5 ../views/votes_new.erb:5
|
||||||
|
msgid "Title"
|
||||||
|
msgstr "Títol"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:9 ../views/votes_edit.erb:33
|
||||||
|
#: ../views/votes_new.erb:9
|
||||||
|
msgid "Description"
|
||||||
|
msgstr "Descripció"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:12 ../views/votes_show_open.erb:23
|
||||||
|
msgid "Save"
|
||||||
|
msgstr "Guardar"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:15 ../views/votes_show_draft.erb:13
|
||||||
|
msgid "Candidates"
|
||||||
|
msgstr "Candidats"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:21
|
||||||
|
msgid "Delete"
|
||||||
|
msgstr "Suprimir"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:25
|
||||||
|
msgid "Add candidate"
|
||||||
|
msgstr "Afegeix un candidat"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:29
|
||||||
|
msgid "Name"
|
||||||
|
msgstr "Nom"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:36 ../views/votes_edit.erb:54
|
||||||
|
#: ../views/votes_show_closed.erb:72 ../views/votes_show_open.erb:61
|
||||||
|
msgid "Add"
|
||||||
|
msgstr "Afegir"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:39 ../views/votes_show_closed.erb:49
|
||||||
|
#: ../views/votes_show_draft.erb:5 ../views/votes_show_open.erb:34
|
||||||
|
msgid "Organizers"
|
||||||
|
msgstr "Organitzadores"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:47 ../views/votes_show_closed.erb:65
|
||||||
|
#: ../views/votes_show_open.erb:54
|
||||||
|
msgid "Add organizer"
|
||||||
|
msgstr "Afegeix organitzadora"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:57 ../views/votes_show_closed.erb:59
|
||||||
|
#: ../views/votes_show_open.erb:44
|
||||||
|
msgid "Actions for organizers"
|
||||||
|
msgstr "Accions per les organitzadores"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:60
|
||||||
|
msgid "Open vote to participants"
|
||||||
|
msgstr "Obrir la votació als participants"
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:63
|
||||||
|
msgid "Delete vote"
|
||||||
|
msgstr "Suprimir la votació"
|
||||||
|
|
||||||
|
#: ../views/votes_new.erb:1
|
||||||
|
msgid "New vote"
|
||||||
|
msgstr "Nova votació"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:5
|
||||||
|
msgid "All ratings"
|
||||||
|
msgstr "Totes les valoracions"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:9
|
||||||
|
msgid "Participant"
|
||||||
|
msgstr "Participant"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:26
|
||||||
|
msgid "Results"
|
||||||
|
msgstr "Resultats"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:30
|
||||||
|
msgid "Rank"
|
||||||
|
msgstr "Rang"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:31
|
||||||
|
msgid "Candidate"
|
||||||
|
msgstr "Candidat"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:32
|
||||||
|
msgid "Majority Judgment"
|
||||||
|
msgstr "Judici majoritari"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:33
|
||||||
|
msgid "Proponents"
|
||||||
|
msgstr "Defensores"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:34
|
||||||
|
msgid "Opponents"
|
||||||
|
msgstr "Detractores"
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:62
|
||||||
|
msgid "Reopen voting period"
|
||||||
|
msgstr "Reobrir el període de votació"
|
||||||
|
|
||||||
|
#: ../views/votes_show_open.erb:5
|
||||||
|
msgid "Your ratings"
|
||||||
|
msgstr "Les teves valoracions"
|
||||||
|
|
||||||
|
#: ../views/votes_show_open.erb:26
|
||||||
|
msgid "Participants"
|
||||||
|
msgstr "Participants"
|
||||||
|
|
||||||
|
#: ../views/votes_show_open.erb:47
|
||||||
|
msgid "Change back to draft vote"
|
||||||
|
msgstr "Tornar a l'esborrany de votació"
|
||||||
|
|
||||||
|
#: ../views/votes_show_open.erb:51
|
||||||
|
msgid "Close votes and show results"
|
||||||
|
msgstr "Tancar la votació i veure els resultats"
|
||||||
|
|
||||||
|
#: ../vote.rb:59
|
||||||
|
msgid "Awful"
|
||||||
|
msgstr "Molt malament"
|
||||||
|
|
||||||
|
#: ../vote.rb:60
|
||||||
|
msgid "Very bad"
|
||||||
|
msgstr "Malament"
|
||||||
|
|
||||||
|
#: ../vote.rb:61
|
||||||
|
msgid "Bad"
|
||||||
|
msgstr "Poc bé"
|
||||||
|
|
||||||
|
#: ../vote.rb:62
|
||||||
|
msgid "Mediocre"
|
||||||
|
msgstr "Mig bé"
|
||||||
|
|
||||||
|
#: ../vote.rb:63
|
||||||
|
msgid "Good"
|
||||||
|
msgstr "Bé"
|
||||||
|
|
||||||
|
#: ../vote.rb:64
|
||||||
|
msgid "Very good"
|
||||||
|
msgstr "Molt bé"
|
||||||
|
|
||||||
|
#: ../vote.rb:65
|
||||||
|
msgid "Excellent"
|
||||||
|
msgstr "Excel·lent"
|
||||||
|
|
|
||||||
208
po/vote.pot
208
po/vote.pot
|
|
@ -8,8 +8,8 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2025-03-29 21:18-0600\n"
|
"POT-Creation-Date: 2025-03-30 12:01-0600\n"
|
||||||
"PO-Revision-Date: 2025-03-29 21:18-0600\n"
|
"PO-Revision-Date: 2025-03-30 12:01-0600\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
"Language: \n"
|
"Language: \n"
|
||||||
|
|
@ -18,14 +18,212 @@ msgstr ""
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
||||||
|
|
||||||
#: ../views/login.erb:1
|
#: ../views/home.erb:1 ../views/layout.erb:10
|
||||||
|
msgid "Home"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/home.erb:3
|
||||||
|
msgid "Votes"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/home.erb:11
|
||||||
|
msgid "(Draft, organized by you)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/home.erb:12 ../views/votes_show_draft.erb:1
|
||||||
|
msgid "(Draft)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/home.erb:15
|
||||||
|
msgid "(Open, organized by you)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/home.erb:16
|
||||||
|
msgid "(Open)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/home.erb:19
|
||||||
|
msgid "(Closed, organized by you)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/home.erb:20
|
||||||
|
msgid "(Closed)"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/home.erb:28 ../views/votes_new.erb:12
|
||||||
|
msgid "Create new vote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/layout.erb:5
|
||||||
|
msgid "Vote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/layout.erb:9
|
||||||
|
msgid "Logged in as %{email}."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/layout.erb:9
|
||||||
|
msgid "Logout"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/layout.erb:12 ../views/login.erb:1 ../views/login.erb:14
|
||||||
msgid "Login"
|
msgid "Login"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../views/login.erb:7
|
#: ../views/login.erb:7 ../views/signup.erb:5 ../views/votes_edit.erb:51
|
||||||
|
#: ../views/votes_show_closed.erb:69 ../views/votes_show_open.erb:58
|
||||||
msgid "Email"
|
msgid "Email"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../views/login.erb:11
|
#: ../views/login.erb:11 ../views/signup.erb:9
|
||||||
msgid "Password"
|
msgid "Password"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/login.erb:16 ../views/signup.erb:1 ../views/signup.erb:12
|
||||||
|
msgid "Create account"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:1
|
||||||
|
msgid "Edit draft vote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:5 ../views/votes_new.erb:5
|
||||||
|
msgid "Title"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:9 ../views/votes_edit.erb:33
|
||||||
|
#: ../views/votes_new.erb:9
|
||||||
|
msgid "Description"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:12 ../views/votes_show_open.erb:23
|
||||||
|
msgid "Save"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:15 ../views/votes_show_draft.erb:13
|
||||||
|
msgid "Candidates"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:21
|
||||||
|
msgid "Delete"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:25
|
||||||
|
msgid "Add candidate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:29
|
||||||
|
msgid "Name"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:36 ../views/votes_edit.erb:54
|
||||||
|
#: ../views/votes_show_closed.erb:72 ../views/votes_show_open.erb:61
|
||||||
|
msgid "Add"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:39 ../views/votes_show_closed.erb:49
|
||||||
|
#: ../views/votes_show_draft.erb:5 ../views/votes_show_open.erb:34
|
||||||
|
msgid "Organizers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:47 ../views/votes_show_closed.erb:65
|
||||||
|
#: ../views/votes_show_open.erb:54
|
||||||
|
msgid "Add organizer"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:57 ../views/votes_show_closed.erb:59
|
||||||
|
#: ../views/votes_show_open.erb:44
|
||||||
|
msgid "Actions for organizers"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:60
|
||||||
|
msgid "Open vote to participants"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_edit.erb:63
|
||||||
|
msgid "Delete vote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_new.erb:1
|
||||||
|
msgid "New vote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:5
|
||||||
|
msgid "All ratings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:9
|
||||||
|
msgid "Participant"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:26
|
||||||
|
msgid "Results"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:30
|
||||||
|
msgid "Rank"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:31
|
||||||
|
msgid "Candidate"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:32
|
||||||
|
msgid "Majority Judgment"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:33
|
||||||
|
msgid "Proponents"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:34
|
||||||
|
msgid "Opponents"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_closed.erb:62
|
||||||
|
msgid "Reopen voting period"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_open.erb:5
|
||||||
|
msgid "Your ratings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_open.erb:26
|
||||||
|
msgid "Participants"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_open.erb:47
|
||||||
|
msgid "Change back to draft vote"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../views/votes_show_open.erb:51
|
||||||
|
msgid "Close votes and show results"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../vote.rb:59
|
||||||
|
msgid "Awful"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../vote.rb:60
|
||||||
|
msgid "Very bad"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../vote.rb:61
|
||||||
|
msgid "Bad"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../vote.rb:62
|
||||||
|
msgid "Mediocre"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../vote.rb:63
|
||||||
|
msgid "Good"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../vote.rb:64
|
||||||
|
msgid "Very good"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: ../vote.rb:65
|
||||||
|
msgid "Excellent"
|
||||||
|
msgstr ""
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,23 @@
|
||||||
<h1>Home</h1>
|
<h1><%= _("Home") %></h1>
|
||||||
|
|
||||||
<p>Hello, <%= current_user.email %>.</p>
|
<h2><%= _("Votes") %></h2>
|
||||||
|
|
||||||
<h2>Votes</h2>
|
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @votes.reverse.each do |vote| %>
|
<% @votes.reverse.each do |vote| %>
|
||||||
<li>
|
<li>
|
||||||
<a href="/votes/<%= vote.secure_id %>"><%= vote.title %></a>
|
<a href="/votes/<%= vote.secure_id %>"><%= vote.title %></a>
|
||||||
<% case vote.state
|
<% case vote.state
|
||||||
when "draft" %>
|
when 'draft' %>
|
||||||
<% if vote.users.exists?(current_user.id) %>(Draft, organized by you)
|
<% if vote.users.exists?(current_user.id) %><%= _("(Draft, organized by you)") %>
|
||||||
<% else %>(Draft)
|
<% else %><%= _("(Draft)") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% when "open" %>
|
<% when 'open' %>
|
||||||
<% if vote.users.exists?(current_user.id) %>(Open, organized by you)
|
<% if vote.users.exists?(current_user.id) %><%= _("(Open, organized by you)") %>
|
||||||
<% else %>(Open)
|
<% else %><%= _("(Open)") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% when "closed" %>
|
<% when 'closed' %>
|
||||||
<% if vote.users.exists?(current_user.id) %>(Closed, organized by you)
|
<% if vote.users.exists?(current_user.id) %><%= _("(Closed, organized by you)") %>
|
||||||
<% else %>(Closed)
|
<% else %><%= _("(Closed)") %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -27,5 +25,5 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<form action="/votes/new" method="get">
|
<form action="/votes/new" method="get">
|
||||||
<button type="submit">Create new vote</button>
|
<button type="submit"><%= _("Create new vote") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<title>Title</title>
|
<title><%= _("Vote") %></title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<% if current_user %>
|
<% if current_user %>
|
||||||
<p>Logged in as <%= current_user.email %>. <a href="/logout">Logout</a></p>
|
<p><%= _("Logged in as %{email}.") % { email: current_user.email } %> <a href="/logout"><%= _("Logout") %></a></p>
|
||||||
<p><a href="/">Home</a></p>
|
<p><a href="/"><%= _("Home") %></a></p>
|
||||||
<% else %>
|
<% else %>
|
||||||
<p><a href="/login">Login</a></p>
|
<p><a href="/login"><%= _("Login") %></a></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= yield %>
|
<%= yield %>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,6 @@
|
||||||
<label for="password"><%= _("Password") %></label>
|
<label for="password"><%= _("Password") %></label>
|
||||||
<input type="password" name="password">
|
<input type="password" name="password">
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Log in</button>
|
<button type="submit"><%= _("Login") %></button>
|
||||||
</form>
|
</form>
|
||||||
<a href="/signup">Create account</a>
|
<a href="/signup"><%= _("Create account") %></a>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<h1>Create account</h1>
|
<h1><%= _("Create account") %></h1>
|
||||||
|
|
||||||
<form action="/signup" method="post">
|
<form action="/signup" method="post">
|
||||||
<p>
|
<p>
|
||||||
<label for="email">Email</label>
|
<label for="email"><%= _("Email") %></label>
|
||||||
<input type="text" name="email">
|
<input type="text" name="email">
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="password">Password</label>
|
<label for="password"><%= _("Password") %></label>
|
||||||
<input type="password" name="password">
|
<input type="password" name="password">
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Create account</button>
|
<button type="submit"><%= _("Create account") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,42 +1,42 @@
|
||||||
<h1>Edit draft vote</h1>
|
<h1><%= _("Edit draft vote") %></h1>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/edit" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/edit" method="post">
|
||||||
<p>
|
<p>
|
||||||
<label for="title">Title</label>
|
<label for="title"><%= _("Title") %></label>
|
||||||
<input type="text" name="title" value="<%= @vote.title %>">
|
<input type="text" name="title" value="<%= @vote.title %>">
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="description">Description</label>
|
<label for="description"><%= _("Description") %></label>
|
||||||
<input type="text" name="description" value="<%= @vote.description %>">
|
<input type="text" name="description" value="<%= @vote.description %>">
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Update vote description</button>
|
<button type="submit"><%= _("Save") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2>Candidates</h2>
|
<h2><%= _("Candidates") %></h2>
|
||||||
|
|
||||||
<% @vote.candidates.each do |candidate| %>
|
<% @vote.candidates.each do |candidate| %>
|
||||||
<h3><%= candidate.name %></h3>
|
<h3><%= candidate.name %></h3>
|
||||||
<p><%= candidate.description %></p>
|
<p><%= candidate.description %></p>
|
||||||
<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 candidate</button>
|
<button type="submit"><%= _("Delete") %></button>
|
||||||
</form>
|
</form>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<h3>Add candidate</h3>
|
<h3><%= _("Add candidate") %></h3>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/candidates" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/candidates" method="post">
|
||||||
<p>
|
<p>
|
||||||
<label for="name">Name</label>
|
<label for="name"><%= _("Name") %></label>
|
||||||
<input type="text" name="name">
|
<input type="text" name="name">
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="description">Description</label>
|
<label for="description"><%= _("Description") %></label>
|
||||||
<input type="text" name="description">
|
<input type="text" name="description">
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Add new candidate</button>
|
<button type="submit"><%= _("Add") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2>Organizers</h2>
|
<h2><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
|
|
@ -44,21 +44,21 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h3>Add organizer</h3>
|
<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>
|
||||||
<input type="text" name="email">
|
<input type="text" name="email">
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Add new organizer</button>
|
<button type="submit"><%= _("Add") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3>Actions for organizers</h2>
|
<h3><%= _("Actions for organizers") %></h2>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/open" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/open" method="post">
|
||||||
<button type="submit">Open vote to participants</button>
|
<button type="submit"><%= _("Open vote to participants") %></button>
|
||||||
</form>
|
</form>
|
||||||
<form action="/votes/<%= @vote.secure_id %>/delete" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/delete" method="post">
|
||||||
<button type="submit">Delete vote</button>
|
<button type="submit"><%= _("Delete vote") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<h1>New vote</h1>
|
<h1><%= _("New vote") %></h1>
|
||||||
|
|
||||||
<form action="/votes" method="post">
|
<form action="/votes" method="post">
|
||||||
<p>
|
<p>
|
||||||
<label for="title">Title</label>
|
<label for="title"><%= _("Title") %></label>
|
||||||
<input type="text" name="title">
|
<input type="text" name="title">
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<label for="description">Description</label>
|
<label for="description"><%= _("Description") %></label>
|
||||||
<input type="text" name="description">
|
<input type="text" name="description">
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Create new vote</button>
|
<button type="submit"><%= _("Create new vote") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
<p><%= @vote.description %></p>
|
<p><%= @vote.description %></p>
|
||||||
|
|
||||||
<h2>All ratings</h2>
|
<h2><%= _("All ratings") %></h2>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Participant</th>
|
<th><%= _("Participant") %></th>
|
||||||
<% @vote.candidates.each do |candidate| %>
|
<% @vote.candidates.each do |candidate| %>
|
||||||
<th><%= candidate.name %></th>
|
<th><%= candidate.name %></th>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
@ -23,15 +23,15 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>Results</h2>
|
<h2><%= _("Results") %></h2>
|
||||||
|
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Rank</td>
|
<td><%= _("Rank") %></td>
|
||||||
<td>Candidate</td>
|
<td><%= _("Candidate") %></td>
|
||||||
<td>Majority Judgment</td>
|
<td><%= _("Majority Judgment") %></td>
|
||||||
<td>Proponents</td>
|
<td><%= _("Proponents") %></td>
|
||||||
<td>Opponents</td>
|
<td><%= _("Opponents") %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% i = 0 %>
|
<% i = 0 %>
|
||||||
<% @vote.candidates.sort { |a, b| a.mj <=> b.mj }.reverse.each do |candidate| %>
|
<% @vote.candidates.sort { |a, b| a.mj <=> b.mj }.reverse.each do |candidate| %>
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>Organizers</h2>
|
<h2><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
|
|
@ -56,20 +56,20 @@
|
||||||
|
|
||||||
<% if @vote.users.exists?(current_user.id) %>
|
<% if @vote.users.exists?(current_user.id) %>
|
||||||
|
|
||||||
<h3>Actions for organizers</h3>
|
<h3><%= _("Actions for organizers") %></h3>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/reopen" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/reopen" method="post">
|
||||||
<button type="submit">Reopen voting period</button>
|
<button type="submit"><%= _("Reopen voting period") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3>Add organizer</h3>
|
<h3><%= _("Add") %></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>
|
||||||
<input type="text" name="email">
|
<input type="text" name="email">
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Add new organizer</button>
|
<button type="submit"><%= _("Add") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<h1><%= @vote.title %> (Draft)</h1>
|
<h1><%= @vote.title %> <%= _("(Draft)") %></h1>
|
||||||
|
|
||||||
<p><%= @vote.description %></p>
|
<p><%= @vote.description %></p>
|
||||||
|
|
||||||
<h2>Organizers</h2>
|
<h2><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Candidates</h2>
|
<h2><%= _("Candidates") %></h2>
|
||||||
|
|
||||||
<% @vote.candidates.each do |candidate| %>
|
<% @vote.candidates.each do |candidate| %>
|
||||||
<h3><%= candidate.name %></h3>
|
<h3><%= candidate.name %></h3>
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
<p><%= @vote.description %></p>
|
<p><%= @vote.description %></p>
|
||||||
|
|
||||||
<h2>Your ratings</h2>
|
<h2><%= _("Your ratings") %></h2>
|
||||||
|
|
||||||
<p>Hello, <%= current_user.email %>.</p>
|
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/ratings" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/ratings" method="post">
|
||||||
<ul>
|
<ul>
|
||||||
|
|
@ -22,10 +20,10 @@
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
<button type="submit">Save ratings</button>
|
<button type="submit"><%= _("Save") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h2>Participants</h2>
|
<h2><%= _("Participants") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
|
<% @vote.ratings.collect { |rating| rating.user }.uniq.each do |user| %>
|
||||||
|
|
@ -33,7 +31,7 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Organizers</h2>
|
<h2><%= _("Organizers") %></h2>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<% @vote.organizers.each do |organizer| %>
|
<% @vote.organizers.each do |organizer| %>
|
||||||
|
|
@ -43,24 +41,24 @@
|
||||||
|
|
||||||
<% if @vote.users.exists?(current_user.id) %>
|
<% if @vote.users.exists?(current_user.id) %>
|
||||||
|
|
||||||
<h3>Actions for organizers</h3>
|
<h3><%= _("Actions for organizers") %></h3>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/draft" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/draft" method="post">
|
||||||
<button type="submit">Change back to draft vote</button>
|
<button type="submit"><%= _("Change back to draft vote") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<form action="/votes/<%= @vote.secure_id %>/close" method="post">
|
<form action="/votes/<%= @vote.secure_id %>/close" method="post">
|
||||||
<button type="submit">Close votes and show results</button>
|
<button type="submit"><%= _("Close votes and show results") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<h3>Add organizer</h3>
|
<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>
|
||||||
<input type="text" name="email">
|
<input type="text" name="email">
|
||||||
</p>
|
</p>
|
||||||
<button type="submit">Add new organizer</button>
|
<button type="submit"><%= _("Add") %></button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
54
vote.rb
54
vote.rb
|
|
@ -10,7 +10,7 @@ class Vote < ActiveRecord::Base
|
||||||
has_many :ratings, dependent: :destroy
|
has_many :ratings, dependent: :destroy
|
||||||
has_many :organizers, dependent: :destroy
|
has_many :organizers, dependent: :destroy
|
||||||
has_many :users, through: :organizers
|
has_many :users, through: :organizers
|
||||||
validates :state, inclusion: { in: ["draft", "open", "closed"] }
|
validates :state, inclusion: { in: ['draft', 'open', 'closed'] }
|
||||||
end
|
end
|
||||||
|
|
||||||
class Candidate < ActiveRecord::Base
|
class Candidate < ActiveRecord::Base
|
||||||
|
|
@ -50,21 +50,21 @@ def verify_password(password, hash)
|
||||||
BCrypt::Password.new(hash) == password
|
BCrypt::Password.new(hash) == password
|
||||||
end
|
end
|
||||||
|
|
||||||
enable :sessions
|
|
||||||
set :values, [ { :id => 1, :label => "Awful" },
|
|
||||||
{ :id => 2, :label => "Very bad" },
|
|
||||||
{ :id => 3, :label => "Bad" },
|
|
||||||
{ :id => 4, :label => "Mediocre" },
|
|
||||||
{ :id => 5, :label => "Good" },
|
|
||||||
{ :id => 6, :label => "Very good" },
|
|
||||||
{ :id => 7, :label => "Excellent" } ]
|
|
||||||
MajorityJudgment.values = settings.values
|
|
||||||
|
|
||||||
include GetText
|
include GetText
|
||||||
set_output_charset('UTF-8')
|
set_output_charset('UTF-8')
|
||||||
bindtextdomain('vote', 'locale')
|
bindtextdomain('vote', 'locale')
|
||||||
set_locale('ca')
|
set_locale('ca')
|
||||||
|
|
||||||
|
enable :sessions
|
||||||
|
set :values, [ { :id => 1, :label => _("Awful") },
|
||||||
|
{ :id => 2, :label => _("Very bad") },
|
||||||
|
{ :id => 3, :label => _("Bad") },
|
||||||
|
{ :id => 4, :label => _("Mediocre") },
|
||||||
|
{ :id => 5, :label => _("Good") },
|
||||||
|
{ :id => 6, :label => _("Very good") },
|
||||||
|
{ :id => 7, :label => _("Excellent") } ]
|
||||||
|
MajorityJudgment.values = settings.values
|
||||||
|
|
||||||
get '/' do
|
get '/' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@votes = Vote.all
|
@votes = Vote.all
|
||||||
|
|
@ -117,7 +117,7 @@ post '/votes' do
|
||||||
@vote = Vote.create(secure_id: SecureRandom.hex(8),
|
@vote = Vote.create(secure_id: SecureRandom.hex(8),
|
||||||
title: params[:title],
|
title: params[:title],
|
||||||
description: params[:description],
|
description: params[:description],
|
||||||
state: "draft")
|
state: 'draft')
|
||||||
@vote.users << current_user
|
@vote.users << current_user
|
||||||
redirect '/votes/' + @vote.secure_id
|
redirect '/votes/' + @vote.secure_id
|
||||||
end
|
end
|
||||||
|
|
@ -126,18 +126,18 @@ get '/votes/:id' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@vote = Vote.find_by(secure_id: params[:id])
|
@vote = Vote.find_by(secure_id: params[:id])
|
||||||
case @vote.state
|
case @vote.state
|
||||||
when "draft"
|
when 'draft'
|
||||||
if @vote.users.exists?(current_user.id)
|
if @vote.users.exists?(current_user.id)
|
||||||
erb :votes_edit
|
erb :votes_edit
|
||||||
else
|
else
|
||||||
erb :votes_show_draft
|
erb :votes_show_draft
|
||||||
end
|
end
|
||||||
when "open"
|
when 'open'
|
||||||
erb :votes_show_open
|
erb :votes_show_open
|
||||||
when "closed"
|
when 'closed'
|
||||||
erb :votes_show_closed
|
erb :votes_show_closed
|
||||||
else
|
else
|
||||||
@vote.state = "draft"
|
@vote.state = 'draft'
|
||||||
@vote.save
|
@vote.save
|
||||||
erb :votes_edit
|
erb :votes_edit
|
||||||
end
|
end
|
||||||
|
|
@ -146,7 +146,7 @@ end
|
||||||
post '/votes/:id/edit' do
|
post '/votes/:id/edit' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@vote = Vote.find_by(secure_id: params[:id])
|
@vote = Vote.find_by(secure_id: params[:id])
|
||||||
redirect '/votes/' + @vote.secure_id unless @vote.state == "draft" and @vote.users.exists?(current_user.id)
|
redirect '/votes/' + @vote.secure_id unless @vote.state == 'draft' and @vote.users.exists?(current_user.id)
|
||||||
@vote.title = params[:title]
|
@vote.title = params[:title]
|
||||||
@vote.description = params[:description]
|
@vote.description = params[:description]
|
||||||
@vote.save
|
@vote.save
|
||||||
|
|
@ -156,7 +156,7 @@ end
|
||||||
post '/votes/:id/candidates' do
|
post '/votes/:id/candidates' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@vote = Vote.find_by(secure_id: params[:id])
|
@vote = Vote.find_by(secure_id: params[:id])
|
||||||
redirect '/votes/' + @vote.secure_id unless @vote.state == "draft" and @vote.users.exists?(current_user.id)
|
redirect '/votes/' + @vote.secure_id unless @vote.state == 'draft' and @vote.users.exists?(current_user.id)
|
||||||
@candidate = Candidate.new(name: params[:name],
|
@candidate = Candidate.new(name: params[:name],
|
||||||
description: params[:description])
|
description: params[:description])
|
||||||
@candidate.vote = @vote
|
@candidate.vote = @vote
|
||||||
|
|
@ -167,7 +167,7 @@ end
|
||||||
post '/votes/:id/candidates/:cid/delete' do
|
post '/votes/:id/candidates/:cid/delete' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@vote = Vote.find_by(secure_id: params[:id])
|
@vote = Vote.find_by(secure_id: params[:id])
|
||||||
redirect '/votes/' + @vote.secure_id unless @vote.state == "draft" and @vote.users.exists?(current_user.id)
|
redirect '/votes/' + @vote.secure_id unless @vote.state == 'draft' and @vote.users.exists?(current_user.id)
|
||||||
@candidate = Candidate.find(params[:cid])
|
@candidate = Candidate.find(params[:cid])
|
||||||
@candidate.destroy
|
@candidate.destroy
|
||||||
redirect '/votes/' + @vote.secure_id
|
redirect '/votes/' + @vote.secure_id
|
||||||
|
|
@ -176,8 +176,8 @@ end
|
||||||
post '/votes/:id/open' do
|
post '/votes/:id/open' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@vote = Vote.find_by(secure_id: params[:id])
|
@vote = Vote.find_by(secure_id: params[:id])
|
||||||
redirect '/votes/' + @vote.secure_id unless @vote.state == "draft" and @vote.users.exists?(current_user.id)
|
redirect '/votes/' + @vote.secure_id unless @vote.state == 'draft' and @vote.users.exists?(current_user.id)
|
||||||
@vote.state = "open"
|
@vote.state = 'open'
|
||||||
@vote.save
|
@vote.save
|
||||||
redirect '/votes/' + @vote.secure_id
|
redirect '/votes/' + @vote.secure_id
|
||||||
end
|
end
|
||||||
|
|
@ -185,9 +185,9 @@ end
|
||||||
post '/votes/:id/draft' do
|
post '/votes/:id/draft' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@vote = Vote.find_by(secure_id: params[:id])
|
@vote = Vote.find_by(secure_id: params[:id])
|
||||||
redirect '/votes/' + @vote.secure_id unless @vote.state == "open" and @vote.users.exists?(current_user.id)
|
redirect '/votes/' + @vote.secure_id unless @vote.state == 'open' and @vote.users.exists?(current_user.id)
|
||||||
@vote.ratings.each {|r| r.destroy}
|
@vote.ratings.each {|r| r.destroy}
|
||||||
@vote.state = "draft"
|
@vote.state = 'draft'
|
||||||
@vote.save
|
@vote.save
|
||||||
redirect '/votes/' + @vote.secure_id
|
redirect '/votes/' + @vote.secure_id
|
||||||
end
|
end
|
||||||
|
|
@ -195,8 +195,8 @@ end
|
||||||
post '/votes/:id/close' do
|
post '/votes/:id/close' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@vote = Vote.find_by(secure_id: params[:id])
|
@vote = Vote.find_by(secure_id: params[:id])
|
||||||
redirect '/votes/' + @vote.secure_id unless @vote.state == "open" and @vote.users.exists?(current_user.id)
|
redirect '/votes/' + @vote.secure_id unless @vote.state == 'open' and @vote.users.exists?(current_user.id)
|
||||||
@vote.state = "closed"
|
@vote.state = 'closed'
|
||||||
@vote.save
|
@vote.save
|
||||||
redirect '/votes/' + @vote.secure_id
|
redirect '/votes/' + @vote.secure_id
|
||||||
end
|
end
|
||||||
|
|
@ -204,8 +204,8 @@ end
|
||||||
post '/votes/:id/reopen' do
|
post '/votes/:id/reopen' do
|
||||||
redirect '/login' unless current_user
|
redirect '/login' unless current_user
|
||||||
@vote = Vote.find_by(secure_id: params[:id])
|
@vote = Vote.find_by(secure_id: params[:id])
|
||||||
redirect '/votes/' + @vote.secure_id unless @vote.state == "closed" and @vote.users.exists?(current_user.id)
|
redirect '/votes/' + @vote.secure_id unless @vote.state == 'closed' and @vote.users.exists?(current_user.id)
|
||||||
@vote.state = "open"
|
@vote.state = 'open'
|
||||||
@vote.save
|
@vote.save
|
||||||
redirect '/votes/' + @vote.secure_id
|
redirect '/votes/' + @vote.secure_id
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue