From 0bd87c7e4352ce3664abf355c146a45d979ebccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Tue, 14 Feb 2017 14:26:46 +0100 Subject: [PATCH] extracts results from admin's poll/show --- .../admin/poll/results_controller.rb | 13 +++++ app/helpers/admin_helper.rb | 2 +- app/views/admin/_menu.html.erb | 2 +- .../admin/poll/polls/_filter_subnav.html.erb | 2 +- app/views/admin/poll/polls/_results.html.erb | 45 ----------------- app/views/admin/poll/polls/show.html.erb | 4 -- app/views/admin/poll/results/index.html.erb | 50 +++++++++++++++++++ config/locales/admin.en.yml | 14 +++--- config/locales/admin.es.yml | 14 +++--- config/routes.rb | 1 + .../admin/poll/officer_assignments_spec.rb | 4 +- 11 files changed, 85 insertions(+), 66 deletions(-) create mode 100644 app/controllers/admin/poll/results_controller.rb delete mode 100644 app/views/admin/poll/polls/_results.html.erb create mode 100644 app/views/admin/poll/results/index.html.erb diff --git a/app/controllers/admin/poll/results_controller.rb b/app/controllers/admin/poll/results_controller.rb new file mode 100644 index 000000000..2c5bbba27 --- /dev/null +++ b/app/controllers/admin/poll/results_controller.rb @@ -0,0 +1,13 @@ +class Admin::Poll::ResultsController < Admin::BaseController + before_action :load_poll + + def index + @partial_results = @poll.partial_results + end + + private + + def load_poll + @poll = ::Poll.includes(:questions).find(params[:poll_id]) + end +end \ No newline at end of file diff --git a/app/helpers/admin_helper.rb b/app/helpers/admin_helper.rb index fdf158550..3f0d4db4b 100644 --- a/app/helpers/admin_helper.rb +++ b/app/helpers/admin_helper.rb @@ -25,7 +25,7 @@ module AdminHelper end def menu_polls? - ["polls", "questions", "officers", "booths", "officer_assignments", "booth_assignments", "recounts"].include? controller_name + ["polls", "questions", "officers", "booths", "officer_assignments", "booth_assignments", "recounts", "results"].include? controller_name end def menu_profiles? diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index 77d84a3a3..d30ac954c 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -61,7 +61,7 @@ <%= t("admin.menu.title_polls") %>