Sha256: 4445fadd48517cbff5a1f82c692f41023a670cf65ba17bf17964b6936b5261f8
Contents?: true
Size: 1.29 KB
Versions: 12
Compression:
Stored size: 1.29 KB
Contents
module KonoUtils module Object module Cell module Forms # namespace module Fields ## # Bottone per la rimozione della riga nested # *Options:* # - ajax_remove: [Boolean] -> indica se vogliamo che venga veramente cancellato il record class NestedWrappers::RemoveButton < KonoUtils::Object::Cell::Buttons::Delete def url_to if ajax_remove? destroy_custom_polymorphic_path(model, format: :json) else "#" end end ## # Controlla se questo record deve essere cancellato o meno via ajax # @return [TrueClass, FalseClass] def ajax_remove? !!options.fetch(:ajax_remove, false) end def automatic_remove_options if ajax_remove? super.merge(remote: true) else {} end end def show(&block) super + render(&block).html_safe end ## # ID div in cui definire che l'elemento viene rimosso def remove_target options[:remove_target] end end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems