ip bans: add search form.

* Add IP ban search form to /ip_bans page.
* Make some attributes searchable that weren't previously searchable.
This commit is contained in:
evazion
2020-12-17 20:21:40 -06:00
parent 3d1ff9dff9
commit 25069865b7
2 changed files with 18 additions and 4 deletions

View File

@@ -2,6 +2,16 @@
<div id="a-index">
<h1>IP Bans</h1>
<%= search_form_for(ip_bans_path) do |f| %>
<%= f.input :ip_addr, label: "IP Addr", hint: "Use /24 for subnet", input_html: { value: params[:search][:ip_addr] } %>
<%= f.input :reason, input_html: { value: params[:search][:reason] } %>
<%= f.input :creator_name, label: "Creator", input_html: { value: params[:search][:creator_name], "data-autocomplete": "user" } %>
<%= f.input :category, collection: IpBan.categories, include_blank: true, selected: params[:search][:category] %>
<%= f.input :is_deleted, label: "Deleted?", collection: ["Yes", "No"], include_blank: true, input_html: { value: params[:search][:is_deleted] } %>
<%= f.input :order, collection: [%w[Newest created_at], %w[Oldest created_at_asc], %w[Last\ Seen last_hit_at]], include_blank: true, selected: params[:search][:order] %>
<%= f.submit "Search" %>
<% end %>
<%= table_for @ip_bans, class: "striped autofit", width: "100%" do |t| %>
<% t.column "IP Address" do |ip_ban| %>
<%= link_to_ip ip_ban.subnetted_ip %>