diff --git a/app/controllers/admin/poll/officers_controller.rb b/app/controllers/admin/poll/officers_controller.rb index 7f6f918d7..2641a12b5 100644 --- a/app/controllers/admin/poll/officers_controller.rb +++ b/app/controllers/admin/poll/officers_controller.rb @@ -22,12 +22,12 @@ class Admin::Poll::OfficersController < Admin::BaseController @officer.user_id = params[:user_id] @officer.save - redirect_to admin_poll_officers_path + redirect_to admin_officers_path end def destroy @officer.destroy - redirect_to admin_poll_officers_path + redirect_to admin_officers_path end def show diff --git a/app/views/admin/_menu.html.erb b/app/views/admin/_menu.html.erb index 48736c378..0661a3bb6 100644 --- a/app/views/admin/_menu.html.erb +++ b/app/views/admin/_menu.html.erb @@ -84,7 +84,7 @@
  • > - <%= link_to admin_poll_officers_path(Poll.last) do %> + <%= link_to admin_officers_path do %> <%= t('admin.menu.poll_officers') %> <% end %>
  • @@ -95,11 +95,13 @@ <% end %> -
  • > - <%= link_to admin_poll_booths_url(Poll.last) do %> - <%= t('admin.menu.booths') %> - <% end %> -
  • + <% if Poll.any? %> +
  • > + <%= link_to admin_poll_booths_url(Poll.last) do %> + <%= t('admin.menu.booths') %> + <% end %> +
  • + <% end %>
  • > <%= link_to admin_activity_path do %> diff --git a/app/views/admin/poll/officers/index.html.erb b/app/views/admin/poll/officers/index.html.erb index 56daabb94..cc6393204 100644 --- a/app/views/admin/poll/officers/index.html.erb +++ b/app/views/admin/poll/officers/index.html.erb @@ -1,7 +1,7 @@

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

    - <%= form_tag search_admin_poll_officers_path, method: :get, remote: true do %> + <%= form_tag search_admin_officers_path, method: :get, remote: true do %>
    <%= text_field_tag :email, '', placeholder: t('admin.poll_officers.search.email_placeholder') %>
    @@ -27,7 +27,7 @@ <% if officer.persisted? %> <%= link_to t('admin.poll_officers.officer.delete'), - admin_poll_officer_path(Poll.last, officer), + admin_officer_path(officer), method: :delete, class: "button hollow alert" %> diff --git a/config/routes.rb b/config/routes.rb index befbda11e..070823d63 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -178,11 +178,11 @@ Rails.application.routes.draw do end scope module: 'poll' do + resources :officers do + get :search, on: :collection + end resources :polls do resources :booths - resources :officers do - get :search, on: :collection - end end end