- <%= f.fields_for :question_options do |ff| %>
- <%= render "question_option_fields", f: ff %>
- <% end %>
+
+ <%= f.fields_for :question_options do |ff| %>
+ <%= render "question_option_fields", f: ff %>
+ <% end %>
-
-
- <%= link_to_add_association t("admin.legislation.questions.form.add_option"),
- f,
- :question_options,
- class: "button hollow" %>
+
+
+ <%= link_to_add_association t("admin.legislation.questions.form.add_option"),
+ f,
+ :question_options,
+ class: "button hollow" %>
+
-
+
<%= f.submit(class: "button success expanded", value: t("admin.legislation.questions.#{admin_submit_action(@question)}.submit_button")) %>
diff --git a/app/views/admin/legislation/questions/_question_option_fields.html.erb b/app/views/admin/legislation/questions/_question_option_fields.html.erb
index c610c298c..6e6b3080c 100644
--- a/app/views/admin/legislation/questions/_question_option_fields.html.erb
+++ b/app/views/admin/legislation/questions/_question_option_fields.html.erb
@@ -3,8 +3,7 @@
<%= f.translatable_fields do |translations_form| %>
<%= translations_form.text_field :value,
- placeholder: t("admin.legislation.questions.form.value_placeholder"),
- label: false %>
+ label: t("admin.legislation.questions.form.value_placeholder") %>
<% end %>
diff --git a/app/views/officing/results/new.html.erb b/app/views/officing/results/new.html.erb
index c53ff92d5..c1b6c43b3 100644
--- a/app/views/officing/results/new.html.erb
+++ b/app/views/officing/results/new.html.erb
@@ -1,56 +1,6 @@
<% if @officer_assignments.any? %>
<%= t("officing.results.new.title", poll: @poll.name) %>
-
- <%= form_tag(officing_poll_results_path(@poll), { id: "officer_assignment_form" }) do %>
-
-
- <%= label_tag :officer_assignment_id, t("officing.results.new.booth") %>
- <%= select_tag :officer_assignment_id,
- booths_for_officer_select_options(@officer_assignments),
- { prompt: t("officing.results.new.select_booth") } %>
-
-
-
- <% @poll.questions.each do |question| %>
-
-
-
<%= question.title %>
-
- <% question.question_options.each_with_index do |option, i| %>
-
-
- <%= text_field_tag "questions[#{question.id}][#{i}]", answer_result_value(question.id, i), placeholder: "0" %>
-
- <% end %>
-
-
- <% end %>
-
-
-
-
<%= t("officing.results.new.ballots_white") %>
- <%= text_field_tag :whites, params[:whites].presence, placeholder: "0" %>
-
-
-
-
<%= t("officing.results.new.ballots_null") %>
- <%= text_field_tag :nulls, params[:nulls].presence, placeholder: "0" %>
-
-
-
-
<%= t("officing.results.new.ballots_total") %>
- <%= text_field_tag :total, params[:total].presence, placeholder: "0" %>
-
-
-
-
-
-
- <%= submit_tag t("officing.results.new.submit"), class: "button expanded" %>
-
-
- <% end %>
-
+ <%= render Officing::Results::FormComponent.new(@poll, @officer_assignments) %>
<% else %>
<%= @poll.name %>
diff --git a/app/views/proposals/retire_form.html.erb b/app/views/proposals/retire_form.html.erb
index fef9e5c6d..641028774 100644
--- a/app/views/proposals/retire_form.html.erb
+++ b/app/views/proposals/retire_form.html.erb
@@ -28,7 +28,7 @@
<%= translations_form.text_area :retired_explanation,
rows: 4,
maxlength: 500,
- placeholder: t("proposals.retire_form.retired_explanation_placeholder") %>
+ hint: t("proposals.retire_form.retired_explanation_placeholder") %>
<% end %>
diff --git a/config/locales/en/documents.yml b/config/locales/en/documents.yml
index d60fd5c9d..5630b10a3 100644
--- a/config/locales/en/documents.yml
+++ b/config/locales/en/documents.yml
@@ -5,7 +5,6 @@ en:
additional: Additional documentation
form:
title: Documents
- title_placeholder: Add a descriptive title for the document
delete_button: Remove document
cancel_button: Cancel
note: "You can upload up to a maximum of %{max_documents_allowed} documents of following content types: %{accepted_content_types}, up to %{max_file_size} MB per file."
diff --git a/config/locales/en/images.yml b/config/locales/en/images.yml
index 155056604..93a74fc50 100644
--- a/config/locales/en/images.yml
+++ b/config/locales/en/images.yml
@@ -3,7 +3,6 @@ en:
remove_image: Remove image
form:
title: Descriptive image
- title_placeholder: Add a descriptive title for the image
delete_button: Remove image
note: "You can upload one image of following content types: %{accepted_content_types}, up to %{max_file_size} MB."
add_new_image: Add image
diff --git a/config/locales/es/documents.yml b/config/locales/es/documents.yml
index 88121ace3..afa9fb542 100644
--- a/config/locales/es/documents.yml
+++ b/config/locales/es/documents.yml
@@ -5,7 +5,6 @@ es:
additional: Documentación adicional
form:
title: Documentos
- title_placeholder: Añade un título descriptivo para el documento
delete_button: Eliminar documento
cancel_button: Cancelar
note: "Puedes subir hasta un máximo de %{max_documents_allowed} documentos en los formatos: %{accepted_content_types}, y de hasta %{max_file_size} MB por archivo."
diff --git a/config/locales/es/images.yml b/config/locales/es/images.yml
index ed197fa7d..32e5cb5a4 100644
--- a/config/locales/es/images.yml
+++ b/config/locales/es/images.yml
@@ -3,7 +3,6 @@ es:
remove_image: Eliminar imagen
form:
title: Imagen descriptiva
- title_placeholder: Añade un título descriptivo para la imagen
delete_button: Eliminar imagen
note: "Puedes subir una imagen en los formatos: %{accepted_content_types}, y de hasta %{max_file_size} MB por archivo."
add_new_image: Añadir imagen
diff --git a/spec/components/officing/results/form_component_spec.rb b/spec/components/officing/results/form_component_spec.rb
new file mode 100644
index 000000000..81f19e38e
--- /dev/null
+++ b/spec/components/officing/results/form_component_spec.rb
@@ -0,0 +1,19 @@
+require "rails_helper"
+
+describe Officing::Results::FormComponent do
+ let(:poll) { create(:poll, ends_at: 1.day.ago) }
+ before { create(:poll_question, :yes_no, poll: poll, title: "Agreed?") }
+
+ it "uses number fields with 0 as a default value" do
+ render_inline Officing::Results::FormComponent.new(poll, Poll::OfficerAssignment.none)
+
+ page.find(:fieldset, "Agreed?") do |fieldset|
+ expect(fieldset).to have_field "Yes", with: 0, type: :number
+ expect(fieldset).to have_field "No", with: 0, type: :number
+ end
+
+ expect(page).to have_field "Totally blank ballots", with: 0, type: :number
+ expect(page).to have_field "Invalid ballots", with: 0, type: :number
+ expect(page).to have_field "Valid ballots", with: 0, type: :number
+ end
+end
diff --git a/spec/system/admin/legislation/questions_spec.rb b/spec/system/admin/legislation/questions_spec.rb
index 0573c7dcd..ad0376280 100644
--- a/spec/system/admin/legislation/questions_spec.rb
+++ b/spec/system/admin/legislation/questions_spec.rb
@@ -107,7 +107,7 @@ describe "Admin legislation questions", :admin do
create(:legislation_question_option, question: question, value: "Original")
visit edit_question_url
- find("#nested_question_options input").set("Changed")
+ fill_in "Add a closed answer", with: "Changed"
click_button "Save changes"
expect(page).to have_content "Question updated successfully"
@@ -154,11 +154,11 @@ describe "Admin legislation questions", :admin do
click_link "Add option"
- find("#nested_question_options input").set("Option 1")
+ fill_in "Add a closed answer", with: "Option 1"
select "Español", from: "Current language"
- find("#nested_question_options input").set("Opción 1")
+ fill_in "Add a closed answer", with: "Opción 1"
click_button "Save changes"
@@ -180,11 +180,11 @@ describe "Admin legislation questions", :admin do
click_link "Add option"
- find("#nested_question_options input").set("Opción 1")
+ fill_in "Add a closed answer", with: "Opción 1"
select "English", from: "Current language"
- find("#nested_question_options input").set("Option 1")
+ fill_in "Add a closed answer", with: "Option 1"
click_button "Save changes"
diff --git a/spec/system/officing/results_spec.rb b/spec/system/officing/results_spec.rb
index 59abe9497..9eb49ad59 100644
--- a/spec/system/officing/results_spec.rb
+++ b/spec/system/officing/results_spec.rb
@@ -59,15 +59,19 @@ describe "Officing Results", :with_frozen_time do
select booth.name, from: "Booth"
- fill_in "questions[#{question_1.id}][0]", with: "100"
- fill_in "questions[#{question_1.id}][1]", with: "200"
+ within_fieldset question_1.title do
+ fill_in "Yes", with: "100"
+ fill_in "No", with: "200"
+ end
- fill_in "questions[#{question_2.id}][0]", with: "333"
- fill_in "questions[#{question_2.id}][1]", with: "444"
+ within_fieldset question_2.title do
+ fill_in "Today", with: "333"
+ fill_in "Tomorrow", with: "444"
+ end
- fill_in "whites", with: "66"
- fill_in "nulls", with: "77"
- fill_in "total", with: "88"
+ fill_in "Totally blank ballots", with: "66"
+ fill_in "Invalid ballots", with: "77"
+ fill_in "Valid ballots", with: "88"
click_button "Save"
@@ -102,11 +106,14 @@ describe "Officing Results", :with_frozen_time do
booth_name = partial_result.booth_assignment.booth.name
select booth_name, from: "Booth"
- fill_in "questions[#{question_1.id}][0]", with: "5555"
- fill_in "questions[#{question_1.id}][1]", with: "200"
- fill_in "whites", with: "6"
- fill_in "nulls", with: "7"
- fill_in "total", with: "8"
+ within_fieldset question_1.title do
+ fill_in "Yes", with: "5555"
+ fill_in "No", with: "200"
+ end
+
+ fill_in "Totally blank ballots", with: "6"
+ fill_in "Invalid ballots", with: "7"
+ fill_in "Valid ballots", with: "8"
click_button "Save"