Sha256: f549494f9e2032502ff12e064793aad6fdb03bcbb01ab85cbb3141411b5e0528

Contents?: true

Size: 709 Bytes

Versions: 2

Compression:

Stored size: 709 Bytes

Contents

$(document).on 'ready page:load turbolinks:load', ->
  # Clear Filters button
  $('.clear_filters_btn').click ->
    params = window.location.search.slice(1).split('&')
    regex = /^(q\[|q%5B|q%5b|page|commit)/
    window.location.search = (param for param in params when not param.match(regex)).join('&')

  # Filter form: don't send any inputs that are empty
  $('.filter_form').submit ->
    $(@).find(':input').filter(-> @value is '').prop 'disabled', true

  # Filter form: for filters that let you choose the query method from
  # a dropdown, apply that choice to the filter input field.
  $('.filter_form_field.select_and_search select').change ->
    $(@).siblings('input').prop name: "q[#{@value}]"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
activeadmin-1.0.0.pre4 app/assets/javascripts/active_admin/initializers/filters.js.coffee
activeadmin-1.0.0.pre3 app/assets/javascripts/active_admin/initializers/filters.js.coffee