Sha256: 899334f29d7d56d9383081da14cd8f29bd6678e4b5a17a068070935a5b6579c2
Contents?: true
Size: 1.66 KB
Versions: 166
Compression:
Stored size: 1.66 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 %>' /> <!-- <h4 style="color:red;">WARNING: Changing the page layout will delete all existing content from the page.</h4> --> <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
166 entries across 166 versions & 1 rubygems