Sha256: ae49160b1afbbaceee358c3a47dbe0f5c92b489762b89a0fd512150c6aca9103
Contents?: true
Size: 1.72 KB
Versions: 2
Compression:
Stored size: 1.72 KB
Contents
class Para.NestedManyField constructor: (@$field) -> @$fieldsList = @$field.find('.fields-list') @initializeOrderable() @initializeCocoon() @$field.on 'shown.bs.collapse', $.proxy(@collapseShown, this) initializeOrderable: -> @orderable = @$field.hasClass('orderable') return unless @orderable @$fieldsList.sortable handle: '.order-anchor' forcePlaceholderSize: true @$fieldsList.on('sortupdate', $.proxy(@sortUpdate, this)) sortUpdate: -> @$fieldsList.find('.form-fields').each (i, el) -> $(el).find('.resource-position-field').val(i) initializeCocoon: -> @$fieldsList.on 'cocoon:after-insert', $.proxy(@afterInsertField, this) afterInsertField: (e, $element) -> if ($collapsible = $element.find('[data-open-on-insert="true"]')).length @openInsertedField($collapsible) if @orderable @$fieldsList.sortable('destroy') @initializeOrderable() @sortUpdate() if ($redactor = $element.find('[data-redactor]')).length $redactor.simpleFormRedactor() if ($selectize = $element.find('[data-selectize]')) $selectize.simpleFormSelectize() if ($slider = $element.find('[data-slider]')) $slider.simpleFormSlider() openInsertedField: ($field) -> $target = $($field.attr('href')) $target.collapse('show') collapseShown: (e) -> $target = $(e.target) $field = @$field.find("[data-toggle='collapse'][href='##{ $target.attr('id') }']") scrollOffset = -($('[data-header]').outerHeight() + 20) $.scrollTo($field, 200, offset: scrollOffset) $target.find('input, textarea, select').eq('0').focus() $(document).on 'page:change', -> $('.nested-many-field').each (i, el) -> new Para.NestedManyField($(el))
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
para-0.5.4 | app/assets/javascripts/para/inputs/nested_many.coffee |
para-0.5.3 | app/assets/javascripts/para/inputs/nested_many.coffee |