Sha256: 4670ff4be865e0c36ff1ce0d1990d1c8a01bab5e719176e784fd0b7a7a0b8d95
Contents?: true
Size: 1.55 KB
Versions: 123
Compression:
Stored size: 1.55 KB
Contents
<%= render :partial => 'caboose/pages/admin_header' %> <form action='/admin/pages/<%= @page.id %>' method='put' id='layout_form'> <input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' /> <p><select name='block_type_id'> <option value=''>-- Select a layout --</option> <% cat_ids = Caboose::BlockTypeCategory.layouts.collect{ |cat| cat.id } %> <% Caboose::BlockType.includes(:block_type_site_memberships).where("block_type_category_id in (?) and block_type_site_memberships.site_id = ?", cat_ids, @site.id).reorder(:description).all.each do |bt| %> <option value="<%= bt.id %>"><%= bt.description %></option> <% end %> </select></p> <div id='message'></div> <p> <input type='button' value='< Back' onclick="window.location='/admin/pages/<%= @page.id %>/edit';" /> <input type='submit' value='Update Page Layout' /> </p> </form> <%= render :partial => 'caboose/pages/admin_footer' %> <% content_for :caboose_js do %> <script type='text/javascript'> $(document).ready(function() { $('#layout_form').submit(function() { update_page_layout(<%= @page.id %>); return false; }); }); function update_page_layout(page_id) { $('#message').html("<p class='loading'>Updating layout...</p>"); $.ajax({ url: '/admin/pages/' + page_id + '/layout', type: 'put', data: $('#layout_form').serialize(), success: function(resp) { if (resp.error) $('#message').html("<p class='note error'>" + resp.error + "</p>"); if (resp.redirect) window.location = resp.redirect } }); } </script> <% end %>
Version data entries
123 entries across 123 versions & 1 rubygems