%
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 ? "#" : "/admin/pages/#{b.page_id}/blocks/#{b.id}/edit"
#onclick = b.id == @block.id ? " onclick=\"$('#advanced').slideToggle(100, function() { modal.autosize(); });\"" : ''
text = b.name ? "#{b.block_type.description} (#{b.name})" : b.block_type.description
#crumbs << "#{text}"
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.each do |b| %>
<% if b.block_type.field_type != 'block' && b.block_type.field_type != 'richtext' %>
<% else %>
<%
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 %>