 #    limitations under the License.
 
 $(window).ready ->
+  table = $('#translations')
+  searchForm = $('#filter-form')
+
   $("input[name='commit[exported]']").change ->
     checkbox = $(this)
     form = checkbox.closest('form')

  searchForm.submit ->
    table.find('tbody').empty()
    scroll.reset()
    scroll.loadNextPage()
    false

      error: ->
        new Flash('alert').text("Couldn't update commit export status")

  prefillForm = () ->
    for own param, val of $.url().param()
      searchForm.find("[name=#{param}]").val(val.trim())

  prefillForm()

  makeURL = -> "#{table.data('url')}?#{searchForm.serialize()}"
  localeOrder = table.data('locales').split(',')

