ActiveAdmin.dialogMassFieldsUpdate = (message, inputs, callback)-> html = """
" form = $(html).appendTo('body') $('body').trigger 'mass_update_modal_dialog:before_open', [form] form.dialog modal: true dialogClass: 'active_admin_dialog active_admin_dialog_mass_update_by_filter', maxHeight: window.innerHeight - window.innerHeight * 0.1, open: -> $('body').trigger 'mass_update_modal_dialog:after_open', [form] $('.mass_update_protect_fild_flag').on 'change', (e) -> if this.checked $(e.target).next().next().removeAttr('disabled').trigger("chosen:updated") else $(e.target).next().next().attr('disabled', 'disabled').trigger("chosen:updated") buttons: OK: (e)-> $(e.target).closest('.ui-dialog-buttonset').html('Processing. Please wait...') callback $(@).serializeObject() Cancel: -> $('.mass_update_protect_fild_flag').off('change') $(@).dialog('close').remove()