From 1e0aec37abbeafdb074290dbc93f31aab4c16df8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Thu, 28 Sep 2017 17:37:31 +0200 Subject: [PATCH 01/16] Removed link to poll question in the web in admin section --- app/views/admin/poll/questions/show.html.erb | 2 -- 1 file changed, 2 deletions(-) diff --git a/app/views/admin/poll/questions/show.html.erb b/app/views/admin/poll/questions/show.html.erb index 3f776c5c0..360886b89 100644 --- a/app/views/admin/poll/questions/show.html.erb +++ b/app/views/admin/poll/questions/show.html.erb @@ -55,7 +55,5 @@ <%= @question.documents.first.title %>

<% end %> - - <%= link_to t("admin.questions.show.preview"), question_path(@question) %> From 14fe771fa55296f57e765653d28a358cafb781a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Thu, 28 Sep 2017 17:47:50 +0200 Subject: [PATCH 02/16] Fixed wrong officer action path Before this change, when a user searched for an officer already assigned the ui was blocked because that path wasn't correct. --- app/views/admin/poll/officers/_officer.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/admin/poll/officers/_officer.html.erb b/app/views/admin/poll/officers/_officer.html.erb index 80434f385..3562b4a90 100644 --- a/app/views/admin/poll/officers/_officer.html.erb +++ b/app/views/admin/poll/officers/_officer.html.erb @@ -16,7 +16,7 @@ <% if officer.persisted? %> <%= link_to t('admin.poll_officers.officer.delete'), - admin_poll_officer_path(officer), + admin_officer_path(officer), method: :delete, class: "button hollow alert" %> <% else %> From fd1d09c8c23efda9082057d02a5a10c41b85ad06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 2 Oct 2017 10:25:11 +0200 Subject: [PATCH 03/16] Booths and shifts index pages minor fixes Showing only actions to assign and edit shifits in shifts index, and option to create a new booth in booths index. --- app/views/admin/poll/booths/_booth.html.erb | 16 +++++++++------- app/views/admin/poll/booths/index.html.erb | 5 +++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/app/views/admin/poll/booths/_booth.html.erb b/app/views/admin/poll/booths/_booth.html.erb index 80b1ef38f..921361c4a 100644 --- a/app/views/admin/poll/booths/_booth.html.erb +++ b/app/views/admin/poll/booths/_booth.html.erb @@ -6,11 +6,13 @@ <%= booth.location %> - <%= link_to t("admin.booths.booth.shifts"), - new_admin_booth_shift_path(booth), - class: "button hollow" %> - <%= link_to t("admin.actions.edit"), - edit_admin_booth_path(booth), - class: "button hollow" %> + <% if controller_name == "shifts" || controller_name == "booths" && action_name == "available" %> + <%= link_to t("admin.booths.booth.shifts"), + new_admin_booth_shift_path(booth), + class: "button hollow" %> + <%= link_to t("admin.actions.edit"), + edit_admin_booth_path(booth), + class: "button hollow" %> + <% end %> - \ No newline at end of file + diff --git a/app/views/admin/poll/booths/index.html.erb b/app/views/admin/poll/booths/index.html.erb index 05044dd0e..95b248b3f 100644 --- a/app/views/admin/poll/booths/index.html.erb +++ b/app/views/admin/poll/booths/index.html.erb @@ -1,7 +1,8 @@

<%= t("admin.booths.index.title") %>

-<%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, - class: "button success float-right" %> +<% if controller_name == "booths" && action_name != "available" %> + <%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, class: "button success float-right" %> +<% end %> <% if @booths.empty? %>
From adf18ee75635928fce0b8f029b024aa9b160829f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 2 Oct 2017 10:37:10 +0200 Subject: [PATCH 04/16] Polls admin fixes Removed search from questions tab and unassign button. --- app/controllers/admin/poll/polls_controller.rb | 12 ------------ app/views/admin/poll/polls/_questions.html.erb | 4 ---- app/views/admin/poll/polls/show.html.erb | 1 - config/routes.rb | 1 - 4 files changed, 18 deletions(-) diff --git a/app/controllers/admin/poll/polls_controller.rb b/app/controllers/admin/poll/polls_controller.rb index c95c8ed1f..3b3c4f7bd 100644 --- a/app/controllers/admin/poll/polls_controller.rb +++ b/app/controllers/admin/poll/polls_controller.rb @@ -47,18 +47,6 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController redirect_to admin_poll_path(@poll), notice: notice end - def remove_question - question = ::Poll::Question.find(params[:question_id]) - - if @poll.questions.include? question - @poll.questions.delete(question) - notice = t("admin.polls.flash.question_removed") - else - notice = t("admin.polls.flash.error_on_question_removed") - end - redirect_to admin_poll_path(@poll), notice: notice - end - def search_questions @questions = ::Poll::Question.where("poll_id IS ? OR poll_id != ?", nil, @poll.id).search(search: @search).order(title: :asc) respond_to do |format| diff --git a/app/views/admin/poll/polls/_questions.html.erb b/app/views/admin/poll/polls/_questions.html.erb index e41d2017e..5088572e1 100644 --- a/app/views/admin/poll/polls/_questions.html.erb +++ b/app/views/admin/poll/polls/_questions.html.erb @@ -20,10 +20,6 @@ - <%= link_to t('admin.polls.show.remove_question'), - remove_question_admin_poll_path(poll_id: @poll.id, question_id: question.id), - class: "button hollow alert", - method: :patch %> <% end %> diff --git a/app/views/admin/poll/polls/show.html.erb b/app/views/admin/poll/polls/show.html.erb index 93ce52e47..be45eeb31 100644 --- a/app/views/admin/poll/polls/show.html.erb +++ b/app/views/admin/poll/polls/show.html.erb @@ -3,6 +3,5 @@
<%= render "subnav" %> - <%= render "search_questions" %> <%= render "questions" %>
diff --git a/config/routes.rb b/config/routes.rb index 410f2dced..d085acd2a 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -275,7 +275,6 @@ Rails.application.routes.draw do resources :polls do get :search_questions, on: :member patch :add_question, on: :member - patch :remove_question, on: :member resources :booth_assignments, only: [:index, :show, :create, :destroy] do get :search_booths, on: :collection From 2365ec96fa4c74e7a1dfeec9cf729f522b203f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 2 Oct 2017 10:41:48 +0200 Subject: [PATCH 05/16] Polls admin officers tab fixes Removed actions offered in search results. --- .../_search_officers_results.html.erb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/app/views/admin/poll/officer_assignments/_search_officers_results.html.erb b/app/views/admin/poll/officer_assignments/_search_officers_results.html.erb index f665c6c0b..ee009f1fa 100644 --- a/app/views/admin/poll/officer_assignments/_search_officers_results.html.erb +++ b/app/views/admin/poll/officer_assignments/_search_officers_results.html.erb @@ -12,29 +12,19 @@ <%= t("admin.poll_officer_assignments.index.table_name") %> <%= t("admin.poll_officer_assignments.index.table_email") %> - <%= t("admin.polls.show.table_assignment") %> <% @officers.each do |user| %> - <%= user.name %> + + <%= link_to user.name, by_officer_admin_poll_officer_assignments_path(@poll, officer_id: user.id) %> + <%= user.email %> - - <% if @poll.officer_ids.include?(user.poll_officer.id) %> - <%= link_to t("admin.poll_officer_assignments.index.edit_officer_assignments"), - by_officer_admin_poll_officer_assignments_path(@poll, officer_id: user.poll_officer.id), - class: "button hollow alert" %> - <% else %> - <%= link_to t("admin.poll_officer_assignments.index.add_officer_assignments"), - by_officer_admin_poll_officer_assignments_path(@poll, officer_id: user.poll_officer.id), - class: "button hollow" %> - <% end %> - <% end %> From 2c72a054acc2e9f27994b1ecc181c75b22298f6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 2 Oct 2017 11:04:37 +0200 Subject: [PATCH 06/16] Polls admin officer assignments fixes Removed total results table from officer assignment as now there are only final results. --- .../officer_assignments/by_officer.html.erb | 26 ------------------- 1 file changed, 26 deletions(-) diff --git a/app/views/admin/poll/officer_assignments/by_officer.html.erb b/app/views/admin/poll/officer_assignments/by_officer.html.erb index 6ea421e2d..c9873db96 100644 --- a/app/views/admin/poll/officer_assignments/by_officer.html.erb +++ b/app/views/admin/poll/officer_assignments/by_officer.html.erb @@ -27,30 +27,4 @@ <% end %> - -

<%= t("admin.poll_officer_assignments.by_officer.total_recounts") %>

- - - - - - - - - - <% @officer_assignments.each do |officer_assignment| %> - - - - - - <% end %> - -
<%= t("admin.poll_officer_assignments.by_officer.date") %><%= t("admin.poll_officer_assignments.by_officer.booth") %><%= t("admin.poll_officer_assignments.by_officer.total_recount") %>
<%= l(officer_assignment.date.to_date) %><%= booth_name_with_location(officer_assignment.booth_assignment.booth) %> - <% if officer_assignment.total_results.any? %> - <%= officer_assignment.total_results.to_a.sum(&:amount) %> - <% else %> - - - <% end %> -
<% end %> From 799e2475da66dfe90d93b2528572d01c1480e512 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 2 Oct 2017 11:08:18 +0200 Subject: [PATCH 07/16] Polls booth assignments fixes Poll booth preview now renders recounts tab by default instead of the officers one. --- app/views/admin/poll/booth_assignments/show.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/admin/poll/booth_assignments/show.html.erb b/app/views/admin/poll/booth_assignments/show.html.erb index f01270bd4..fd303d099 100644 --- a/app/views/admin/poll/booth_assignments/show.html.erb +++ b/app/views/admin/poll/booth_assignments/show.html.erb @@ -14,15 +14,15 @@
    -
  • +
  • <%= link_to t("admin.poll_booth_assignments.show.officers"), "#tab-officers" %>
  • -
  • +
  • <%= link_to t("admin.poll_booth_assignments.show.recounts"), "#tab-recounts" %>
-
+
<% if @booth_assignment.officers.empty? %>
<%= t("admin.poll_booth_assignments.show.no_officers") %> @@ -43,7 +43,7 @@ <% end %>
-
+

<%= t("admin.poll_booth_assignments.show.recounts_list") %>

From afbdd4889101595d14fa866e23fd5176363495e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 2 Oct 2017 16:11:17 +0200 Subject: [PATCH 08/16] Fixed tests --- config/locales/en/admin.yml | 8 ----- config/locales/es/admin.yml | 8 ----- spec/features/admin/poll/polls_spec.rb | 48 ------------------------- spec/features/admin/poll/shifts_spec.rb | 15 ++++---- 4 files changed, 9 insertions(+), 70 deletions(-) diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 0545e6af5..008f36f3e 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -489,15 +489,11 @@ en: no_officers: "There are no officers assigned to this poll." table_name: "Name" table_email: "Email" - add_officer_assignments: "Add shifts as officer" - edit_officer_assignments: "Edit officing shifts" by_officer: date: "Date" booth: "Booth" assignments: "Officing shifts in this poll" no_assignments: "This user has no officing shifts in this poll." - total_recounts: "Total recounts" - total_recount: "Total recount (by officer)" poll_shifts: new: add_shift: "Add shift" @@ -570,7 +566,6 @@ en: results_tab: Results no_questions: "There are no questions assigned to this poll." questions_title: "List of questions" - remove_question: "Remove question from poll" add_question: "Include question" table_title: "Title" table_assignment: "Assignment" @@ -578,8 +573,6 @@ en: flash: question_added: "Question added to this poll" error_on_question_added: "Question could not be assigned to this poll" - question_removed: "Question removed from this poll" - error_on_question_removed: "Question could not be removed from this poll" questions: index: title: "Questions" @@ -606,7 +599,6 @@ en: description: Description video_url: External video documents: Documents (1) - preview: View on website recounts: index: title: "Recounts" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 816cadd57..4a4616338 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -489,15 +489,11 @@ es: no_officers: "No hay presidentes de mesa asignados a esta votación." table_name: "Nombre" table_email: "Email" - add_officer_assignments: "Añadir turnos como presidente de mesa" - edit_officer_assignments: "Editar turnos" by_officer: date: "Fecha" booth: "Urna" assignments: "Turnos como presidente de mesa en esta votación" no_assignments: "No tiene turnos como presidente de mesa en esta votación." - total_recounts: "Recuentos totales" - total_recount: "Recuento total (presidente de mesa)" poll_shifts: new: add_shift: "Añadir turno" @@ -570,7 +566,6 @@ es: results_tab: Resultados no_questions: "No hay preguntas asignadas a esta votación." questions_title: "Listado de preguntas asignadas" - remove_question: "Desasignar pregunta" add_question: "Incluir pregunta" table_title: "Título" table_assignment: "Asignación" @@ -578,8 +573,6 @@ es: flash: question_added: "Pregunta añadida a esta votación" error_on_question_added: "No se pudo asignar la pregunta" - question_removed: "Pregunta eliminada de esta votación" - error_on_question_removed: "No se pudo quitar la pregunta" questions: index: title: "Preguntas ciudadanas" @@ -606,7 +599,6 @@ es: description: Descripción video_url: Video externo documents: Documentos (1) - preview: Ver en la web recounts: index: title: "Recuentos" diff --git a/spec/features/admin/poll/polls_spec.rb b/spec/features/admin/poll/polls_spec.rb index 6eb64f6e1..153f0885a 100644 --- a/spec/features/admin/poll/polls_spec.rb +++ b/spec/features/admin/poll/polls_spec.rb @@ -181,54 +181,6 @@ feature 'Admin polls' do expect(page).to_not have_content "There are no questions assigned to this poll" end - scenario 'Add question to poll', :js do - poll = create(:poll) - question = create(:poll_question, title: 'Should we rebuild the city?') - - visit admin_poll_path(poll) - - expect(page).to have_content 'Questions (0)' - expect(page).to have_content 'There are no questions assigned to this poll' - - fill_in 'search-questions', with: 'rebuild' - click_button 'Search' - - within('#search-questions-results') do - click_link 'Include question' - end - - expect(page).to have_content 'Question added to this poll' - - visit admin_poll_path(poll) - - expect(page).to have_content 'Questions (1)' - expect(page).to_not have_content 'There are no questions assigned to this poll' - expect(page).to have_content question.title - end - - scenario 'Remove question from poll', :js do - poll = create(:poll) - question = create(:poll_question, poll: poll) - - visit admin_poll_path(poll) - - expect(page).to have_content 'Questions (1)' - expect(page).to_not have_content 'There are no questions assigned to this poll' - expect(page).to have_content question.title - - within("#poll_question_#{question.id}") do - click_link 'Remove question from poll' - end - - expect(page).to have_content 'Question removed from this poll' - - visit admin_poll_path(poll) - - expect(page).to have_content 'Questions (0)' - expect(page).to have_content 'There are no questions assigned to this poll' - expect(page).to_not have_content question.title - end - end end diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb index 46c737c64..9dea5f8d1 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -31,13 +31,14 @@ feature 'Admin shifts' do end scenario "Create Vote Collection Shift", :js do - poll = create(:poll) + poll = create(:poll, :current) vote_collection_dates = (poll.starts_at.to_date..poll.ends_at.to_date).to_a.map { |date| I18n.l(date, format: :long) } booth = create(:poll_booth) + assignment = create(:poll_booth_assignment, poll: poll, booth: booth) officer = create(:poll_officer) - visit admin_booths_path + visit available_admin_booths_path within("#booth_#{booth.id}") do click_link "Manage shifts" @@ -63,13 +64,14 @@ feature 'Admin shifts' do end scenario "Create Recount & Scrutiny Shift", :js do - poll = create(:poll) + poll = create(:poll, :current) recount_scrutiny_dates = (poll.ends_at.to_date..poll.ends_at.to_date + 1.week).to_a.map { |date| I18n.l(date, format: :long) } booth = create(:poll_booth) + assignment = create(:poll_booth_assignment, poll: poll, booth: booth) officer = create(:poll_officer) - visit admin_booths_path + visit available_admin_booths_path within("#booth_#{booth.id}") do click_link "Manage shifts" @@ -97,11 +99,12 @@ feature 'Admin shifts' do end scenario "Error on create", :js do - poll = create(:poll) + poll = create(:poll, :current) booth = create(:poll_booth) + assignment = create(:poll_booth_assignment, poll: poll, booth: booth) officer = create(:poll_officer) - visit admin_booths_path + visit available_admin_booths_path within("#booth_#{booth.id}") do click_link "Manage shifts" From c0dcedcd0fcbda471ab87c36e9cf04716249ca62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 2 Oct 2017 16:39:09 +0200 Subject: [PATCH 09/16] Tests fix --- spec/features/admin/poll/shifts_spec.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/features/admin/poll/shifts_spec.rb b/spec/features/admin/poll/shifts_spec.rb index 9dea5f8d1..ceccc1867 100644 --- a/spec/features/admin/poll/shifts_spec.rb +++ b/spec/features/admin/poll/shifts_spec.rb @@ -119,13 +119,14 @@ feature 'Admin shifts' do end scenario "Destroy" do - poll = create(:poll) + poll = create(:poll, :current) booth = create(:poll_booth) + assignment = create(:poll_booth_assignment, poll: poll, booth: booth) officer = create(:poll_officer) shift = create(:poll_shift, officer: officer, booth: booth) - visit admin_booths_path + visit available_admin_booths_path within("#booth_#{booth.id}") do click_link "Manage shifts" From e464985114c7e351ec1db79246d46c31df685f71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Mon, 2 Oct 2017 20:34:38 +0200 Subject: [PATCH 10/16] Minor fix Removed unnecessary markdown --- app/views/admin/poll/polls/_questions.html.erb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/views/admin/poll/polls/_questions.html.erb b/app/views/admin/poll/polls/_questions.html.erb index 5088572e1..fb92a4e43 100644 --- a/app/views/admin/poll/polls/_questions.html.erb +++ b/app/views/admin/poll/polls/_questions.html.erb @@ -9,7 +9,6 @@ - <% @poll.questions.each do |question| %> @@ -19,8 +18,6 @@ <%= link_to question.title, admin_question_path(question) %> - <% end %>
<%= t('admin.polls.show.table_title') %><%= t('admin.polls.show.table_assignment') %>
-
From 9ae72387fe9feba12de561238ef4fc9fa9b79eb0 Mon Sep 17 00:00:00 2001 From: Bertocq Date: Mon, 2 Oct 2017 23:29:57 +0200 Subject: [PATCH 11/16] Remove remove_question ability from admin on Poll --- app/models/abilities/administrator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb index 4278d4f8d..2d1a0ee22 100644 --- a/app/models/abilities/administrator.rb +++ b/app/models/abilities/administrator.rb @@ -56,7 +56,7 @@ module Abilities can [:index, :create, :edit, :update, :destroy], Geozone - can [:read, :create, :update, :destroy, :add_question, :remove_question, :search_booths, :search_questions, :search_officers], Poll + can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_questions, :search_officers], Poll can [:read, :create, :update, :destroy, :available], Poll::Booth can [:search, :create, :index, :destroy], ::Poll::Officer can [:create, :destroy], ::Poll::BoothAssignment From bf61dffd4b354e3b0d8fe016265e652151e2ef8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Tue, 3 Oct 2017 10:47:48 +0200 Subject: [PATCH 12/16] Removed files that are not used --- .../admin/poll/polls_controller.rb | 9 +---- .../poll/polls/_search_questions.html.erb | 17 ---------- .../polls/_search_questions_results.html.erb | 33 ------------------- .../admin/poll/polls/search_questions.js.erb | 1 - 4 files changed, 1 insertion(+), 59 deletions(-) delete mode 100644 app/views/admin/poll/polls/_search_questions.html.erb delete mode 100644 app/views/admin/poll/polls/_search_questions_results.html.erb delete mode 100644 app/views/admin/poll/polls/search_questions.js.erb diff --git a/app/controllers/admin/poll/polls_controller.rb b/app/controllers/admin/poll/polls_controller.rb index 3b3c4f7bd..fb4b4d127 100644 --- a/app/controllers/admin/poll/polls_controller.rb +++ b/app/controllers/admin/poll/polls_controller.rb @@ -1,7 +1,7 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController load_and_authorize_resource - before_action :load_search, only: [:search_booths, :search_questions, :search_officers] + before_action :load_search, only: [:search_booths, :search_officers] before_action :load_geozones, only: [:new, :create, :edit, :update] def index @@ -47,13 +47,6 @@ class Admin::Poll::PollsController < Admin::Poll::BaseController redirect_to admin_poll_path(@poll), notice: notice end - def search_questions - @questions = ::Poll::Question.where("poll_id IS ? OR poll_id != ?", nil, @poll.id).search(search: @search).order(title: :asc) - respond_to do |format| - format.js - end - end - private def load_geozones diff --git a/app/views/admin/poll/polls/_search_questions.html.erb b/app/views/admin/poll/polls/_search_questions.html.erb deleted file mode 100644 index 659cdcd37..000000000 --- a/app/views/admin/poll/polls/_search_questions.html.erb +++ /dev/null @@ -1,17 +0,0 @@ -
-
- <%= form_tag(search_questions_admin_poll_path(@poll), method: :get, remote: true) do |f| %> -
- <%= text_field_tag :search, - @search, - placeholder: t("admin.shared.poll_questions_search.placeholder"), id: "search-questions" %> - -
- <%= submit_tag t("admin.shared.poll_questions_search.button"), class: "button" %> -
-
- <% end %> -
-
- -
diff --git a/app/views/admin/poll/polls/_search_questions_results.html.erb b/app/views/admin/poll/polls/_search_questions_results.html.erb deleted file mode 100644 index f6f11e1f1..000000000 --- a/app/views/admin/poll/polls/_search_questions_results.html.erb +++ /dev/null @@ -1,33 +0,0 @@ -<% if @questions.blank? %> -
- <%= t('admin.shared.no_search_results') %> -
-<% else %> -

<%= t('admin.shared.search_results') %>

-<% end %> - -<% if @questions.any? %> - - - - - - - - - <% @questions.each do |question| %> - - - - - <% end %> - -
<%= t("admin.polls.show.table_name") %><%= t("admin.polls.show.table_assignment") %>
- <%= question.title %> - - <%= link_to t("admin.polls.show.add_question"), - add_question_admin_poll_path(poll_id: @poll.id, question_id: question.id), - method: :patch, - class: "button hollow" %> -
-<% end %> diff --git a/app/views/admin/poll/polls/search_questions.js.erb b/app/views/admin/poll/polls/search_questions.js.erb deleted file mode 100644 index 05f5c5167..000000000 --- a/app/views/admin/poll/polls/search_questions.js.erb +++ /dev/null @@ -1 +0,0 @@ -$("#search-questions-results").html("<%= j render 'search_questions_results' %>"); \ No newline at end of file From e6b5de77fe8889e9d8a9f18c6b1e55b0e4a58f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Tue, 3 Oct 2017 10:50:18 +0200 Subject: [PATCH 13/16] Removed files that are not being used --- app/models/abilities/administrator.rb | 2 +- config/routes.rb | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/models/abilities/administrator.rb b/app/models/abilities/administrator.rb index 2d1a0ee22..bfccc5d52 100644 --- a/app/models/abilities/administrator.rb +++ b/app/models/abilities/administrator.rb @@ -56,7 +56,7 @@ module Abilities can [:index, :create, :edit, :update, :destroy], Geozone - can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_questions, :search_officers], Poll + can [:read, :create, :update, :destroy, :add_question, :search_booths, :search_officers], Poll can [:read, :create, :update, :destroy, :available], Poll::Booth can [:search, :create, :index, :destroy], ::Poll::Officer can [:create, :destroy], ::Poll::BoothAssignment diff --git a/config/routes.rb b/config/routes.rb index d085acd2a..51e1f351d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -273,7 +273,6 @@ Rails.application.routes.draw do scope module: :poll do resources :polls do - get :search_questions, on: :member patch :add_question, on: :member resources :booth_assignments, only: [:index, :show, :create, :destroy] do From 1afd97b6875dfe16e6af4d053d4ec6f566438c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Tue, 3 Oct 2017 12:09:02 +0200 Subject: [PATCH 14/16] Removed unnused translations --- config/locales/en/admin.yml | 3 --- config/locales/es/admin.yml | 3 --- 2 files changed, 6 deletions(-) diff --git a/config/locales/en/admin.yml b/config/locales/en/admin.yml index 008f36f3e..a3751615a 100644 --- a/config/locales/en/admin.yml +++ b/config/locales/en/admin.yml @@ -566,10 +566,7 @@ en: results_tab: Results no_questions: "There are no questions assigned to this poll." questions_title: "List of questions" - add_question: "Include question" table_title: "Title" - table_assignment: "Assignment" - table_name: "Name" flash: question_added: "Question added to this poll" error_on_question_added: "Question could not be assigned to this poll" diff --git a/config/locales/es/admin.yml b/config/locales/es/admin.yml index 4a4616338..f95c2d39f 100644 --- a/config/locales/es/admin.yml +++ b/config/locales/es/admin.yml @@ -566,10 +566,7 @@ es: results_tab: Resultados no_questions: "No hay preguntas asignadas a esta votación." questions_title: "Listado de preguntas asignadas" - add_question: "Incluir pregunta" table_title: "Título" - table_assignment: "Asignación" - table_name: "Nombre" flash: question_added: "Pregunta añadida a esta votación" error_on_question_added: "No se pudo asignar la pregunta" From 2cb620296bdcf241610381511c563fdf4b871396 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Tue, 3 Oct 2017 15:49:03 +0200 Subject: [PATCH 15/16] Fixed test --- spec/features/admin/poll/booths_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/features/admin/poll/booths_spec.rb b/spec/features/admin/poll/booths_spec.rb index 13f3af2ff..22b77b397 100644 --- a/spec/features/admin/poll/booths_spec.rb +++ b/spec/features/admin/poll/booths_spec.rb @@ -87,9 +87,11 @@ feature 'Admin booths' do end scenario "Edit" do + poll = create(:poll, :current) booth = create(:poll_booth) + assignment = create(:poll_booth_assignment, poll: poll, booth: booth) - visit admin_booths_path + visit available_admin_booths_path within("#booth_#{booth.id}") do click_link "Edit" @@ -109,4 +111,4 @@ feature 'Admin booths' do end end -end \ No newline at end of file +end From 080064ed46cb9c950ee68bbbd93def5cd5cc1488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mar=C3=ADa=20Checa?= Date: Tue, 3 Oct 2017 16:48:21 +0200 Subject: [PATCH 16/16] Updated schema.rb --- db/schema.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/db/schema.rb b/db/schema.rb index e859a487f..e75c2aac3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20171002122312) do +ActiveRecord::Schema.define(version: 20171003095936) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -639,7 +639,6 @@ ActiveRecord::Schema.define(version: 20171002122312) do end add_index "poll_officer_assignments", ["booth_assignment_id"], name: "index_poll_officer_assignments_on_booth_assignment_id", using: :btree - add_index "poll_officer_assignments", ["officer_id", "date"], name: "index_poll_officer_assignments_on_officer_id_and_date", using: :btree add_index "poll_officer_assignments", ["officer_id"], name: "index_poll_officer_assignments_on_officer_id", using: :btree create_table "poll_officers", force: :cascade do |t| @@ -698,11 +697,11 @@ ActiveRecord::Schema.define(version: 20171002122312) do t.integer "officer_assignment_id" t.text "officer_assignment_id_log", default: "" t.text "author_id_log", default: "" - t.integer "white_amount" + t.integer "white_amount", default: 0 t.text "white_amount_log", default: "" - t.integer "null_amount" + t.integer "null_amount", default: 0 t.text "null_amount_log", default: "" - t.integer "total_amount" + t.integer "total_amount", default: 0 t.text "total_amount_log", default: "" end @@ -720,9 +719,10 @@ ActiveRecord::Schema.define(version: 20171002122312) do t.integer "task", default: 0, null: false end - add_index "poll_shifts", ["booth_id", "officer_id"], name: "index_poll_shifts_on_booth_id_and_officer_id", using: :btree + add_index "poll_shifts", ["booth_id", "officer_id", "task"], name: "index_poll_shifts_on_booth_id_and_officer_id_and_task", unique: true, using: :btree add_index "poll_shifts", ["booth_id"], name: "index_poll_shifts_on_booth_id", using: :btree add_index "poll_shifts", ["officer_id"], name: "index_poll_shifts_on_officer_id", using: :btree + add_index "poll_shifts", ["task"], name: "index_poll_shifts_on_task", using: :btree create_table "poll_total_results", force: :cascade do |t| t.integer "author_id" @@ -752,6 +752,7 @@ ActiveRecord::Schema.define(version: 20171002122312) do t.integer "answer_id" t.integer "officer_assignment_id" t.integer "user_id" + t.string "origin" end add_index "poll_voters", ["booth_assignment_id"], name: "index_poll_voters_on_booth_assignment_id", using: :btree