{I" class:ETI"ProcessedAsset;FI"logical_path;TI"fshop/extras.js;FI" pathname;TI"J/home/nofxx/projects/fshop/app/assets/javascripts/fshop/extras.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+Āf`RI" length;Ti* I" digest;TI"%350e4060ea1a7736e78ccb14fb487292;FI" source;TI"* (function() { var doc, resetHeight, resetPositions, resetRanks, setPosition, setRank; doc = $(document); doc.on('created', '.extra-option-base.option', function() { var $el, $fields; $el = $(this); $fields = $el.closest('.fields'); $el.removeClass('extra-option-base'); $fields.addClass('extra-option-base'); if ($el.hasClass('blueprint-option')) { $fields.css('width', '100%'); } $fields.css('transition', 'none'); setPosition($fields); setRank($fields); return setTimeout((function() { resetHeight($fields); return $fields.css('transition', ''); }), 0); }); doc.on('click', '.extra-form .remove_nested_fields', function(e) { var el; el = this; return setTimeout(function() { resetPositions(el); resetRanks(el); return resetHeight(el); }, 0); }); doc.on('click', '.extra-form .option-up, .extra-form .option-down', function(e) { var $el, $otherEl, names; e.preventDefault(); $el = $(this); names = $el.hasClass('option-up') ? ['prev', 'Before', -1] : ['next', 'After', 1]; $el = $el.closest('.extra-option-base'); $otherEl = $el[names[0] + 'All'](':visible:first'); if ($otherEl.length) { $el["insert" + names[1]]($otherEl); return setTimeout((function() { setPosition($el); setPosition($otherEl); setRank($el); return setRank($otherEl); }), 0); } }); setPosition = function(el, idx) { var $el; $el = $(el); if (idx == null) { idx = $el.prevAll(':visible').length; } return $el.css('transform', "translate(0, " + (100 * idx) + "%)"); }; resetPositions = function(el) { return $(el).closest('.options').children(':visible').each(function(i, el) { return setPosition(el, i); }); }; resetHeight = function(el) { var $container, sum, _i, _len, _ref; $container = $(el).closest('.options'); sum = 0; _ref = $container.children(':visible'); for (_i = 0, _len = _ref.length; _i < _len; _i++) { el = _ref[_i]; sum += $(el).height(); } return $container.css('min-height', sum + 'px'); }; setRank = function(el, rank) { var $container; $container = $(el).closest('.extra-option-base'); if (rank == null) { rank = $container.prevAll(':visible').length; } return $container.find('.extra-option-rank').val(rank); }; resetRanks = function(el) { return $(el).closest('.options').children(':visible').each(function(i, el) { return setRank(el, i); }); }; }).call(this); ;TI"dependency_digest;TI"%fcef0718596a052efba25acad3c7b8f1;FI"required_paths;T[I"J/home/nofxx/projects/fshop/app/assets/javascripts/fshop/extras.coffee;FI"dependency_paths;T[{I" path;TI"J/home/nofxx/projects/fshop/app/assets/javascripts/fshop/extras.coffee;FI" mtime;TI"2013-10-17T19:37:52-03:00;TI" digest;TI"%21d6d35c806c45404adbbdd21efe6a99;FI" _version;TI"%ac1cd7cf9811f9938e2b8937c60a24e6;F