diff --git a/app/controllers/admin/poll/questions_controller.rb b/app/controllers/admin/poll/questions_controller.rb index c6d147af0..f17ac5c9c 100644 --- a/app/controllers/admin/poll/questions_controller.rb +++ b/app/controllers/admin/poll/questions_controller.rb @@ -7,8 +7,6 @@ class Admin::Poll::QuestionsController < Admin::Poll::BaseController def index @polls = Poll.not_budget - @search = search_params[:search] - @questions = @questions.search(search_params).page(params[:page]).order("created_at DESC") @proposals = Proposal.successful.sort_by_confidence_score diff --git a/app/views/admin/debates/index.html.erb b/app/views/admin/debates/index.html.erb index 117c9f9f8..bac99fdde 100644 --- a/app/views/admin/debates/index.html.erb +++ b/app/views/admin/debates/index.html.erb @@ -5,7 +5,10 @@

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

<% if @debates.any? %> - <%= render "/admin/shared/debate_search", url: admin_debates_path %> + <%= render Admin::SearchComponent.new( + url: admin_debates_path, + label: t("admin.shared.debate_search.placeholder") + ) %>

<%= page_entries_info @debates %>

diff --git a/app/views/admin/local_census_records/index.html.erb b/app/views/admin/local_census_records/index.html.erb index bac308537..3ac46dce2 100644 --- a/app/views/admin/local_census_records/index.html.erb +++ b/app/views/admin/local_census_records/index.html.erb @@ -8,16 +8,11 @@ new_admin_local_census_records_import_path, class: "button float-right hollow" %> -
- <%= form_tag admin_local_census_records_path, method: :get, remote: true do %> -
- <%= text_field_tag :search, "", placeholder: t("admin.local_census_records.index.search.placeholder") %> -
- <%= submit_tag t("admin.shared.search.search"), class: "button" %> -
-
- <% end %> -
+<%= render Admin::SearchComponent.new( + url: admin_local_census_records_path, + label: t("admin.local_census_records.index.search.placeholder"), + remote: true +) %>
<%= render "local_census_records" %> diff --git a/app/views/admin/organizations/index.html.erb b/app/views/admin/organizations/index.html.erb index 8afaeedd8..d28ffc42f 100644 --- a/app/views/admin/organizations/index.html.erb +++ b/app/views/admin/organizations/index.html.erb @@ -1,16 +1,9 @@

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

-
- <%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %> -
- <%= text_field_tag :search, "", placeholder: t("admin.organizations.index.search_placeholder") %> - -
- <%= f.submit t("admin.shared.search.search"), class: "button" %> -
-
- <% end %> -
+<%= render Admin::SearchComponent.new( + url: search_admin_organizations_path, + label: t("admin.organizations.index.search_placeholder") +) %> <%= render "shared/filter_subnav", i18n_namespace: "admin.organizations.index" %> diff --git a/app/views/admin/organizations/search.html.erb b/app/views/admin/organizations/search.html.erb index 6f65f3843..2c40759f1 100644 --- a/app/views/admin/organizations/search.html.erb +++ b/app/views/admin/organizations/search.html.erb @@ -1,15 +1,9 @@

<%= t("admin.organizations.search.title") %>

-
- <%= form_for(Organization.new, url: search_admin_organizations_path, method: :get) do |f| %> -
- <%= text_field_tag :search, "", placeholder: t("admin.organizations.index.search_placeholder") %> -
- <%= f.submit t("admin.shared.search.search"), class: "button" %> -
-
- <% end %> -
+<%= render Admin::SearchComponent.new( + url: search_admin_organizations_path, + label: t("admin.organizations.index.search_placeholder") +) %>
<% if @organizations.any? %> diff --git a/app/views/admin/poll/booths/index.html.erb b/app/views/admin/poll/booths/index.html.erb index 415515653..fd1353a72 100644 --- a/app/views/admin/poll/booths/index.html.erb +++ b/app/views/admin/poll/booths/index.html.erb @@ -4,7 +4,10 @@ <%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, class: "button float-right" %> <% end %> -<%= render "/admin/shared/booth_search", url: admin_booths_path %> +<%= render Admin::SearchComponent.new( + url: admin_booths_path, + label: t("admin.shared.booths_search.placeholder") +) %> <% if @booths.empty? %>
diff --git a/app/views/admin/poll/officers/_search.html.erb b/app/views/admin/poll/officers/_search.html.erb index 8980d5daf..715a15237 100644 --- a/app/views/admin/poll/officers/_search.html.erb +++ b/app/views/admin/poll/officers/_search.html.erb @@ -1,11 +1,7 @@

<%= t("admin.poll_officers.search.help") %>

-<%= form_tag search_admin_officers_path, method: :get, remote: true do %> -
- <%= text_field_tag :search, "", - placeholder: t("admin.poll_officers.search.email_placeholder") %> -
- <%= submit_tag t("admin.shared.search.search"), class: "button" %> -
-
-<% end %> +<%= render Admin::SearchComponent.new( + url: search_admin_officers_path, + label: t("admin.poll_officers.search.email_placeholder"), + remote: true +) %> diff --git a/app/views/admin/poll/officers/index.html.erb b/app/views/admin/poll/officers/index.html.erb index c6b5caf74..1f84a46ee 100644 --- a/app/views/admin/poll/officers/index.html.erb +++ b/app/views/admin/poll/officers/index.html.erb @@ -1,8 +1,6 @@

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

-
- <%= render "search" %> -
+<%= render "search" %>
diff --git a/app/views/admin/poll/questions/_search.html.erb b/app/views/admin/poll/questions/_search.html.erb index 56127db13..5f627756b 100644 --- a/app/views/admin/poll/questions/_search.html.erb +++ b/app/views/admin/poll/questions/_search.html.erb @@ -1,10 +1,4 @@ -<%= form_tag(admin_questions_path, method: :get) do |f| %> -
- <%= text_field_tag :search, - @search, - placeholder: t("admin.shared.poll_questions_search.placeholder") %> -
- <%= submit_tag t("admin.shared.search.search"), class: "button" %> -
-
-<% end %> +<%= render Admin::SearchComponent.new( + url: admin_questions_path, + label: t("admin.shared.poll_questions_search.placeholder") +) %> diff --git a/app/views/admin/poll/questions/index.html.erb b/app/views/admin/poll/questions/index.html.erb index d5fac81e4..6f704e489 100644 --- a/app/views/admin/poll/questions/index.html.erb +++ b/app/views/admin/poll/questions/index.html.erb @@ -3,9 +3,7 @@ <%= link_to t("admin.questions.index.create"), new_admin_question_path, class: "button float-right" %> -
- <%= render "search" %> -
+<%= render "search" %>
<%= render "filter_subnav" %> diff --git a/app/views/admin/proposals/index.html.erb b/app/views/admin/proposals/index.html.erb index bc59de812..43693ea1e 100644 --- a/app/views/admin/proposals/index.html.erb +++ b/app/views/admin/proposals/index.html.erb @@ -5,7 +5,10 @@

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

<% if @proposals.any? %> - <%= render "/admin/shared/proposal_search", url: admin_proposals_path %> + <%= render Admin::SearchComponent.new( + url: admin_proposals_path, + label: t("admin.shared.proposal_search.placeholder") + ) %>

<%= page_entries_info @proposals %>

diff --git a/app/views/admin/shared/_booth_search.html.erb b/app/views/admin/shared/_booth_search.html.erb deleted file mode 100644 index ddaf5db0b..000000000 --- a/app/views/admin/shared/_booth_search.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%= form_for(Poll::Booth.new, url: url, as: :booth, method: :get) do |f| %> -
-
- <%= text_field_tag :search, params[:search], placeholder: t("admin.shared.booths_search.placeholder") %> -
- <%= f.submit t("admin.shared.search.search"), class: "button" %> -
-
-
-<% end %> diff --git a/app/views/admin/shared/_debate_search.html.erb b/app/views/admin/shared/_debate_search.html.erb deleted file mode 100644 index 378d23ed4..000000000 --- a/app/views/admin/shared/_debate_search.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%= form_for(Debate.new, url: url, as: :debate, method: :get) do |f| %> -
-
- <%= text_field_tag :search, "", placeholder: t("admin.shared.debate_search.placeholder") %> -
- <%= f.submit t("admin.shared.search.search"), class: "button" %> -
-
-
-<% end %> diff --git a/app/views/admin/shared/_proposal_search.html.erb b/app/views/admin/shared/_proposal_search.html.erb deleted file mode 100644 index c8aee5e2a..000000000 --- a/app/views/admin/shared/_proposal_search.html.erb +++ /dev/null @@ -1,10 +0,0 @@ -<%= form_for(Proposal.new, url: url, as: :proposal, method: :get) do |f| %> -
-
- <%= text_field_tag :search, "", placeholder: t("admin.shared.proposal_search.placeholder") %> -
- <%= f.submit t("admin.shared.search.search"), class: "button" %> -
-
-
-<% end %> diff --git a/app/views/admin/users/index.html.erb b/app/views/admin/users/index.html.erb index 4463ea2e7..49165c31e 100644 --- a/app/views/admin/users/index.html.erb +++ b/app/views/admin/users/index.html.erb @@ -1,15 +1,10 @@

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

-
- <%= form_tag admin_users_path, method: :get, remote: true do %> -
- <%= text_field_tag :search, "", placeholder: t("admin.users.search.placeholder") %> -
- <%= submit_tag t("admin.shared.search.search"), class: "button" %> -
-
- <% end %> -
+<%= render Admin::SearchComponent.new( + url: admin_users_path, + label: t("admin.users.search.placeholder"), + remote: true +) %>
<%= render "users" %> diff --git a/app/views/management/proposals/index.html.erb b/app/views/management/proposals/index.html.erb index 6ec7bd712..21397b553 100644 --- a/app/views/management/proposals/index.html.erb +++ b/app/views/management/proposals/index.html.erb @@ -1,7 +1,10 @@

<%= t("management.proposals.index.title") %>

- <%= render "admin/shared/proposal_search", url: management_proposals_path %> + <%= render Admin::SearchComponent.new( + url: management_proposals_path, + label: t("admin.shared.proposal_search.placeholder") + ) %>
diff --git a/app/views/moderation/users/index.html.erb b/app/views/moderation/users/index.html.erb index 7ea2180f1..6ae397dd4 100644 --- a/app/views/moderation/users/index.html.erb +++ b/app/views/moderation/users/index.html.erb @@ -1,15 +1,9 @@

<%= t("moderation.users.index.title") %>

-<%= form_for(User.new, url: moderation_users_path, as: :user, method: :get) do |f| %> -
-
- <%= text_field_tag :search, "", placeholder: t("moderation.users.index.search_placeholder") %> -
-
- <%= f.submit t("admin.shared.search.search"), class: "button success" %> -
-
-<% end %> +<%= render Admin::SearchComponent.new( + url: moderation_users_path, + label: t("moderation.users.index.search_placeholder") +) %> <% if @users.present? %>

<%= page_entries_info @users %>