{I" class:ETI"ProcessedAsset;FI"logical_path;TI"spina/admin/pages.js;FI" pathname;TI"N/Users/bram/apps/spina/app/assets/javascripts/spina/admin/pages.js.coffee;FI"content_type;TI"application/javascript;TI" mtime;Tl+LE6UI" length;TiI" digest;TI"%00cd2bf18240e966ecaa141354887b63;FI" source;TI"(function() { var ready, show_page_parts; ready = function() { var page_parts; if ($('.page-template').length > 0) { page_parts = $('.page-template').data('page-parts'); show_page_parts(page_parts); } $('.sortable-grid').sortable().bind('sortupdate', function(e) { var position_array; position_array = []; $(e.target).find('li.image').each(function(index) { return position_array.push($(this).data('photo-id')); }); return $(e.target).parents('td').find('.photo-positions').val(position_array.join(",")); }); return $('.structure-form-menu ul').sortable().bind('sortupdate', function(e) { return $(e.target).find('li').each(function(index) { var id; id = $(this).data('structure-item-id'); return $(".structure_form_pane_" + id + "_position").val(index); }); }); }; $(document).on('ready page:load', ready); $(document).on('change', '.page-template select', function() { var page_parts; page_parts = $(this).find('option:selected').data('page-parts').split(" "); return show_page_parts(page_parts); }); show_page_parts = function(page_parts) { var i, len, page_part, results; $('tr.page-part').hide(); results = []; for (i = 0, len = page_parts.length; i < len; i++) { page_part = page_parts[i]; results.push($('tr.page-part[data-name=' + page_part + ']').show()); } return results; }; $(document).on('click', 'form .add_fields', function(event) { var regexp, time; time = new Date().getTime(); regexp = new RegExp($(this).data('id'), 'g'); $(this).before($(this).data('fields').replace(regexp, time)); return event.preventDefault(); }); $(document).on('click', 'form .remove_fields', function(event) { $(this).prev('input[type=hidden]').val('1'); $(this).closest('fieldset').slideUp(); return event.preventDefault(); }); $(document).on('click', 'form .add_structure', function(event) { var $fields, $link, $structureForm, regexp, time; $structureForm = $(this).parents('.structure-form'); time = new Date().getTime(); regexp = new RegExp($(this).data('id'), 'g'); $fields = $($(this).data('fields').replace(regexp, time)); $structureForm.find('.structure-form-content').append($fields); $link = $("
  • "); $structureForm.find('.structure-form-menu ul').append($link); $fields.attr('id', "structure_form_pane_" + time); $link.find('a').click(); return event.preventDefault(); }); $(document).on('click', 'form .remove-structure-item-fields', function(event) { var $link, $pane, $previousLink; $(this).prev('input[type=hidden]').val('1'); $pane = $(this).closest('.structure-form-pane'); $link = $("a[href='#" + ($pane.attr('id')) + "']").parents('li'); $previousLink = $link.siblings('li:visible'); $previousLink.find('a').trigger('click'); $link.hide(); $pane.hide(); return event.preventDefault(); }); $(document).on('click', '.sort-switch', function(event) { $($(this).attr('href') + ' .dd-item-inner').toggleClass('dd-handle'); if ($(this).attr('data-icon') === 'j') { $(this).attr('data-icon', '8'); $(this).removeClass('button-success'); $(this).text($(this).data('change-order')); } else { $(this).attr('data-icon', 'j'); $(this).addClass('button-success'); $(this).text($(this).data('done-changing-order')); } return false; }); }).call(this); ;TI"dependency_digest;TI"%66e9af55452c756e15211c137cee935d;FI"required_paths;T[I"N/Users/bram/apps/spina/app/assets/javascripts/spina/admin/pages.js.coffee;FI"dependency_paths;T[{I" path;TI"N/Users/bram/apps/spina/app/assets/javascripts/spina/admin/pages.js.coffee;F@I"2015-04-21T14:40:44+02:00;T@I"%9a1342dfce2c471feb6e55c26af3e880;FI" _version;TI"%64e62ddc273c2f5847f30d698ca14b67;F