ActiveAdmin.dialogMassFieldsUpdate = function(message, inputs, callback){ let html = `
"; const form = $(html).appendTo('body'); $('body').trigger('mass_update_modal_dialog:before_open', [form]); return 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]); return $('.mass_update_protect_fild_flag').on('change', function(e) { if (this.checked) { return $(e.target).next().next().removeAttr('disabled').trigger("chosen:updated"); } else { return $(e.target).next().next().attr('disabled', 'disabled').trigger("chosen:updated"); } }); }, buttons: { OK(e){ $(e.target).closest('.ui-dialog-buttonset').html('Processing. Please wait...'); return callback($(this).serializeObject()); }, Cancel() { $('.mass_update_protect_fild_flag').off('change'); return $(this).dialog('close').remove(); } } }); };