Sha256: 22f2ceda8b9e1f91910a7668dd832b386049eb57445e24bd2822b9ea9420dd30
Contents?: true
Size: 1.53 KB
Versions: 62
Compression:
Stored size: 1.53 KB
Contents
/** * @namespace WORKAREA.cloneableRows */ WORKAREA.registerModule('cloneableRows', (function () { 'use strict'; var createClonedID = function (index, id) { return id + '_cloned_' + index; }, getDefaultValue = function () { return this.defaultValue; }, cloneRow = function ($row) { var $clonedRow = $row.clone(); $clonedRow .insertAfter($row) .find('[name],[for]') .val(getDefaultValue) .prop('id', createClonedID) // needed to pass integration tests .prop('for', createClonedID); $row .find('.value__note') .remove(); WORKAREA.initModules($clonedRow); }, removeListeners = function ($row) { return $row.off('input.cloneableRows click.cloneableRows'); }, getTarget = function (event) { return $(event.delegateTarget); }, handleInput = _.flowRight(cloneRow, removeListeners, getTarget), /** * @method * @name init * @memberof WORKAREA.cloneableRows */ init = function ($scope) { $scope .find('[data-cloneable-row]') .addBack('[data-cloneable-row]') .on('input.cloneableRows', '[name]', handleInput) .on('click.cloneableRows', 'input[type=file]', handleInput); }; return { init: init }; }()));
Version data entries
62 entries across 62 versions & 1 rubygems