Filter by job class
<% filter.job_classes.each do |name, count| %> <% if params[:job_class] == name %> <%= link_to(filter.to_params(job_class: nil), class: 'btn btn-sm btn-outline-secondary active', role: "button", "aria-pressed": true) do %> <%= name %> (<%= count %>) <% end %> <% else %> <%= link_to(filter.to_params(job_class: name), class: 'btn btn-sm btn-outline-secondary', role: "button") do %> <%= name %> (<%= count %>) <% end %> <% end %> <% end %>
Filter by state
<% filter.states.each do |name, count| %> <% if params[:state] == name %> <%= link_to(filter.to_params(state: nil), class: 'btn btn-sm btn-outline-secondary active', role: "button", "aria-pressed": true) do %> <%= name %> (<%= count %>) <% end %> <% else %> <%= link_to(filter.to_params(state: name), class: 'btn btn-sm btn-outline-secondary', role: "button") do %> <%= name %> (<%= count %>) <% end %> <% end %> <% end %>
Filter by queue
<% filter.queues.each do |name, count| %> <% if params[:queue_name] == name %> <%= link_to(filter.to_params(queue_name: nil), class: 'btn btn-sm btn-outline-secondary active', role: "button", "aria-pressed": true) do %> <%= name %> (<%= count %>) <% end %> <% else %> <%= link_to(filter.to_params(queue_name: name), class: 'btn btn-sm btn-outline-secondary', role: "button") do %> <%= name %> (<%= count %>) <% end %> <% end %> <% end %>
<%= form_with(url: "", method: :get, local: true) do |form| %> <% filter.to_params(query: nil).each do |key, value| %> <%= form.hidden_field(key.to_sym, value: value) %> <% end %> <%= form.label :query, "Search" %>
<%= form.search_field :query, value: params[:query], class: "form-control" %> <%= form.button "Search", type: "submit", name: nil, class: "btn btn-sm btn-outline-secondary" %> <%= link_to "Clear", filter.to_params(query: nil), class: "btn btn-sm btn-outline-secondary" %>
<% end %>