   $('.tags-select').select2
     tags: true
     tokenSeparators: [',']
+
+  $(document).on 'change', '.parent-location', (event) ->
+    disableLocations this

  $(document).on 'ready', () ->
    addChosen()

  $('form').submit ->
    $('#items_list .table-container').html('<h2>Loading...</h2>')
    return

  $(document).on 'change', 'input.localization_main', (event) ->
    $('input.localization_main').not(this).prop('checked', false)

  disableLocations = (el) ->
    if el.selectedIndex == 0
      $('.localization-form').each ->
        $(this).show()
        return
      $('.add_location').show()
    else
      $('.localization-form').each ->
        $(this).hide()
        return
      $('.add_location').hide()
    return

  addChosen = ->
    # enable chosen js
    $('.chosen-select').chosen
