Search on the same URL by default
This commit is contained in:
@@ -1,12 +1,16 @@
|
|||||||
class Admin::SearchComponent < ApplicationComponent
|
class Admin::SearchComponent < ApplicationComponent
|
||||||
attr_reader :url, :label, :form_options
|
attr_reader :label, :form_options
|
||||||
|
|
||||||
def initialize(url:, label:, **form_options)
|
def initialize(label:, url: nil, **form_options)
|
||||||
@url = url
|
|
||||||
@label = label
|
@label = label
|
||||||
|
@url = url
|
||||||
@form_options = form_options
|
@form_options = form_options
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def url
|
||||||
|
@url || request.path
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def search_terms
|
def search_terms
|
||||||
|
|||||||
@@ -5,10 +5,7 @@
|
|||||||
<h2><%= t("admin.debates.index.title") %></h2>
|
<h2><%= t("admin.debates.index.title") %></h2>
|
||||||
|
|
||||||
<% if @debates.any? %>
|
<% if @debates.any? %>
|
||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(label: t("admin.shared.debate_search.placeholder")) %>
|
||||||
url: admin_debates_path,
|
|
||||||
label: t("admin.shared.debate_search.placeholder")
|
|
||||||
) %>
|
|
||||||
|
|
||||||
<h3 class="inline-block"><%= page_entries_info @debates %></h3>
|
<h3 class="inline-block"><%= page_entries_info @debates %></h3>
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
class: "button float-right hollow" %>
|
class: "button float-right hollow" %>
|
||||||
|
|
||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(
|
||||||
url: admin_local_census_records_path,
|
|
||||||
label: t("admin.local_census_records.index.search.placeholder"),
|
label: t("admin.local_census_records.index.search.placeholder"),
|
||||||
remote: true
|
remote: true
|
||||||
) %>
|
) %>
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
<h2><%= t("admin.organizations.search.title") %></h2>
|
<h2><%= t("admin.organizations.search.title") %></h2>
|
||||||
|
|
||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(label: t("admin.organizations.index.search_placeholder")) %>
|
||||||
url: search_admin_organizations_path,
|
|
||||||
label: t("admin.organizations.index.search_placeholder")
|
|
||||||
) %>
|
|
||||||
|
|
||||||
<div id="search-results">
|
<div id="search-results">
|
||||||
<% if @organizations.any? %>
|
<% if @organizations.any? %>
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
<%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, class: "button float-right" %>
|
<%= link_to t("admin.booths.index.add_booth"), new_admin_booth_path, class: "button float-right" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(label: t("admin.shared.booths_search.placeholder")) %>
|
||||||
url: admin_booths_path,
|
|
||||||
label: t("admin.shared.booths_search.placeholder")
|
|
||||||
) %>
|
|
||||||
|
|
||||||
<% if @booths.empty? %>
|
<% if @booths.empty? %>
|
||||||
<div class="callout primary">
|
<div class="callout primary">
|
||||||
|
|||||||
@@ -1,4 +1 @@
|
|||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(label: t("admin.shared.poll_questions_search.placeholder")) %>
|
||||||
url: admin_questions_path,
|
|
||||||
label: t("admin.shared.poll_questions_search.placeholder")
|
|
||||||
) %>
|
|
||||||
|
|||||||
@@ -5,10 +5,7 @@
|
|||||||
<h2><%= t("admin.proposals.index.title") %></h2>
|
<h2><%= t("admin.proposals.index.title") %></h2>
|
||||||
|
|
||||||
<% if @proposals.any? %>
|
<% if @proposals.any? %>
|
||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(label: t("admin.shared.proposal_search.placeholder")) %>
|
||||||
url: admin_proposals_path,
|
|
||||||
label: t("admin.shared.proposal_search.placeholder")
|
|
||||||
) %>
|
|
||||||
|
|
||||||
<h3><%= page_entries_info @proposals %></h3>
|
<h3><%= page_entries_info @proposals %></h3>
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<h2><%= t("admin.users.index.title") %></h2>
|
<h2><%= t("admin.users.index.title") %></h2>
|
||||||
|
|
||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(
|
||||||
url: admin_users_path,
|
|
||||||
label: t("admin.users.search.placeholder"),
|
label: t("admin.users.search.placeholder"),
|
||||||
remote: true
|
remote: true
|
||||||
) %>
|
) %>
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
<main>
|
<main>
|
||||||
<h2><%= t("management.proposals.index.title") %></h2>
|
<h2><%= t("management.proposals.index.title") %></h2>
|
||||||
|
|
||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(label: t("admin.shared.proposal_search.placeholder")) %>
|
||||||
url: management_proposals_path,
|
|
||||||
label: t("admin.shared.proposal_search.placeholder")
|
|
||||||
) %>
|
|
||||||
|
|
||||||
<div class="management-list">
|
<div class="management-list">
|
||||||
<div class="proposals-list">
|
<div class="proposals-list">
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
<h2><%= t("moderation.users.index.title") %></h2>
|
<h2><%= t("moderation.users.index.title") %></h2>
|
||||||
|
|
||||||
<%= render Admin::SearchComponent.new(
|
<%= render Admin::SearchComponent.new(label: t("moderation.users.index.search_placeholder")) %>
|
||||||
url: moderation_users_path,
|
|
||||||
label: t("moderation.users.index.search_placeholder")
|
|
||||||
) %>
|
|
||||||
|
|
||||||
<% if @users.present? %>
|
<% if @users.present? %>
|
||||||
<h3><%= page_entries_info @users %></h3>
|
<h3><%= page_entries_info @users %></h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user