<% base_url = @block.page_id ? "/admin/pages/#{@block.page_id}/blocks" : "/admin/posts/#{@block.post_id}/blocks" update_on_close = false @block.block_type.children.each do |bt| update_on_close = true if bt.field_type == 'image' || bt.field_type == 'file' end crumbs = [] b = @block while b href = b.id == @block.id ? "#" : "#{base_url}/#{b.id}/edit" text = b.name ? "#{b.block_type.description} (#{b.name})" : b.block_type.description crumbs << "#{text}" b = b.parent end %>

<%= raw crumbs.reverse.join(' > ') %>

<% if @block.block_type.use_render_function_for_layout %> <% str = @block.render(@block, { :modal => true, :empty_text => '[Empty, click to edit]', :editing => true, :view => self, :controller_view_content => yield, :css => '|CABOOSE_CSS|', :js => '|CABOOSE_JAVASCRIPT|', :csrf_meta_tags => '|CABOOSE_CSRF|', :csrf_meta_tags2 => '|CABOOSE_CSRF|', :logged_in_user => @logged_in_user, :site => @site }) str.gsub!('|CABOOSE_CSS|' , yield(:css)) str.gsub!('|CABOOSE_JAVASCRIPT|' , yield(:js)) str.gsub!('|CABOOSE_CSRF|' , csrf_meta_tags) %><%= raw str %> <% elsif @block.block_type.field_type != 'block' %>

<% else %> <% if @block.children.count > 0 %> <% @block.children.order(:sort_order).each do |b| %> <% if b.block_type.field_type != 'block' && b.block_type.field_type != 'richtext' && b.block_type.field_type != 'image' && b.block_type.field_type != 'file' %>
<% else %> <% #Caboose.log(b.value) #Caboose.log(b.name) #Caboose.log(b.block_type.full_name) #Caboose.log(b.block_type.name) #Caboose.log(b.block_type.field_type) str = @block.render(b, { :modal => true, :empty_text => '[Empty, click to edit]', :editing => true, :view => self, :controller_view_content => yield, :css => '|CABOOSE_CSS|', :js => '|CABOOSE_JAVASCRIPT|', :csrf_meta_tags => '|CABOOSE_CSRF|', :csrf_meta_tags2 => '|CABOOSE_CSRF|', :logged_in_user => @logged_in_user, :site => @site }) str.gsub!('|CABOOSE_CSS|' , yield(:css)) str.gsub!('|CABOOSE_JAVASCRIPT|' , yield(:js)) str.gsub!('|CABOOSE_CSRF|' , csrf_meta_tags) %><%= raw str %> <% end %> <% end %> <% else %>

This block doesn't have any content yet.

<% end %> <% if @block.block_type.allow_child_blocks %> Add a child block! <% end %> <% end %>

<% if @block.name.nil? %> <% end %>

<% content_for :caboose_css do %> <% end %> <% content_for :caboose_js do %> <%= javascript_include_tag "caboose/model/all" %> <%= javascript_include_tag "caboose/admin_block_edit" %> <% if @block.block_type.field_type == 'richtext' %> <%= raw caboose_tinymce %> <% end %> <% end %>