add search form on admin booths
This commit is contained in:
@@ -2,6 +2,7 @@ class Admin::Poll::BoothsController < Admin::Poll::BaseController
|
|||||||
load_and_authorize_resource class: "Poll::Booth"
|
load_and_authorize_resource class: "Poll::Booth"
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@booths = @booths.search params[:search].strip if params[:search]
|
||||||
@booths = @booths.order(name: :asc).page(params[:page])
|
@booths = @booths.order(name: :asc).page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @booths.any? %>
|
<% if @booths.any? %>
|
||||||
|
<%= render "/admin/shared/booth_search", url: admin_booths_path %>
|
||||||
|
|
||||||
<h3><%= page_entries_info @booths %></h3>
|
<h3><%= page_entries_info @booths %></h3>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
10
app/views/admin/shared/_booth_search.html.erb
Normal file
10
app/views/admin/shared/_booth_search.html.erb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<%= form_for(Poll::Booth.new, url: url, as: :booth, method: :get) do |f| %>
|
||||||
|
<div class="small-12 medium-6">
|
||||||
|
<div class="input-group">
|
||||||
|
<%= text_field_tag :search, "", placeholder: t("admin.shared.booths_search.placeholder") %>
|
||||||
|
<div class="input-group-button">
|
||||||
|
<%= f.submit t("admin.shared.proposal_search.button"), class: "button" %>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
@@ -1330,7 +1330,7 @@ en:
|
|||||||
false_value: "No"
|
false_value: "No"
|
||||||
booths_search:
|
booths_search:
|
||||||
button: Search
|
button: Search
|
||||||
placeholder: Search booth by name
|
placeholder: Search booth by name or location
|
||||||
poll_officers_search:
|
poll_officers_search:
|
||||||
button: Search
|
button: Search
|
||||||
placeholder: Search poll officers
|
placeholder: Search poll officers
|
||||||
|
|||||||
Reference in New Issue
Block a user