Active filters and applications

In my active admin code, I have the following:

scope :all
  scope :in_progress
  scope :completed, default: true
  scope :processed

  filter :order_number, label: "by order number", collection: Order.all.map(&:order_number)
  filter :order_date, label: "orders placed between", collection: Order.all.map(&:order_date)

Filters display results in separate tabs. So, now that the user is filtering the results, I want to see all the results in all tabs (that is, the user is redirected to the "All" tab). I cannot find a way to achieve this. Thanks in advance:)

+3
source share
2 answers

you can use Hidden Fieldfor Active Admin Filter.

you can implement in js as follows: (I wrote this code in coffeescript)

  $('.index.admin_orders.active_admin .filter_form').submit ->
    scope = $(@).find('#hidden_active_admin_scope').value
    if(scope)
      $(@).find('#hidden_active_admin_scope').value = 'all'
    else
      $(@).find('div.buttons').append('<input id="hidden_active_admin_scope" name="scope" type="hidden" value="all">')
+1
source

ActiveAdmin . (, order_status), , .

+1

All Articles