{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 = $("