Use checkboxes and radio buttons on poll forms
Our original interface to vote in a poll had a few issues: * Since there was no button to send the form, it wasn't clear that selecting an option would automatically store it in the database. * The interface was almost identical for single-choice questions and multiple-choice questions, which made it hard to know which type of question we were answering. * Adding other type of questions, like open answers, was hard since we would have to add a different submit button for each answer. So we're now using radio buttons for single-choice questions and checkboxes for multiple-choice questions, which are the native controls designed for these purposes, and a button to send the whole form. Since we don't have a database table for poll ballots like we have for budget ballots, we're adding a new `Poll::WebVote` model to manage poll ballots. We're using WebVote instead of Ballot or Vote because they could be mistaken with other vote classes. Note that browsers don't allow removing answers with radio buttons, so once somebody has voted in a single-choice question, they can't remove the vote unless they manually edit their HTML. This is the same behavior we had before commit7df0e9a96. As mentioned inc2010f975, we're now adding the `ChangeByZero` rubocop rule, since we've removed the test that used `and change`.
This commit is contained in:
@@ -577,6 +577,8 @@ en:
|
||||
polls:
|
||||
dates: "From %{open_at} to %{closed_at}"
|
||||
final_date: "Final recounts/Results"
|
||||
form:
|
||||
vote: "Vote"
|
||||
index:
|
||||
filters:
|
||||
current: "Open"
|
||||
@@ -634,11 +636,7 @@ en:
|
||||
poll_header:
|
||||
back_to_proposal: Back to proposal
|
||||
poll_questions:
|
||||
show:
|
||||
vote_answer: "Vote %{answer}"
|
||||
voted: "You have voted %{answer}"
|
||||
description:
|
||||
unique: "You can select a maximum of 1 answer."
|
||||
multiple: "You can select a maximum of %{maximum} answers."
|
||||
read_more_about: "Read more about:"
|
||||
proposal_notifications:
|
||||
|
||||
@@ -10,6 +10,7 @@ en:
|
||||
poll_question_option: "Answer created successfully"
|
||||
poll_question_option_video: "Video created successfully"
|
||||
poll_question_option_image: "Image uploaded successfully"
|
||||
poll_voter: "Thank you for voting!"
|
||||
proposal: "Proposal created successfully."
|
||||
proposal_notification: "Your message has been sent correctly."
|
||||
budget_investment: "Budget Investment created successfully."
|
||||
|
||||
@@ -577,6 +577,8 @@ es:
|
||||
polls:
|
||||
dates: "Desde el %{open_at} hasta el %{closed_at}"
|
||||
final_date: "Recuento final/Resultados"
|
||||
form:
|
||||
vote: "Votar"
|
||||
index:
|
||||
filters:
|
||||
current: "Abiertas"
|
||||
@@ -634,11 +636,7 @@ es:
|
||||
poll_header:
|
||||
back_to_proposal: Volver a la propuesta
|
||||
poll_questions:
|
||||
show:
|
||||
vote_answer: "Votar %{answer}"
|
||||
voted: "Has votado %{answer}"
|
||||
description:
|
||||
unique: "Puedes seleccionar un máximo de 1 respuesta."
|
||||
multiple: "Puedes seleccionar un máximo de %{maximum} respuestas."
|
||||
read_more_about: "Leer más:"
|
||||
proposal_notifications:
|
||||
|
||||
@@ -10,6 +10,7 @@ es:
|
||||
poll_question_option: "Respuesta creada correctamente"
|
||||
poll_question_option_video: "Vídeo creado correctamente"
|
||||
poll_question_option_image: "Imagen cargada correctamente"
|
||||
poll_voter: "¡Gracias por votar!"
|
||||
proposal: "Propuesta creada correctamente."
|
||||
proposal_notification: "Tu mensaje ha sido enviado correctamente."
|
||||
budget_investment: "Proyecto de gasto creado correctamente."
|
||||
|
||||
@@ -2,9 +2,6 @@ resources :polls, only: [:show, :index] do
|
||||
member do
|
||||
get :stats
|
||||
get :results
|
||||
end
|
||||
|
||||
resources :questions, controller: "polls/questions", shallow: true, only: [] do
|
||||
resources :answers, controller: "polls/answers", only: [:create, :destroy], shallow: false
|
||||
post :answer
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user