           $(this).find('input').first().focus()
     )
 
-  $('.fields a.create').live 'click', ->
+  #----------------------------------------------------------------------------
+  # Open new field form
+  $(document).on 'click', '.fields a.create', ->
     $('.edit_field').hide()
     field_group = $(this).closest('.field_group')
     field_group.find('.empty').hide()

    )
    false

  $('.edit_field a.close, .edit_field a.cancel').live 'click', ->
    $(this).closest('.edit_field').hide()
    false

  false

) jQuery


(($) ->

  #----------------------------------------------------------------------------
  # Custom field tabs switcher
  $(document).on "click", "*[data-tab-class]", (event) ->
    event.preventDefault()
    $el = $(this)

    $(".fields").each ->
      $(this).hide()

    $(".inline_tabs ul li").each ->
      $(this).removeClass "selected"

    klass = $el.data("tab-class")
    $("#" + klass + "_section").show()
    $el.addClass "selected"

  #----------------------------------------------------------------------------
  # Load custom field subform
  $(document).on 'change', '.fields select[name="field[as]"]', ->
    $.ajax(
        url: '/admin/fields/subform?' + $(this).parents('form').serialize()
        dataType: 'html'
