Sha256: b25cfe3e88e41cf4b5f67abfbe1a0c50a3249a9d3b02b96d64e4b1e2029125c8
Contents?: true
Size: 847 Bytes
Versions: 5
Compression:
Stored size: 847 Bytes
Contents
$ -> $(document).off 'click', 'form .remove_fields' $(document).off 'click', 'form .add_fields' $(document).on 'click', 'form .remove_fields', (event) -> $deleteField = $(this).prev('input[type=hidden]') if $deleteField.length > 0 $deleteField.val('1') $(this).closest('.fields').hide() else $(this).closest('.fields').remove() $(document).trigger('dynamicFieldsFor.remove', @) event.preventDefault() $(document).on 'click', 'form .add_fields', (event) -> time = new Date().getTime() regexp = new RegExp($(this).data('id'), 'g') $target = $($(@).data('target')) fields = $(this).data('fields').replace(regexp, time) if $target.length $target.append(fields) else $(this).before(fields) $(document).trigger('dynamicFieldsFor.add', @) event.preventDefault()
Version data entries
5 entries across 5 versions & 1 rubygems