caboose-cms 0.4.59 → 0.4.60
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 +38 -26
- data/app/controllers/caboose/block_types_controller.rb +1 -0
- data/app/controllers/caboose/blocks_controller.rb +45 -6
- data/app/controllers/caboose/pages_controller.rb +19 -1
- data/app/models/caboose/block.rb +15 -6
- data/app/models/caboose/block_type.rb +2 -0
- data/app/models/caboose/page.rb +1 -0
- data/app/models/caboose/schema.rb +2 -0
- data/app/views/caboose/block_types/admin_edit.html.erb +18 -18
- data/app/views/caboose/blocks/_file.html.erb +5 -5
- data/app/views/caboose/blocks/_selector_switch_one.html.erb +11 -0
- data/app/views/caboose/blocks/_selector_switch_three.html.erb +11 -0
- data/app/views/caboose/blocks/_selector_switch_two.html.erb +11 -0
- data/app/views/caboose/blocks/admin_edit.html.erb +5 -4
- data/app/views/caboose/blocks/admin_edit_advanced.html.erb +78 -0
- data/app/views/caboose/pages/admin_edit_seo.html.erb +2 -0
- data/config/routes.rb +3 -1
- data/lib/caboose/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDc1OWUzYTQ0YTY3MmNhNDAwODJjNTRhM2VjMTBiNTlkOGYxN2M2Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODNjNmFlNjYxODhjMzJhODVjYjExYmVlYWJiMzA4MGExOGZmYzI4Zg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2E4ZjgzNjg3MjJkNDYwMTY2ZDVjYmI1YjY2M2FhNGNhZGE3M2NlZjJkOGY5
|
10
|
+
MTNjNTI0ZWJiMTg3ODk1MzRjMWE2MTEzMmJhYmVlNTk2OWYzNzc3MDQ0ZjQ5
|
11
|
+
MjhhNzAzZmMxNjhiMGZkMjFlNGEwZTEyMTcyMjUxNTJiZWViNzQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGMzYzVkZmQ1OTFmNmQ1OWZjOWI0NzJjMmE2MmViZDE1MzI1MDhmZDI5Yzkx
|
14
|
+
YmI3ZjhkZDM3MjdkNTEwOTc5NDVlZTQ5MDIzNzQwYzU2YmY3YTkwOTRmM2Jl
|
15
|
+
ODRjYmZiNWE4MjJlMjZhOTdmMmViZDNkYmI0ZGQ4MjFhN2UzMDI=
|
@@ -14,7 +14,7 @@ BlockController.prototype = {
|
|
14
14
|
for (var thing in options)
|
15
15
|
this[thing] = options[thing];
|
16
16
|
|
17
|
-
this.set_block_type_editable();
|
17
|
+
//this.set_block_type_editable();
|
18
18
|
this.set_block_value_editable(this.block);
|
19
19
|
this.set_child_blocks_editable();
|
20
20
|
this.set_clickable();
|
@@ -77,31 +77,43 @@ BlockController.prototype = {
|
|
77
77
|
|
78
78
|
/****************************************************************************/
|
79
79
|
|
80
|
-
set_block_type_editable: function()
|
81
|
-
{
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
80
|
+
//set_block_type_editable: function()
|
81
|
+
//{
|
82
|
+
// var that = this;
|
83
|
+
// var b = this.block;
|
84
|
+
// m = new ModelBinder({
|
85
|
+
// name: 'Block',
|
86
|
+
// id: b.id,
|
87
|
+
// update_url: '/admin/pages/' + b.page_id + '/blocks/' + b.id,
|
88
|
+
// authenticity_token: that.authenticity_token,
|
89
|
+
// attributes: [{
|
90
|
+
// name: 'block_type_id',
|
91
|
+
// nice_name: 'Block type',
|
92
|
+
// type: 'select',
|
93
|
+
// value: b.block_type_id,
|
94
|
+
// text: b.block_type.name,
|
95
|
+
// width: 400,
|
96
|
+
// fixed_placeholder: true,
|
97
|
+
// options_url: '/admin/block-types/options',
|
98
|
+
// after_update: function() { parent.controller.render_blocks(); window.location.reload(true); },
|
99
|
+
// after_cancel: function() { parent.controller.render_blocks(); window.location.reload(true); },
|
100
|
+
// on_load: function() { that.modal.autosize(); }
|
101
|
+
// },{
|
102
|
+
// name: 'parent_id',
|
103
|
+
// nice_name: 'Parent ID',
|
104
|
+
// type: 'select',
|
105
|
+
// value: b.parent_id,
|
106
|
+
// text: b.parent_title,
|
107
|
+
// width: 400,
|
108
|
+
// fixed_placeholder: true,
|
109
|
+
// options_url: '/admin/pages/' + b.page_id + '/block-options',
|
110
|
+
// after_update: function() { parent.controller.render_blocks(); },
|
111
|
+
// after_cancel: function() { parent.controller.render_blocks(); },
|
112
|
+
// on_load: function() { that.modal.autosize(); }
|
113
|
+
// }]
|
114
|
+
// });
|
115
|
+
// $('#advanced').hide();
|
116
|
+
//},
|
105
117
|
|
106
118
|
set_block_value_editable: function(b)
|
107
119
|
{
|
@@ -77,6 +77,7 @@ module Caboose
|
|
77
77
|
when 'use_render_function' then bt.use_render_function = v
|
78
78
|
when 'use_render_function_for_layout' then bt.use_render_function_for_layout = v
|
79
79
|
when 'allow_child_blocks' then bt.allow_child_blocks = v
|
80
|
+
when 'default_child_block_type_id' then bt.default_child_block_type_id = v
|
80
81
|
when 'name' then bt.name = v
|
81
82
|
when 'field_type' then bt.field_type = v
|
82
83
|
when 'default' then bt.default = v
|
@@ -18,11 +18,28 @@ module Caboose
|
|
18
18
|
# GET /admin/pages/:page_id/blocks/new
|
19
19
|
def admin_new
|
20
20
|
return unless user_is_allowed('pages', 'add')
|
21
|
+
|
22
|
+
if params[:id]
|
23
|
+
block_type_id = params[:block_type_id]
|
24
|
+
block_type_id = Block.find(params[:id]).block_type.default_child_block_type_id if block_type_id.nil?
|
25
|
+
if block_type_id
|
26
|
+
b = Block.new
|
27
|
+
b.page_id = params[:page_id].to_i
|
28
|
+
b.parent_id = params[:id]
|
29
|
+
b.block_type_id = block_type_id
|
30
|
+
b.sort_order = Block.where(:parent_id => params[:id]).count
|
31
|
+
b.save
|
32
|
+
b.create_children
|
33
|
+
redirect_to "/admin/pages/#{b.page_id}/blocks/#{b.id}/edit"
|
34
|
+
return
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
21
38
|
@page = Page.find(params[:page_id])
|
22
39
|
@block = params[:id] ? Block.find(params[:id]) : Block.new(:page_id => params[:page_id])
|
23
40
|
@after_id = params[:after_id] ? params[:after_id] : nil
|
24
41
|
@before_id = params[:before_id] ? params[:before_id] : nil
|
25
|
-
render :layout => 'caboose/modal'
|
42
|
+
render :layout => 'caboose/modal'
|
26
43
|
end
|
27
44
|
|
28
45
|
# GET /admin/pages/:page_id/blocks/:id
|
@@ -149,6 +166,15 @@ module Caboose
|
|
149
166
|
end
|
150
167
|
end
|
151
168
|
|
169
|
+
# GET /admin/pages/:page_id/blocks/:id/advanced
|
170
|
+
def admin_edit_advanced
|
171
|
+
return unless user_is_allowed('pages', 'edit')
|
172
|
+
@page = Page.find(params[:page_id])
|
173
|
+
@block = Block.find(params[:id])
|
174
|
+
@block.create_children
|
175
|
+
render :layout => 'caboose/modal'
|
176
|
+
end
|
177
|
+
|
152
178
|
# POST /admin/pages/:page_id/blocks
|
153
179
|
# POST /admin/pages/:page_id/blocks/:id
|
154
180
|
def admin_create
|
@@ -223,7 +249,9 @@ module Caboose
|
|
223
249
|
params.each do |k,v|
|
224
250
|
case k
|
225
251
|
#when 'page_id' then b.page_id = v
|
226
|
-
when 'parent_id' then
|
252
|
+
when 'parent_id' then
|
253
|
+
b.parent_id = v
|
254
|
+
b.sort_order = Block.where(:parent_id => v).count
|
227
255
|
when 'block_type_id' then b.block_type_id = v
|
228
256
|
when 'sort_order' then b.sort_order = v
|
229
257
|
when 'name' then b.name = v
|
@@ -304,10 +332,21 @@ module Caboose
|
|
304
332
|
if b.sort_order == 0
|
305
333
|
resp.error = "The block is already at the top."
|
306
334
|
else
|
307
|
-
b2 =
|
308
|
-
|
309
|
-
|
310
|
-
|
335
|
+
b2 = nil
|
336
|
+
|
337
|
+
new_sort_order = b.sort_order - 1
|
338
|
+
while new_sort_order > 0 do
|
339
|
+
b2 = Block.where("parent_id = ? and sort_order = ?", b.parent_id, new_sort_order).first
|
340
|
+
break if b2
|
341
|
+
new_sort_order = new_sort_order - 1
|
342
|
+
end
|
343
|
+
if b2
|
344
|
+
b2.sort_order = new_sort_order + 1
|
345
|
+
b2.save
|
346
|
+
else
|
347
|
+
new_sort_order = 1
|
348
|
+
end
|
349
|
+
b.sort_order = new_sort_order
|
311
350
|
b.save
|
312
351
|
resp.success = "The block has been moved up successfully."
|
313
352
|
end
|
@@ -331,7 +331,7 @@ module Caboose
|
|
331
331
|
page[name.to_sym] = value
|
332
332
|
|
333
333
|
when 'title', 'menu_title', 'hide', 'layout', 'redirect_url',
|
334
|
-
'seo_title', 'meta_description', 'fb_description', 'gp_description', 'canonical_url'
|
334
|
+
'seo_title', 'meta_keywords', 'meta_description', 'fb_description', 'gp_description', 'canonical_url'
|
335
335
|
page[name.to_sym] = value
|
336
336
|
|
337
337
|
when 'linked_resources'
|
@@ -482,5 +482,23 @@ module Caboose
|
|
482
482
|
render :json => { 'uri' => p.uri }
|
483
483
|
end
|
484
484
|
|
485
|
+
# GET /admin/pages/:id/block-options
|
486
|
+
def admin_block_options
|
487
|
+
return unless user_is_allowed('pages', 'edit')
|
488
|
+
|
489
|
+
options = []
|
490
|
+
Block.where("parent_id is null and page_id = ?", params[:id]).reorder(:sort_order).all.each do |b|
|
491
|
+
admin_block_options_helper(options, b, "")
|
492
|
+
end
|
493
|
+
render :json => options
|
494
|
+
end
|
495
|
+
|
496
|
+
def admin_block_options_helper(options, b, prefix)
|
497
|
+
options << { 'value' => b.id, 'text' => "#{prefix}#{b.title}" }
|
498
|
+
b.children.each do |b2|
|
499
|
+
admin_block_options_helper(options, b2, "#{prefix} - ")
|
500
|
+
end
|
501
|
+
end
|
502
|
+
|
485
503
|
end
|
486
504
|
end
|
data/app/models/caboose/block.rb
CHANGED
@@ -52,8 +52,8 @@ class Caboose::Block < ActiveRecord::Base
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def full_name
|
55
|
-
return name if parent_id.nil?
|
56
|
-
return "#{parent.full_name}_#{name}"
|
55
|
+
return self.name if parent_id.nil?
|
56
|
+
return "#{parent.full_name}_#{self.name}"
|
57
57
|
end
|
58
58
|
|
59
59
|
def child_value(name)
|
@@ -161,8 +161,8 @@ class Caboose::Block < ActiveRecord::Base
|
|
161
161
|
#view = ActionView::Base.new(ActionController::Base.view_paths, options2, )
|
162
162
|
#view = ActionView::Base.new(options2[:view].view_renderer, {}, options2[:view].controller)
|
163
163
|
begin
|
164
|
-
full_name = block.full_name
|
165
|
-
full_name = "lksdjflskfjslkfjlskdfjlkjsdf" if full_name.nil? || full_name.length == 0
|
164
|
+
full_name = block.block_type.full_name
|
165
|
+
full_name = "lksdjflskfjslkfjlskdfjlkjsdf" if full_name.nil? || full_name.length == 0
|
166
166
|
str = view.render(:partial => "caboose/blocks/#{full_name}", :locals => options2)
|
167
167
|
rescue ActionView::MissingTemplate
|
168
168
|
begin
|
@@ -225,13 +225,22 @@ class Caboose::Block < ActiveRecord::Base
|
|
225
225
|
return "<div class='new_block_after' id='new_block_after_#{self.id}'>New Block</div>"
|
226
226
|
end
|
227
227
|
|
228
|
+
def title
|
229
|
+
str = "#{self.block_type.name}"
|
230
|
+
if self.name && self.name.strip.length > 0
|
231
|
+
str << " (#{self.name})"
|
232
|
+
end
|
233
|
+
return str
|
234
|
+
end
|
235
|
+
|
228
236
|
def js_hash
|
229
237
|
kids = self.children.collect { |b| b.js_hash }
|
230
|
-
bt = self.block_type
|
238
|
+
bt = self.block_type
|
231
239
|
return {
|
232
240
|
'id' => self.id,
|
233
241
|
'page_id' => self.page_id,
|
234
|
-
'parent_id' => self.parent_id,
|
242
|
+
'parent_id' => self.parent_id,
|
243
|
+
'parent_title' => self.parent ? self.parent.title : '',
|
235
244
|
'block_type_id' => self.block_type_id,
|
236
245
|
'sort_order' => self.sort_order,
|
237
246
|
'name' => self.name,
|
@@ -2,6 +2,7 @@
|
|
2
2
|
class Caboose::BlockType < ActiveRecord::Base
|
3
3
|
self.table_name = "block_types"
|
4
4
|
|
5
|
+
belongs_to :default_child_block_type, :foreign_key => 'default_child_block_type_id', :class_name => 'Caboose::BlockType'
|
5
6
|
belongs_to :block_type_category
|
6
7
|
belongs_to :parent, :foreign_key => 'parent_id', :class_name => 'Caboose::BlockType'
|
7
8
|
has_many :children, :foreign_key => 'parent_id', :class_name => 'Caboose::BlockType', :dependent => :destroy
|
@@ -13,6 +14,7 @@ class Caboose::BlockType < ActiveRecord::Base
|
|
13
14
|
:use_render_function,
|
14
15
|
:use_render_function_for_layout,
|
15
16
|
:allow_child_blocks,
|
17
|
+
:default_child_block_type_id,
|
16
18
|
:render_function,
|
17
19
|
:field_type,
|
18
20
|
:default,
|
data/app/models/caboose/page.rb
CHANGED
@@ -25,6 +25,7 @@ class Caboose::Page < ActiveRecord::Base
|
|
25
25
|
:linked_resources,
|
26
26
|
:layout,
|
27
27
|
:seo_title, # 70 chars
|
28
|
+
:meta_keywords,
|
28
29
|
:meta_description, # 156 chars
|
29
30
|
:meta_robots, # Multi-select options: none, noindex, nofollow, nosnippet, noodp, noarchive
|
30
31
|
:canonical_url,
|
@@ -89,6 +89,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
89
89
|
[ :use_render_function , :boolean , { :default => false }],
|
90
90
|
[ :use_render_function_for_layout , :boolean , { :default => false }],
|
91
91
|
[ :allow_child_blocks , :boolean , { :default => false }],
|
92
|
+
[ :default_child_block_type_id , :integer ],
|
92
93
|
[ :field_type , :string ],
|
93
94
|
[ :default , :text ],
|
94
95
|
[ :width , :integer ],
|
@@ -160,6 +161,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
160
161
|
[ :sort_order , :integer , { :default => 0 }],
|
161
162
|
[ :custom_sort_children , :boolean , { :default => false }],
|
162
163
|
[ :seo_title , :string , { :limit => 70 }],
|
164
|
+
[ :meta_keywords , :text ],
|
163
165
|
[ :meta_description , :string , { :limit => 156 }],
|
164
166
|
[ :meta_robots , :string , { :default => 'index, follow' }],
|
165
167
|
[ :canonical_url , :string ],
|
@@ -7,24 +7,23 @@ bt = @block_type
|
|
7
7
|
</div>
|
8
8
|
|
9
9
|
<h1>Edit Block Type</h1>
|
10
|
-
<p><div id='blocktype_<%= bt.id %>_description'></div></p>
|
11
|
-
<p><div id='blocktype_<%= bt.id %>_name'></div></p>
|
12
|
-
<p><div id='blocktype_<%= bt.id %>_parent_id'></div></p>
|
13
|
-
<p><div id='blocktype_<%= bt.id %>_block_type_category_id'></div></p>
|
14
|
-
<p><div id='blocktype_<%= bt.id %>_field_type'></div></p>
|
15
|
-
|
16
|
-
<p><div id='blocktype_<%= bt.id %>
|
17
|
-
<p><div id='blocktype_<%= bt.id %>
|
18
|
-
<p><div id='blocktype_<%= bt.id %>
|
19
|
-
<p><div id='blocktype_<%= bt.id %>
|
20
|
-
<p><div id='blocktype_<%= bt.id %>
|
21
|
-
<p><div id='blocktype_<%= bt.id %>
|
22
|
-
|
23
|
-
<p><div id='blocktype_<%= bt.id %>
|
24
|
-
<p><div id='blocktype_<%= bt.id %>
|
25
|
-
<p><div id='blocktype_<%= bt.id %>
|
26
|
-
<p><div id='blocktype_<%= bt.id %>
|
27
|
-
<p><div id='blocktype_<%= bt.id %>_options_function'></div></p>
|
10
|
+
<p><div id='blocktype_<%= bt.id %>_description' ></div></p>
|
11
|
+
<p><div id='blocktype_<%= bt.id %>_name' ></div></p>
|
12
|
+
<p><div id='blocktype_<%= bt.id %>_parent_id' ></div></p>
|
13
|
+
<p><div id='blocktype_<%= bt.id %>_block_type_category_id' ></div></p>
|
14
|
+
<p><div id='blocktype_<%= bt.id %>_field_type' ></div></p>
|
15
|
+
<p><div id='blocktype_<%= bt.id %>_default' ></div></p>
|
16
|
+
<p><div id='blocktype_<%= bt.id %>_width' ></div></p>
|
17
|
+
<p><div id='blocktype_<%= bt.id %>_height' ></div></p>
|
18
|
+
<p><div id='blocktype_<%= bt.id %>_fixed_placeholder' ></div></p>
|
19
|
+
<p><div id='blocktype_<%= bt.id %>_options_url' ></div></p>
|
20
|
+
<p><div id='blocktype_<%= bt.id %>_options' ></div></p>
|
21
|
+
<p><div id='blocktype_<%= bt.id %>_use_render_function' ></div></p>
|
22
|
+
<p><div id='blocktype_<%= bt.id %>_use_render_function_for_layout' ></div></p>
|
23
|
+
<p><div id='blocktype_<%= bt.id %>_allow_child_blocks' ></div></p>
|
24
|
+
<p><div id='blocktype_<%= bt.id %>_default_child_block_type_id' ></div></p>
|
25
|
+
<p><div id='blocktype_<%= bt.id %>_render_function' ></div></p>
|
26
|
+
<p><div id='blocktype_<%= bt.id %>_options_function' ></div></p>
|
28
27
|
|
29
28
|
<h2>Children</h2>
|
30
29
|
<p><a href='/admin/block-types/<%= @block_type.id %>/new'>New Child Block</a></p>
|
@@ -99,6 +98,7 @@ $(document).ready(function() {
|
|
99
98
|
{ name: 'use_render_function' , nice_name: 'Use Render Function' , type: 'checkbox' , value: <%= bt.use_render_function ? 'true' : 'false' %>, width: 400 },
|
100
99
|
{ 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 },
|
101
100
|
{ name: 'allow_child_blocks' , nice_name: 'Allow Child Blocks' , type: 'checkbox' , value: <%= bt.allow_child_blocks ? 'true' : 'false' %>, width: 400 },
|
101
|
+
{ name: 'default_child_block_type_id' , nice_name: 'Default Child Block Type' , type: 'select' , value: <%= raw Caboose.json(bt.default_child_block_type_id) %>, text: <%= raw Caboose.json(bt.default_child_block_type) %>, width: 400, options_url: '/admin/block-types/options' },
|
102
102
|
{ name: 'render_function' , nice_name: 'Render Function' , type: 'textarea' , value: <%= raw Caboose.json(bt.render_function) %>, width: 800, height: 200 },
|
103
103
|
{ 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' },
|
104
104
|
{ name: 'default' , nice_name: 'Default value' , type: 'text' , value: <%= raw Caboose.json(bt.default) %>, width: 400 },
|
@@ -1,11 +1,11 @@
|
|
1
1
|
<%
|
2
|
-
file = block.
|
3
|
-
text = block.
|
2
|
+
file = block.child_value('file')
|
3
|
+
text = block.child_value('text')
|
4
4
|
|
5
|
-
if editing && file && file.
|
5
|
+
if editing && file && file.url.include?('missing.png')
|
6
6
|
%><div id='block_<%= block.id %>'><p>Please upload a file.</p></div><%
|
7
|
-
elsif file
|
8
|
-
%><p><a href="<%= raw file.
|
7
|
+
elsif file
|
8
|
+
%><div id='block_<%= block.id %>'><p><a href="<%= raw file.url %>"><%= raw text %></a></p></div><%
|
9
9
|
end
|
10
10
|
|
11
11
|
%>
|
@@ -0,0 +1,11 @@
|
|
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 %>
|
8
|
+
<br style='clear: both;' />
|
9
|
+
<p><a href='/admin/pages/<%= block.page_id %>/blocks/<%= block.id %>/new'>Add a child block!</a></p>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
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 %>
|
8
|
+
<br style='clear: both;' />
|
9
|
+
<p><a href='/admin/pages/<%= block.page_id %>/blocks/<%= block.id %>/new'>Add a child block!</a></p>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
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 %>
|
8
|
+
<br style='clear: both;' />
|
9
|
+
<p><a href='/admin/pages/<%= block.page_id %>/blocks/<%= block.id %>/new'>Add a child block!</a></p>
|
10
|
+
<% end %>
|
11
|
+
</div>
|
@@ -8,16 +8,16 @@ crumbs = []
|
|
8
8
|
b = @block
|
9
9
|
while b
|
10
10
|
href = b.id == @block.id ? "#" : "/admin/pages/#{b.page_id}/blocks/#{b.id}/edit"
|
11
|
-
onclick = b.id == @block.id ? " onclick=\"$('#
|
11
|
+
#onclick = b.id == @block.id ? " onclick=\"$('#advanced').slideToggle(100, function() { modal.autosize(); });\"" : ''
|
12
12
|
text = b.name ? "#{b.block_type.description} (#{b.name})" : b.block_type.description
|
13
|
-
crumbs << "<a href=\"#{href}\"#{onclick}>#{text}</a>"
|
13
|
+
#crumbs << "<a href=\"#{href}\"#{onclick}>#{text}</a>"
|
14
|
+
crumbs << "<a href=\"#{href}\">#{text}</a>"
|
14
15
|
b = b.parent
|
15
16
|
end
|
16
17
|
|
17
18
|
%>
|
18
19
|
<!--<h2 style='margin-top: 0; padding-top: 0;'>Edit <%= @block.name ? @block.name : @block.block_type.description %></h2>-->
|
19
20
|
<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
21
|
|
22
22
|
<% if @block.block_type.use_render_function_for_layout %>
|
23
23
|
<!-- Start -->
|
@@ -57,6 +57,7 @@ end
|
|
57
57
|
<% end %>
|
58
58
|
<input type='button' value='Move Up' onclick="controller.move_up();" />
|
59
59
|
<input type='button' value='Move Down' onclick="controller.move_down();" />
|
60
|
+
<input type='button' value='Advanced' onclick="window.location='/admin/pages/<%= @block.page_id %>/blocks/<%= @block.id %>/advanced';" />
|
60
61
|
</p>
|
61
62
|
|
62
63
|
<% content_for :caboose_css do %>
|
@@ -86,7 +87,7 @@ $(window).load(function() {
|
|
86
87
|
%>
|
87
88
|
|
88
89
|
var controller = false;
|
89
|
-
$(document).ready(function() {
|
90
|
+
$(document).ready(function() {
|
90
91
|
modal = new CabooseModal(800);
|
91
92
|
controller = new BlockController({
|
92
93
|
block: <%= raw Caboose.json(@block.js_hash) %>,
|
@@ -0,0 +1,78 @@
|
|
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=\"$('#advanced').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
|
+
<div id='advanced'>
|
21
|
+
<p><div id='block_<%= @block.id %>_block_type_id' ></div></p>
|
22
|
+
<p><div id='block_<%= @block.id %>_parent_id' ></div></p>
|
23
|
+
</div>
|
24
|
+
<div id='message'></div>
|
25
|
+
<p>
|
26
|
+
<input type='button' value='< Back' onclick="window.location='/admin/pages/<%= @block.page_id %>/blocks/<%= @block.id %>/edit';" />
|
27
|
+
<input type='button' value='Close' onclick="<% if update_on_close %>parent.controller.render_blocks();<% end %>modal.close();" />
|
28
|
+
</p>
|
29
|
+
|
30
|
+
<% content_for :caboose_js do %>
|
31
|
+
<%= javascript_include_tag "caboose/model/all" %>
|
32
|
+
<%= javascript_include_tag "caboose/admin_block_edit" %>
|
33
|
+
<script type='text/javascript'>
|
34
|
+
|
35
|
+
var modal = false;
|
36
|
+
$(window).load(function() {
|
37
|
+
modal = new CabooseModal(800);
|
38
|
+
});
|
39
|
+
|
40
|
+
var controller = false;
|
41
|
+
<% b = @block %>
|
42
|
+
$(document).ready(function() {
|
43
|
+
modal = new CabooseModal(800);
|
44
|
+
m = new ModelBinder({
|
45
|
+
name: 'Block',
|
46
|
+
id: <%= b.id %>,
|
47
|
+
update_url: '/admin/pages/<%= b.page_id %>/blocks/<%= b.id %>',
|
48
|
+
authenticity_token: '<%= form_authenticity_token %>',
|
49
|
+
attributes: [{
|
50
|
+
name: 'block_type_id',
|
51
|
+
nice_name: 'Block type',
|
52
|
+
type: 'select',
|
53
|
+
value: <%= raw Caboose.json(b.block_type_id) %>,
|
54
|
+
text: <%= raw Caboose.json(b.block_type.name) %>,
|
55
|
+
width: 400,
|
56
|
+
fixed_placeholder: true,
|
57
|
+
options_url: '/admin/block-types/options',
|
58
|
+
after_update: function() { parent.controller.render_blocks(); },
|
59
|
+
after_cancel: function() { parent.controller.render_blocks(); },
|
60
|
+
on_load: function() { that.modal.autosize(); }
|
61
|
+
},{
|
62
|
+
name: 'parent_id',
|
63
|
+
nice_name: 'Parent ID',
|
64
|
+
type: 'select',
|
65
|
+
value: <%= raw Caboose.json(b.parent_id) %>,
|
66
|
+
text: <%= raw Caboose.json(b.parent ? b.parent.title : '') %>,
|
67
|
+
width: 400,
|
68
|
+
fixed_placeholder: true,
|
69
|
+
options_url: '/admin/pages/<%= b.page_id %>/block-options',
|
70
|
+
after_update: function() { parent.controller.render_blocks(); },
|
71
|
+
after_cancel: function() { parent.controller.render_blocks(); },
|
72
|
+
on_load: function() { that.modal.autosize(); }
|
73
|
+
}]
|
74
|
+
});
|
75
|
+
});
|
76
|
+
|
77
|
+
</script>
|
78
|
+
<% end %>
|
@@ -2,6 +2,7 @@
|
|
2
2
|
<%= render :partial => 'caboose/pages/admin_header' %>
|
3
3
|
|
4
4
|
<p><div id='page_<%= @page.id %>_seo_title'></div></p>
|
5
|
+
<p><div id='page_<%= @page.id %>_meta_keywords'></div></p>
|
5
6
|
<p><div id='page_<%= @page.id %>_meta_description'></div></p>
|
6
7
|
<p><div id='page_<%= @page.id %>_meta_robots'></div></p>
|
7
8
|
<p><div id='page_<%= @page.id %>_canonical_url'></div></p>
|
@@ -24,6 +25,7 @@ $(document).ready(function() {
|
|
24
25
|
{ name: 'seo_title' , nice_name: 'SEO Title' , type: 'text' , value: <%= raw Caboose.json(@page.seo_title) %>, width: 580 },
|
25
26
|
{ name: 'meta_robots' , nice_name: 'Meta Robots' , type: 'text' , value: <%= raw Caboose.json(@page.meta_robots) %>, width: 580 },
|
26
27
|
{ name: 'canonical_url' , nice_name: 'Canonical URL' , type: 'text' , value: <%= raw Caboose.json(@page.canonical_url) %>, width: 580 },
|
28
|
+
{ name: 'meta_keywords' , nice_name: 'Meta Keywords' , type: 'textarea' , value: <%= raw Caboose.json(@page.meta_keywords) %>, width: 580, height: 80 },
|
27
29
|
{ name: 'meta_description' , nice_name: 'Meta Description' , type: 'textarea' , value: <%= raw Caboose.json(@page.meta_description) %>, width: 580, height: 80 },
|
28
30
|
{ name: 'fb_description' , nice_name: 'Facebook Description' , type: 'textarea' , value: <%= raw Caboose.json(@page.fb_description) %>, width: 580, height: 80 },
|
29
31
|
{ name: 'gp_description' , nice_name: 'Google+ Description' , type: 'textarea' , value: <%= raw Caboose.json(@page.gp_description) %>, width: 580, height: 80 }
|
data/config/routes.rb
CHANGED
@@ -92,11 +92,12 @@ Caboose::Engine.routes.draw do
|
|
92
92
|
|
93
93
|
#get "pages" => "pages#index"
|
94
94
|
get "pages/:id" => "pages#show"
|
95
|
-
get "pages/:id/redirect" => "pages#redirect"
|
95
|
+
get "pages/:id/redirect" => "pages#redirect"
|
96
96
|
get "admin/pages/sitemap-options" => "pages#admin_sitemap_options"
|
97
97
|
get "admin/pages/robots-options" => "pages#admin_robots_options"
|
98
98
|
get "admin/pages/format-options" => "pages#admin_content_format_options"
|
99
99
|
get "admin/pages/new" => "pages#admin_new"
|
100
|
+
get "admin/pages/:id/block-options" => "pages#admin_block_options"
|
100
101
|
get "admin/pages/:id/uri" => "pages#admin_page_uri"
|
101
102
|
get "admin/pages/:id/delete" => "pages#admin_delete_form"
|
102
103
|
get "admin/pages/:id/sitemap" => "pages#admin_sitemap"
|
@@ -132,6 +133,7 @@ Caboose::Engine.routes.draw do
|
|
132
133
|
get "admin/pages/:page_id/blocks/:id/tree" => "blocks#admin_tree"
|
133
134
|
get "admin/pages/:page_id/blocks/:id/render" => "blocks#admin_render"
|
134
135
|
get "admin/pages/:page_id/blocks/:id/edit" => "blocks#admin_edit"
|
136
|
+
get "admin/pages/:page_id/blocks/:id/advanced" => "blocks#admin_edit_advanced"
|
135
137
|
put "admin/pages/:page_id/blocks/:id/move-up" => "blocks#admin_move_up"
|
136
138
|
put "admin/pages/:page_id/blocks/:id/move-down" => "blocks#admin_move_down"
|
137
139
|
get "admin/pages/:page_id/blocks/:id" => "blocks#admin_show"
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: caboose-cms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.60
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -353,8 +353,12 @@ files:
|
|
353
353
|
- app/views/caboose/blocks/_layout_right_sidebar_sidebar.html.erb
|
354
354
|
- app/views/caboose/blocks/_render_function.html.erb
|
355
355
|
- app/views/caboose/blocks/_richtext.html.erb
|
356
|
+
- app/views/caboose/blocks/_selector_switch_one.html.erb
|
357
|
+
- app/views/caboose/blocks/_selector_switch_three.html.erb
|
358
|
+
- app/views/caboose/blocks/_selector_switch_two.html.erb
|
356
359
|
- app/views/caboose/blocks/_text.html.erb
|
357
360
|
- app/views/caboose/blocks/admin_edit.html.erb
|
361
|
+
- app/views/caboose/blocks/admin_edit_advanced.html.erb
|
358
362
|
- app/views/caboose/blocks/admin_edit_custom.html.erb
|
359
363
|
- app/views/caboose/blocks/admin_edit_h1.html.erb
|
360
364
|
- app/views/caboose/blocks/admin_edit_h2.html.erb
|