Sha256: 5485468d0e68af31b25e63efa9612df3d908adddb77acd80607328de2b3dcea9

Contents?: true

Size: 893 Bytes

Versions: 1

Compression:

Stored size: 893 Bytes

Contents

#= require jquery.form

$ ->
  $('#settings .form form').submit ->
    false

  $('.edit_setting_link').click (e) ->
    e.preventDefault()
    id = $(this).attr "data-setting-id"
    setting = $("#setting_#{id}")
    setting.find(".value").hide()
    setting.find(".form").show()
    setting.find(".update_setting_link").show()
    $(this).hide()

  $('.update_setting_link').click (e) ->
    e.preventDefault()
    btn = $(this)
    id = btn.attr "data-setting-id"
    setting = $("#setting_#{id}")
    setting.find(".form").hide()

    # submit form, should use jquery form for file submissions
    form = setting.find(".form form")
    form.submit =>
      form.ajaxSubmit
        success: (value) =>
          setting.find('.value').html(value)
          setting.find(".value").show()
          setting.find(".edit_setting_link").show()
          btn.hide()
      false
    form.submit()

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activeadmin-settings-0.1.0 vendor/assets/javascripts/activeadmin_settings.js.coffee