diff --git a/app/components/officing/results/index_component.html.erb b/app/components/officing/results/index_component.html.erb new file mode 100644 index 000000000..046f2319d --- /dev/null +++ b/app/components/officing/results/index_component.html.erb @@ -0,0 +1,41 @@ +<% provide :main_class, "officing-results-index" %> + +<%= back_link_to new_officing_poll_result_path(poll) %> +

<%= poll.name %> - <%= t("officing.results.index.results") %>

+ +<% if partial_results.present? %> +
+

+ <%= booth_assignment.booth.name %> - <%= l partial_results.first.date, format: :long %> +

+
+ +
+
+ + + + + + + + + + + + + + + +
<%= t("officing.results.index.table_whites") %><%= t("officing.results.index.table_nulls") %><%= t("officing.results.index.table_total") %>
<%= recounts.sum(:white_amount) %><%= recounts.sum(:null_amount) %><%= recounts.sum(:total_amount) %>
+ + <% @poll.questions.each do |question| %> + <%= render Admin::Poll::Results::QuestionComponent.new(question, @partial_results) %> + <% end %> +
+
+<% else %> +
+ <%= t("officing.results.index.no_results") %> +
+<% end %> diff --git a/app/components/officing/results/index_component.rb b/app/components/officing/results/index_component.rb new file mode 100644 index 000000000..e4e86a9fe --- /dev/null +++ b/app/components/officing/results/index_component.rb @@ -0,0 +1,10 @@ +class Officing::Results::IndexComponent < ApplicationComponent + attr_reader :poll, :partial_results, :booth_assignment, :recounts + + def initialize(poll, partial_results, booth_assignment, recounts) + @poll = poll + @partial_results = partial_results + @booth_assignment = booth_assignment + @recounts = recounts + end +end diff --git a/app/views/officing/results/index.html.erb b/app/views/officing/results/index.html.erb index 9b0d330c5..946c5611d 100644 --- a/app/views/officing/results/index.html.erb +++ b/app/views/officing/results/index.html.erb @@ -1,39 +1 @@ -<%= back_link_to new_officing_poll_result_path(@poll) %> -

<%= @poll.name %> - <%= t("officing.results.index.results") %>

- -<% if @partial_results.present? %> -
-

- <%= @booth_assignment.booth.name %> - <%= l @partial_results.first.date, format: :long %> -

-
- -
-
- - - - - - - - - - - - - - - -
<%= t("officing.results.index.table_whites") %><%= t("officing.results.index.table_nulls") %><%= t("officing.results.index.table_total") %>
<%= @recounts.sum(:white_amount) %><%= @recounts.sum(:null_amount) %><%= @recounts.sum(:total_amount) %>
- - <% @poll.questions.each do |question| %> - <%= render Admin::Poll::Results::QuestionComponent.new(question, @partial_results) %> - <% end %> -
-
-<% else %> -
- <%= t("officing.results.index.no_results") %> -
-<% end %> +<%= render Officing::Results::IndexComponent.new(@poll, @partial_results, @booth_assignment, @recounts) %>