Sha256: 8a80e9a64c3b2b7362fb64ebf2d8b8b80ec7473b934c4b099b8323a8bbf289ba

Contents?: true

Size: 1.57 KB

Versions: 468

Compression:

Stored size: 1.57 KB

Contents

<%= render :partial => 'caboose/posts/admin_header' %>

<h2>Update Post Layout</h2>

<form action='/admin/posts/<%= @post.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/posts/<%= @post.id %>';" />
<input type='submit' value='Update Post Layout' />
</p>
</form>

<%= render :partial => 'caboose/posts/admin_footer' %>
<% content_for :caboose_js do %>
<script type='text/javascript'>

$(document).ready(function() {
  $('#layout_form').submit(function() {    
    update_post_layout(<%= @post.id %>);
    return false;
  });
});

function update_post_layout(post_id)
{
  $('#message').html("<p class='loading'>Updating layout...</p>");
  $.ajax({
    url: '/admin/posts/' + post_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

468 entries across 468 versions & 1 rubygems

Version Path
caboose-cms-0.9.229 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-1.0.2 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-1.0.1 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.228 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.227 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.226 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.225 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.224 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.223 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.222 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.221 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.220 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.219 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.218 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.217 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.216 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.215 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.214 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.213 app/views/caboose/posts/admin_edit_layout.html.erb
caboose-cms-0.9.212 app/views/caboose/posts/admin_edit_layout.html.erb