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

Version Path
caboose-cms-0.5.113 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.112 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.111 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.110 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.109 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.108 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.107 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.106 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.105 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.104 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.103 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.102 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.101 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.100 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.99 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.98 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.97 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.96 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.95 app/views/caboose/pages/admin_edit_layout.html.erb
caboose-cms-0.5.94 app/views/caboose/pages/admin_edit_layout.html.erb