]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/users/lists/show.html.erb
Add search form to the top of the user list view
[rails.git] / app / views / users / lists / show.html.erb
index abf0092cebb5c8c695c7369406719b85e64e05c8..dd037c7af6c3a13dee647bf9ba3e077ca658be7e 100644 (file)
@@ -8,8 +8,26 @@
   <h1><%= t(".heading") %></h1>
 <% end %>
 
-<% unless @users.empty? %>
-  <%= render :partial => "page" %>
-<% else %>
-  <p><%= t ".empty" %></p>
-<% end %>
+<%= form_tag(users_list_path, :method => :get, :data => { "turbo" => true, "turbo-frame" => "pagination", "turbo-action" => "advance" }) do %>
+  <div class="row gx-1">
+    <div class="mb-3 col-md-auto">
+      <%= select_tag :status,
+                     options_for_select(User.aasm.states.map(&:name).map { |state| [t(".states.#{state}"), state] }, params[:status]),
+                     :include_blank => t(".select_status"),
+                     :data => { :behavior => "category_dropdown" },
+                     :class => "form-select" %>
+    </div>
+    <div class="mb-3 col-md">
+      <%= text_field_tag :ip,
+                         params[:ip],
+                         :placeholder => t(".ip_address"),
+                         :autocomplete => "on",
+                         :class => "form-control" %>
+    </div>
+    <div class="mb-3 col-md-auto">
+      <%= submit_tag t(".search"), :name => nil, :class => "btn btn-primary" %>
+    </div>
+  </div>
+<% end -%>
+
+<%= render :partial => "page" %>