caboose-cms 0.3.129 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/caboose/admin_block_edit.js +267 -0
- data/app/assets/javascripts/caboose/admin_page_edit_content.js +71 -45
- data/app/assets/javascripts/caboose/admin_page_edit_content_bak.js +164 -0
- data/app/assets/javascripts/caboose/admin_page_new_blocks.js +4 -4
- data/app/assets/stylesheets/caboose/admin_page_edit_content.css +37 -16
- data/app/controllers/caboose/block_types_controller.rb +162 -0
- data/app/controllers/caboose/blocks_controller.rb +293 -0
- data/app/controllers/caboose/edit_controller.rb +33 -0
- data/app/controllers/caboose/pages_controller.rb +4 -3
- data/app/controllers/caboose/posts_controller.rb +1 -1
- data/app/models/caboose/block.rb +222 -0
- data/app/models/caboose/block_type.rb +28 -0
- data/app/models/caboose/core_plugin.rb +6 -6
- data/app/models/caboose/page.rb +8 -4
- data/app/models/caboose/schema.rb +90 -59
- data/app/models/caboose/utilities/schema.rb +3 -3
- data/app/views/caboose/block_types/admin_edit.html.erb +111 -0
- data/app/views/caboose/{page_block_types → block_types}/admin_index.html.erb +2 -2
- data/app/views/caboose/{page_block_types → block_types}/admin_new.html.erb +9 -6
- data/app/views/caboose/blocks/_block.html.erb +8 -0
- data/app/views/caboose/blocks/_heading.html.erb +7 -0
- data/app/views/caboose/blocks/_html.html.erb +7 -0
- data/app/views/caboose/blocks/_image.html.erb +0 -0
- data/app/views/caboose/blocks/_layout_default.html.erb +33 -0
- data/app/views/caboose/blocks/_layout_default_content.html.erb +16 -0
- data/app/views/caboose/blocks/_layout_default_footer.html.erb +20 -0
- data/app/views/caboose/blocks/_layout_default_header.html.erb +32 -0
- data/app/views/caboose/blocks/_richtext.html.erb +7 -0
- data/app/views/caboose/{page_blocks/_richtext.html.erb → blocks/_text.html.erb} +1 -2
- data/app/views/caboose/blocks/admin_edit.html.erb +106 -0
- data/app/views/caboose/{page_blocks → blocks}/admin_edit_custom.html.erb +0 -0
- data/app/views/caboose/{page_blocks → blocks}/admin_edit_h1.html.erb +0 -0
- data/app/views/caboose/{page_blocks → blocks}/admin_edit_h2.html.erb +0 -0
- data/app/views/caboose/{page_blocks → blocks}/admin_edit_h3.html.erb +0 -0
- data/app/views/caboose/{page_blocks → blocks}/admin_edit_h4.html.erb +0 -0
- data/app/views/caboose/{page_blocks → blocks}/admin_edit_h5.html.erb +0 -0
- data/app/views/caboose/{page_blocks → blocks}/admin_edit_h6.html.erb +0 -0
- data/app/views/caboose/{page_blocks → blocks}/admin_edit_richtext.html.erb +0 -0
- data/app/views/caboose/blocks/admin_new.html.erb +55 -0
- data/app/views/caboose/pages/_admin_header.html.erb +1 -1
- data/app/views/caboose/pages/_content.html.erb +1 -1
- data/app/views/caboose/pages/_new_block_header.html.erb +13 -0
- data/app/views/caboose/pages/admin_edit_content.html.erb +24 -20
- data/app/views/caboose/pages/show.html.erb +13 -30
- data/app/views/layouts/caboose/application.html.erb +26 -14
- data/config/routes.rb +38 -30
- data/lib/caboose/engine.rb +2 -2
- data/lib/caboose/version.rb +1 -1
- metadata +33 -35
- data/app/controllers/caboose/page_block_field_values_controller.rb +0 -55
- data/app/controllers/caboose/page_block_fields_controller.rb +0 -123
- data/app/controllers/caboose/page_block_types_controller.rb +0 -100
- data/app/controllers/caboose/page_blocks_controller.rb +0 -165
- data/app/models/caboose/page_block.rb +0 -49
- data/app/models/caboose/page_block_field.rb +0 -21
- data/app/models/caboose/page_block_field_value.rb +0 -39
- data/app/models/caboose/page_block_renderers/h1.rb +0 -5
- data/app/models/caboose/page_block_renderers/h2.rb +0 -5
- data/app/models/caboose/page_block_renderers/h3.rb +0 -5
- data/app/models/caboose/page_block_renderers/h4.rb +0 -5
- data/app/models/caboose/page_block_renderers/h5.rb +0 -5
- data/app/models/caboose/page_block_renderers/h6.rb +0 -5
- data/app/models/caboose/page_block_renderers/p.rb +0 -5
- data/app/models/caboose/page_block_renderers/richtext.rb +0 -5
- data/app/models/caboose/page_block_type.rb +0 -12
- data/app/views/caboose/page_block_fields/admin_edit.html.erb +0 -77
- data/app/views/caboose/page_block_fields/admin_new.html.erb +0 -30
- data/app/views/caboose/page_block_types/admin_edit.html.erb +0 -82
- data/app/views/caboose/page_blocks/_heading.html.erb +0 -7
- data/app/views/caboose/page_blocks/_partial.html.erb +0 -11
- data/app/views/caboose/page_blocks/admin_edit.html.erb +0 -69
@@ -40,7 +40,8 @@ class Caboose::Utilities::Schema
|
|
40
40
|
return if self.schema.nil?
|
41
41
|
|
42
42
|
rename_tables
|
43
|
-
rename_columns
|
43
|
+
rename_columns
|
44
|
+
remove_columns
|
44
45
|
|
45
46
|
c = ActiveRecord::Base.connection
|
46
47
|
self.schema.each do |model, columns|
|
@@ -74,8 +75,7 @@ class Caboose::Utilities::Schema
|
|
74
75
|
end
|
75
76
|
end
|
76
77
|
end
|
77
|
-
|
78
|
-
remove_columns
|
78
|
+
|
79
79
|
create_indexes
|
80
80
|
|
81
81
|
self.schema.each do |model, columns|
|
@@ -0,0 +1,111 @@
|
|
1
|
+
<%
|
2
|
+
bt = @block_type
|
3
|
+
%>
|
4
|
+
|
5
|
+
<h1>Edit Block Type</h1>
|
6
|
+
<p><div id='blocktype_<%= bt.id %>_parent_id'></div></p>
|
7
|
+
<p><div id='blocktype_<%= bt.id %>_name'></div></p>
|
8
|
+
<p><div id='blocktype_<%= bt.id %>_description'></div></p>
|
9
|
+
<p><div id='blocktype_<%= bt.id %>_field_type'></div></p>
|
10
|
+
|
11
|
+
|
12
|
+
<p><div id='blocktype_<%= bt.id %>_default'></div></p>
|
13
|
+
<p><div id='blocktype_<%= bt.id %>_width'></div></p>
|
14
|
+
<p><div id='blocktype_<%= bt.id %>_height'></div></p>
|
15
|
+
<p><div id='blocktype_<%= bt.id %>_fixed_placeholder'></div></p>
|
16
|
+
<p><div id='blocktype_<%= bt.id %>_options_url'></div></p>
|
17
|
+
<p><div id='blocktype_<%= bt.id %>_options'></div></p>
|
18
|
+
|
19
|
+
<p><div id='blocktype_<%= bt.id %>_use_render_function'></div></p>
|
20
|
+
<p><div id='blocktype_<%= bt.id %>_use_render_function_for_layout'></div></p>
|
21
|
+
<p><div id='blocktype_<%= bt.id %>_allow_child_blocks'></div></p>
|
22
|
+
<p><div id='blocktype_<%= bt.id %>_render_function'></div></p>
|
23
|
+
<p><div id='blocktype_<%= bt.id %>_options_function'></div></p>
|
24
|
+
|
25
|
+
<h2>Children</h2>
|
26
|
+
<p><a href='/admin/block-types/<%= @block_type.id %>/new'>New Child Block</a></p>
|
27
|
+
<% if @block_type.children.count > 0 %>
|
28
|
+
<table class='data'>
|
29
|
+
<tr>
|
30
|
+
<th>Short Name</th>
|
31
|
+
<th>Long Name</th>
|
32
|
+
<th>Field Type</th>
|
33
|
+
</tr>
|
34
|
+
<% bt.children.each do |bt2| %>
|
35
|
+
<tr onclick="window.location='/admin/block-types/<%= bt2.id %>/edit';">
|
36
|
+
<td><%= bt2.name %></td>
|
37
|
+
<td><%= bt2.description %></td>
|
38
|
+
<td><%= bt2.field_type %></td>
|
39
|
+
</tr>
|
40
|
+
<% end %>
|
41
|
+
</table><br />
|
42
|
+
<% else %>
|
43
|
+
<p>This type of page block doesn't have any fields.</p>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<div id='message'></div>
|
47
|
+
<p>
|
48
|
+
<input type='button' value='< Back' onclick="window.location='/admin/block-types<%= bt.parent_id && bt.parent_id > 0 ? "/#{bt.parent_id}/edit" : '' %>';" />
|
49
|
+
<input type='button' value='Delete Block Type' onclick="delete_block_type(<%= @block_type.id %>);" />
|
50
|
+
</p>
|
51
|
+
|
52
|
+
<% content_for :caboose_css do %>
|
53
|
+
<style type='text/css'>
|
54
|
+
#blocktype_<%= bt.id %>_render_function { font-family: Courier; font-size: 80%; width: 100%; }
|
55
|
+
#blocktype_<%= bt.id %>_options_function { font-family: Courier; font-size: 80%; width: 100%; }
|
56
|
+
</style>
|
57
|
+
<% end %>
|
58
|
+
<% content_for :caboose_js do %>
|
59
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
60
|
+
<script type="text/javascript">
|
61
|
+
|
62
|
+
function delete_block_type(block_type_id, confirm)
|
63
|
+
{
|
64
|
+
if (!confirm)
|
65
|
+
{
|
66
|
+
var p = $('<p/>').addClass('note warning')
|
67
|
+
.append('Are you sure you want to delete the block type? ')
|
68
|
+
.append($('<input/>').attr('type', 'button').val('Yes').click(function() { delete_block_type(block_type_id, true); })).append(" ")
|
69
|
+
.append($('<input/>').attr('type', 'button').val('No' ).click(function() { $('#message').empty(); }));
|
70
|
+
$('#message').empty().append(p);
|
71
|
+
return;
|
72
|
+
}
|
73
|
+
$('#message').empty().append($('<p/>').addClass('loading').html('Deleting block type...'));
|
74
|
+
$.ajax({
|
75
|
+
url: '/admin/block-types/' + block_type_id,
|
76
|
+
type: 'delete',
|
77
|
+
success: function(resp) {
|
78
|
+
if (resp.error) $('#message').empty().append($('<p/>').addClass('note error').html(resp.error));
|
79
|
+
if (resp.redirect) window.location = resp.redirect;
|
80
|
+
}
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
$(document).ready(function() {
|
85
|
+
m = new ModelBinder({
|
86
|
+
name: 'BlockType',
|
87
|
+
id: <%= @block_type.id %>,
|
88
|
+
update_url: '/admin/block-types/<%= @block_type.id %>',
|
89
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
90
|
+
attributes: [
|
91
|
+
{ name: 'parent_id' , nice_name: 'Parent' , type: 'select' , value: <%= raw Caboose.json(bt.parent_id) %>, width: 400, options_url: '/admin/block-types/tree-options' },
|
92
|
+
{ name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(bt.name) %>, width: 400 },
|
93
|
+
{ name: 'description' , nice_name: 'Description' , type: 'text' , value: <%= raw Caboose.json(bt.description) %>, width: 400 },
|
94
|
+
{ name: 'use_render_function' , nice_name: 'Use Render Function' , type: 'checkbox' , value: <%= bt.use_render_function ? 'true' : 'false' %>, width: 400 },
|
95
|
+
{ name: 'use_render_function_for_layout' , nice_name: 'Use Render Function for Layout' , type: 'checkbox' , value: <%= bt.use_render_function_for_layout ? 'true' : 'false' %>, width: 400 },
|
96
|
+
{ name: 'allow_child_blocks' , nice_name: 'Allow Child Blocks' , type: 'checkbox' , value: <%= bt.allow_child_blocks ? 'true' : 'false' %>, width: 400 },
|
97
|
+
{ name: 'render_function' , nice_name: 'Render Function' , type: 'textarea' , value: <%= raw Caboose.json(bt.render_function) %>, width: 800, height: 200 },
|
98
|
+
{ name: 'field_type' , nice_name: 'Field type' , type: 'select' , value: <%= raw Caboose.json(bt.field_type) %>, text: <%= raw Caboose.json(bt.field_type) %>, width: 400, options_url: '/admin/block-types/field-type-options' },
|
99
|
+
{ name: 'default' , nice_name: 'Default value' , type: 'text' , value: <%= raw Caboose.json(bt.default) %>, width: 400 },
|
100
|
+
{ name: 'width' , nice_name: 'Width' , type: 'text' , value: <%= raw Caboose.json(bt.width) %>, width: 400 },
|
101
|
+
{ name: 'height' , nice_name: 'Height' , type: 'text' , value: <%= raw Caboose.json(bt.height) %>, width: 400 },
|
102
|
+
{ name: 'fixed_placeholder' , nice_name: 'Fixed placeholder' , type: 'checkbox' , value: <%= raw Caboose.json(bt.fixed_placeholder) %>, width: 400 },
|
103
|
+
{ name: 'options_url' , nice_name: 'Options URL' , type: 'text' , value: <%= raw Caboose.json(bt.options_url) %>, width: 400 },
|
104
|
+
{ name: 'options_function' , nice_name: 'Options Function' , type: 'textarea' , value: <%= raw Caboose.json(bt.options_function) %>, width: 400, height: 100 },
|
105
|
+
{ name: 'options' , nice_name: 'Options' , type: 'textarea' , value: <%= raw Caboose.json(bt.options) %>, width: 400, height: 100 }
|
106
|
+
]
|
107
|
+
});
|
108
|
+
});
|
109
|
+
|
110
|
+
</script>
|
111
|
+
<% end %>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h1>Page Block Types</h1>
|
2
2
|
|
3
|
-
<p><a href='/admin/
|
3
|
+
<p><a href='/admin/block-types/new'>New Block Type</a></p>
|
4
4
|
|
5
5
|
<% if (@block_types.count > 0) %>
|
6
6
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
<th>Description</th>
|
11
11
|
</tr>
|
12
12
|
<% @block_types.each do |bt| %>
|
13
|
-
<tr onclick="window.location='/admin/
|
13
|
+
<tr onclick="window.location='/admin/block-types/<%= bt.id %>/edit';">
|
14
14
|
<td><%= bt.name %></td>
|
15
15
|
<td><%= bt.description %></td>
|
16
16
|
</tr>
|
@@ -1,11 +1,16 @@
|
|
1
1
|
|
2
2
|
<h1>New Block Type</h1>
|
3
|
+
<form action='/admin/block-types' method='post' id='new_block_type_form'>
|
4
|
+
<input type='hidden' name='authenticity_token' value='<%= form_authenticity_token %>' />
|
5
|
+
<input type='hidden' name='parent_id' value='<%= @parent_id %>' />
|
6
|
+
<input type='hidden' name='field_type' value='block' />
|
3
7
|
<p><input type='text' id='name' name='name' placeholder='Name' /></p>
|
4
8
|
<div id='message'></div>
|
5
9
|
<p>
|
6
|
-
<input type='button' value='< Back' onclick="window.location='/admin/
|
7
|
-
<input type='button' value='Add
|
10
|
+
<input type='button' value='< Back' onclick="window.location='/admin/block-types';" />
|
11
|
+
<input type='button' value='Add Block Type' onclick="add_block_type();" />
|
8
12
|
</p>
|
13
|
+
</form>
|
9
14
|
|
10
15
|
<% content_for :caboose_js do %>
|
11
16
|
<script type='text/javascript'>
|
@@ -14,11 +19,9 @@ function add_block_type()
|
|
14
19
|
{
|
15
20
|
$('#message').empty().append($('<p/>').addClass('loading').html('Adding block type...'));
|
16
21
|
$.ajax({
|
17
|
-
url: '/admin/
|
22
|
+
url: '/admin/block-types',
|
18
23
|
type: 'post',
|
19
|
-
data:
|
20
|
-
name: $('#name').val()
|
21
|
-
},
|
24
|
+
data: $('#new_block_type_form').serialize(),
|
22
25
|
success: function(resp) {
|
23
26
|
if (resp.error) $('#message').empty().append($('<p/>').addClass('note error').html(resp.error));
|
24
27
|
if (resp.redirect) window.location = resp.redirect;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div id='block_<%= block.id %>'>
|
2
|
+
<% if block.children.count > 0 %>
|
3
|
+
<% block.children.each do |b| %><%= raw block.render(b, local_assigns) %><% end %>
|
4
|
+
<% elsif editing %>
|
5
|
+
<%= raw empty_text %>
|
6
|
+
<% end %>
|
7
|
+
<% if editing && !modal %><%= raw block.child_block_link %><% end %>
|
8
|
+
</div>
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%
|
2
|
+
page = block.page
|
3
|
+
%><!DOCTYPE html>
|
4
|
+
<!--[if lt IE 7]><html class="no-js ie lt-ie9 lt-ie8 lt-ie7" lang="en"><![endif]-->
|
5
|
+
<!--[if IE 7]><html class="no-js ie ie7 lt-ie9 lt-ie8" lang="en"><![endif]-->
|
6
|
+
<!--[if IE 8]><html class="no-js ie ie8 lt-ie9" lang="en"><![endif]-->
|
7
|
+
<!--[if IE 9]><html class="no-js ie ie9" lang="en"><![endif]-->
|
8
|
+
<!--[if !IE]><!--> <html class="no-js" lang="en"><!--<![endif]-->
|
9
|
+
<head>
|
10
|
+
<meta charset="utf-8" />
|
11
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1" />
|
12
|
+
<title><%= !page.title.nil? && page.title.strip.length > 0 ? "#{page.title} | " : "" %>Truesouth</title>
|
13
|
+
<meta name="description" content="" />
|
14
|
+
<meta name="viewport" content="width=device-width" />
|
15
|
+
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAzhmPHU-MEhWXbpvAdZRjd0-ZmVy-KYA8&sensor=false"></script>
|
16
|
+
<%= raw css %>
|
17
|
+
<%= stylesheet_link_tag 'print', :media => 'print' %>
|
18
|
+
<%
|
19
|
+
#= csrf_meta_tags
|
20
|
+
%>
|
21
|
+
</head>
|
22
|
+
<body>
|
23
|
+
<div class="container" id='block_<%= block.id %>'>
|
24
|
+
<!--[if lt IE 7]>
|
25
|
+
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
|
26
|
+
<![endif]-->
|
27
|
+
<%= raw block.render('layout_default_header' , local_assigns) %>
|
28
|
+
<%= raw block.render('layout_default_content', local_assigns) %>
|
29
|
+
<%= raw block.render('layout_default_footer' , local_assigns) %>
|
30
|
+
</div>
|
31
|
+
<%= raw js %>
|
32
|
+
</body>
|
33
|
+
</html>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<div class="page_wrap" id='block_<%= block.id %>'>
|
2
|
+
<div class="page_body">
|
3
|
+
<div class="page_content">
|
4
|
+
<div class="icons-social">
|
5
|
+
<ul>
|
6
|
+
<li><a class="icon-twitter" href="https://twitter.com/truesouthprop"></a></li>
|
7
|
+
<li><a class="icon-facebook" href="https://www.facebook.com/pages/TrueSouth-Properties/144790345550944"></a></li>
|
8
|
+
</ul>
|
9
|
+
</div>
|
10
|
+
<% if block.children.count > 0 %>
|
11
|
+
<% block.children.each do |b| %><%= raw block.render(b, local_assigns) %><% end %>
|
12
|
+
<% end %>
|
13
|
+
<% if editing %><%= raw block.child_block_link %><% end %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<div class="footer" id='block_<%= block.id %>'>
|
2
|
+
<div class="constrain">
|
3
|
+
<div class="nav">
|
4
|
+
<ul>
|
5
|
+
<li><a href="/">Home</a></li>
|
6
|
+
<li><a href="/about">About</a></li>
|
7
|
+
<li><a href="/services">Services</a></li>
|
8
|
+
<li><a href="/properties/category/land">Land</a></li>
|
9
|
+
<li><a href="/properties/category/commercial">Commercial</a></li>
|
10
|
+
<li><a href="/properties/category/residential">Residential</a></li>
|
11
|
+
<li><a href="/properties/category/rural">Rural</a></li>
|
12
|
+
<li><a href="/contact/montgomery">Contact</a></li>
|
13
|
+
</ul>
|
14
|
+
</div>
|
15
|
+
<div class="nine">
|
16
|
+
<span>site designed, built and loved by:</span>
|
17
|
+
<a href="http://www.nine.is" target="_blank"><div class="logo"></div></a>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div class="header" id="block_<%= block.id %>">
|
2
|
+
<div class="constrain">
|
3
|
+
<a href="/"><div class="logo" style="width: <%= block.child('logo_size').value %>;"></div></a>
|
4
|
+
<a href="/"><div class="mobile_logo"></div></a>
|
5
|
+
<div class='register'><a href='/newsletter'>Sign up for our newsletter</a></div>
|
6
|
+
<div class="nav">
|
7
|
+
<ul>
|
8
|
+
<li><a href="/">Home</a></li>
|
9
|
+
<li><a href="/about">About</a></li>
|
10
|
+
<li><a href="/properties/category/land">Land</a></li>
|
11
|
+
<li><a href="/properties/category/commercial">Commercial</a></li>
|
12
|
+
<li><a href="/properties/category/rural">Rural</a></li>
|
13
|
+
<li><a href="/properties/category/residential">Residential</a></li>
|
14
|
+
<li><a href="/services">Services</a></li>
|
15
|
+
<li><a href="/contact/montgomery">Contact Us</a></li>
|
16
|
+
</ul>
|
17
|
+
</div>
|
18
|
+
<a id="show_menu" href="#sidr"><img src="//d323vxen8l6os.cloudfront.net/assets/icons/sidr.png"></a>
|
19
|
+
<div id="sidr" style="display:none;">
|
20
|
+
<ul>
|
21
|
+
<li><a href="/">Home</a></li>
|
22
|
+
<li><a href="/about">About</a></li>
|
23
|
+
<li><a href="/services">Services</a></li>
|
24
|
+
<li><a href="/properties/category/land">Land</a></li>
|
25
|
+
<li><a href="/properties/category/commercial">Commercial</a></li>
|
26
|
+
<li><a href="/properties/category/residential">Residential</a></li>
|
27
|
+
<li><a href="/properties/category/rural">Rural</a></li>
|
28
|
+
<li><a href="/contact/montgomery">Contact</a></li>
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
</div>
|
@@ -0,0 +1,106 @@
|
|
1
|
+
<%
|
2
|
+
update_on_close = false
|
3
|
+
@block.block_type.children.each do |bt|
|
4
|
+
update_on_close = true if bt.field_type == 'image' || bt.field_type == 'file'
|
5
|
+
end
|
6
|
+
|
7
|
+
crumbs = []
|
8
|
+
b = @block
|
9
|
+
while b
|
10
|
+
href = b.id == @block.id ? "#" : "/admin/pages/#{b.page_id}/blocks/#{b.id}/edit"
|
11
|
+
onclick = b.id == @block.id ? " onclick=\"$('#block_#{@block.id}_block_type_id_container').slideToggle(100, function() { modal.autosize(); });\"" : ''
|
12
|
+
text = b.name ? "#{b.block_type.description} (#{b.name})" : b.block_type.description
|
13
|
+
crumbs << "<a href=\"#{href}\"#{onclick}>#{text}</a>"
|
14
|
+
b = b.parent
|
15
|
+
end
|
16
|
+
|
17
|
+
%>
|
18
|
+
<!--<h2 style='margin-top: 0; padding-top: 0;'>Edit <%= @block.name ? @block.name : @block.block_type.description %></h2>-->
|
19
|
+
<h2 style='margin-top: 0; padding-top: 0;'><%= raw crumbs.reverse.join(' > ') %></h2>
|
20
|
+
<p id='block_type_container'><div id='block_<%= @block.id %>_block_type_id'></div></p>
|
21
|
+
|
22
|
+
<% if @block.block_type.use_render_function_for_layout %>
|
23
|
+
<!-- Start -->
|
24
|
+
<%= raw @block.render(@block, {
|
25
|
+
:modal => true,
|
26
|
+
:empty_text => '[Empty, click to edit]',
|
27
|
+
:editing => true
|
28
|
+
}) %>
|
29
|
+
<!-- Stop -->
|
30
|
+
<% elsif @block.block_type.field_type != 'block' %>
|
31
|
+
<p><div id='block_<%= @block.id %>_value'></div></p>
|
32
|
+
<% else %>
|
33
|
+
<% if @block.children.count > 0 %>
|
34
|
+
<% @block.children.each do |b| %>
|
35
|
+
<% if b.block_type.field_type != 'block' && b.block_type.field_type != 'richtext' %>
|
36
|
+
<p><div id='block_<%= b.id %>_value'></div></p>
|
37
|
+
<% else %>
|
38
|
+
<%= raw @block.render(b, {
|
39
|
+
:modal => true,
|
40
|
+
:empty_text => '[Empty, click to edit]',
|
41
|
+
:editing => true
|
42
|
+
}) %>
|
43
|
+
<% end %>
|
44
|
+
<% end %>
|
45
|
+
<% else %>
|
46
|
+
<p>This block doesn't have any content yet.
|
47
|
+
<% if @block.block_type.allow_child_blocks %>
|
48
|
+
<a href='/admin/pages/<%= @block.page_id %>/blocks/<%= @block.id %>/new'>Add a child block!</a>
|
49
|
+
<% end %>
|
50
|
+
</p>
|
51
|
+
<% end %>
|
52
|
+
<% end %>
|
53
|
+
<div id='message'></div>
|
54
|
+
<p>
|
55
|
+
<input type='button' value='Close' onclick="<% if update_on_close %>parent.controller.render_blocks();<% end %>modal.close();" />
|
56
|
+
<% if @block.name.nil? %>
|
57
|
+
<input type='button' value='Delete Block' onclick="controller.delete_block();" />
|
58
|
+
<% end %>
|
59
|
+
<input type='button' value='Move Up' onclick="controller.move_up();" />
|
60
|
+
<input type='button' value='Move Down' onclick="controller.move_down();" />
|
61
|
+
</p>
|
62
|
+
|
63
|
+
<% content_for :caboose_css do %>
|
64
|
+
<style type='text/css'>
|
65
|
+
.block { border: #ccc 1px dotted; }
|
66
|
+
#block_<%= @block.id %>_block_type_id_container { }
|
67
|
+
</style>
|
68
|
+
<% end %>
|
69
|
+
<% content_for :caboose_js do %>
|
70
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
71
|
+
<%= javascript_include_tag "caboose/admin_block_edit" %>
|
72
|
+
<script type='text/javascript'>
|
73
|
+
|
74
|
+
var modal = false;
|
75
|
+
$(window).load(function() {
|
76
|
+
modal = new CabooseModal(800);
|
77
|
+
});
|
78
|
+
|
79
|
+
<%
|
80
|
+
#b = @block, nil, {
|
81
|
+
# :include => [
|
82
|
+
# :block_type,
|
83
|
+
# :children => { :include => :block_type }
|
84
|
+
# ]
|
85
|
+
#})
|
86
|
+
#b.image
|
87
|
+
%>
|
88
|
+
|
89
|
+
var controller = false;
|
90
|
+
$(document).ready(function() {
|
91
|
+
controller = new BlockController({
|
92
|
+
block: <%= raw Caboose.json(@block.js_hash) %>,
|
93
|
+
authenticity_token: '<%= form_authenticity_token %>'
|
94
|
+
});
|
95
|
+
});
|
96
|
+
|
97
|
+
</script>
|
98
|
+
<% if @block.block_type.field_type == 'richtext' %>
|
99
|
+
<%= tinymce_assets %>
|
100
|
+
<script type='textjavascript'>
|
101
|
+
document.domain = "<%= Rails.application.config.action_controller.asset_host %>";
|
102
|
+
</script>
|
103
|
+
<%= tinymce :caboose, width: '800px', height:'300px' %>
|
104
|
+
<% end %>
|
105
|
+
|
106
|
+
<% end %>
|
File without changes
|
File without changes
|