caboose-cms 0.4.145 → 0.4.146
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/controllers/caboose/block_type_sources_controller.rb +2 -2
- data/app/controllers/caboose/block_types_controller.rb +34 -11
- data/app/models/caboose/block.rb +6 -0
- data/app/models/caboose/block_type.rb +34 -5
- data/app/models/caboose/block_type_site_membership.rb +6 -0
- data/app/models/caboose/schema.rb +5 -2
- data/app/views/caboose/block_types/admin_edit.html.erb +38 -40
- data/app/views/caboose/block_types/admin_index.html.erb +35 -20
- data/app/views/caboose/blocks/_text.html.erb +8 -3
- data/app/views/caboose/blocks/admin_edit.html.erb +6 -1
- data/config/routes.rb +7 -6
- data/lib/caboose/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Njk0NzdjZDhiNWUwNzk3MzE5MzFiYjk2M2Q2MmQxNGI4MDYzN2ZkZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjY5NjcxNGViZWE3YzI1MTE0NWFhM2M4NjY4NGU2OTgyNTJlNGU4Mg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmM2OGMyYjIyMWE1ZDllYjVhZDllZjIyZWQxNWMxZTdlODAyM2I1MTFlNWI0
|
10
|
+
ZWJiOWMxNGY2NWRiNTNkNjA3MzVjNDYzODgxNmYyNTkzYzhjY2JkOTlhZjYz
|
11
|
+
NDRjNzI4MjUyZDljMzI0NzgzMmQ2NTYzZDRiZGVjYjVkMTZmY2E=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Yzc2ZjZkODM5M2VhOWM5ZGFiZTllMGU5MWQ2ZTViOGNiNzIwYzNmZWM4Mzk1
|
14
|
+
YzM4NDAxMmE4Y2U4YTI2YjIyM2ExYTc2ZTFmNjU5YzcwOTg4OGY2ZmZlNDJl
|
15
|
+
NTA3ZjA4ZDUxNjRkYTE0NTA0ZTk2Yzc4YTBiMDIyMjUxYTE3YzA=
|
@@ -18,7 +18,7 @@ module Caboose
|
|
18
18
|
render :layout => 'caboose/admin'
|
19
19
|
end
|
20
20
|
|
21
|
-
# GET /admin/block-type-sources/:id
|
21
|
+
# GET /admin/block-type-sources/:id
|
22
22
|
def admin_edit
|
23
23
|
return unless user_is_allowed('blocktypesources', 'edit')
|
24
24
|
@block_type_source = BlockTypeSource.find(params[:id])
|
@@ -40,7 +40,7 @@ module Caboose
|
|
40
40
|
bts.save
|
41
41
|
|
42
42
|
# Send back the response
|
43
|
-
resp.redirect = "/admin/block-types/store/sources/#{bts.id}
|
43
|
+
resp.redirect = "/admin/block-types/store/sources/#{bts.id}"
|
44
44
|
render :json => resp
|
45
45
|
end
|
46
46
|
|
@@ -13,8 +13,32 @@ module Caboose
|
|
13
13
|
render :layout => 'caboose/admin'
|
14
14
|
end
|
15
15
|
|
16
|
-
# GET /admin/block-types
|
17
|
-
def
|
16
|
+
# GET /admin/block-types/json
|
17
|
+
def admin_json
|
18
|
+
h = {
|
19
|
+
'name' => '',
|
20
|
+
'description' => '',
|
21
|
+
}
|
22
|
+
if params[:parent_id]
|
23
|
+
h['parent_id'] = ''
|
24
|
+
else
|
25
|
+
h['parent_id_null'] = true
|
26
|
+
end
|
27
|
+
pager = Caboose::Pager.new(params, h, {
|
28
|
+
'model' => 'Caboose::BlockType',
|
29
|
+
'sort' => 'description',
|
30
|
+
'desc' => 'false',
|
31
|
+
'base_url' => "/admin/block-types",
|
32
|
+
'items_per_page' => 100
|
33
|
+
})
|
34
|
+
render :json => {
|
35
|
+
:pager => pager,
|
36
|
+
:models => pager.items.as_json(:include => :sites)
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# GET /admin/block-types/:id/json
|
41
|
+
def admin_json_single
|
18
42
|
return if !user_is_allowed('pages', 'view')
|
19
43
|
block_type = BlockType.find(params[:id])
|
20
44
|
render :json => block_type
|
@@ -29,7 +53,7 @@ module Caboose
|
|
29
53
|
render :layout => 'caboose/admin'
|
30
54
|
end
|
31
55
|
|
32
|
-
# GET /admin/block-types/:id
|
56
|
+
# GET /admin/block-types/:id
|
33
57
|
def admin_edit
|
34
58
|
return unless user_is_allowed('pages', 'edit')
|
35
59
|
@block_type = BlockType.find(params[:id])
|
@@ -62,7 +86,7 @@ module Caboose
|
|
62
86
|
bt.save
|
63
87
|
|
64
88
|
# Send back the response
|
65
|
-
resp.redirect = "/admin/block-types/#{bt.id}
|
89
|
+
resp.redirect = "/admin/block-types/#{bt.id}"
|
66
90
|
render :json => resp
|
67
91
|
end
|
68
92
|
|
@@ -75,8 +99,7 @@ module Caboose
|
|
75
99
|
save = true
|
76
100
|
|
77
101
|
params.each do |k,v|
|
78
|
-
case k
|
79
|
-
when 'site_id' then bt.site_id = v
|
102
|
+
case k
|
80
103
|
when 'parent_id' then bt.parent_id = v
|
81
104
|
when 'name' then bt.name = v
|
82
105
|
when 'description' then bt.description = v
|
@@ -96,7 +119,8 @@ module Caboose
|
|
96
119
|
when 'fixed_placeholder' then bt.fixed_placeholder = v
|
97
120
|
when 'options' then bt.options = v
|
98
121
|
when 'options_function' then bt.options_function = v
|
99
|
-
when 'options_url' then bt.options_url = v
|
122
|
+
when 'options_url' then bt.options_url = v
|
123
|
+
when 'site_id' then bt.toggle_site(v[0], v[1])
|
100
124
|
end
|
101
125
|
end
|
102
126
|
|
@@ -134,13 +158,12 @@ module Caboose
|
|
134
158
|
# GET /admin/block-types/site-options
|
135
159
|
def admin_site_options
|
136
160
|
return unless user_is_allowed('pages', 'edit')
|
137
|
-
options =
|
138
|
-
|
139
|
-
options << {
|
161
|
+
options = Site.reorder("description, name").all.collect do |s|
|
162
|
+
{
|
140
163
|
'value' => s.id,
|
141
164
|
'text' => s.description && s.description.strip.length > 0 ? s.description : s.name
|
142
165
|
}
|
143
|
-
end
|
166
|
+
end
|
144
167
|
render :json => options
|
145
168
|
end
|
146
169
|
|
data/app/models/caboose/block.rb
CHANGED
@@ -175,21 +175,27 @@ class Caboose::Block < ActiveRecord::Base
|
|
175
175
|
begin
|
176
176
|
str = view.render(:partial => "../../sites/#{site.name}/blocks/#{full_name}", :locals => options2)
|
177
177
|
rescue ActionView::MissingTemplate => ex
|
178
|
+
#Caboose.log("Can't find partial: ../../sites/#{site.name}/blocks/#{full_name}")
|
178
179
|
begin
|
179
180
|
str = view.render(:partial => "../../sites/#{site.name}/blocks/#{block.block_type.name}", :locals => options2)
|
180
181
|
rescue ActionView::MissingTemplate => ex
|
182
|
+
#Caboose.log("Can't find partial: ../../sites/#{site.name}/blocks/#{block.block_type.name}")
|
181
183
|
begin
|
182
184
|
str = view.render(:partial => "../../sites/#{site.name}/blocks/#{block.block_type.field_type}", :locals => options2)
|
183
185
|
rescue ActionView::MissingTemplate
|
186
|
+
#Caboose.log("Can't find partial: ../../sites/#{site.name}/blocks/#{block.block_type.field_type}")
|
184
187
|
begin
|
185
188
|
str = view.render(:partial => "caboose/blocks/#{full_name}", :locals => options2)
|
186
189
|
rescue ActionView::MissingTemplate
|
190
|
+
#Caboose.log("Can't find partial: caboose/blocks/#{full_name}")
|
187
191
|
begin
|
188
192
|
str = view.render(:partial => "caboose/blocks/#{block.block_type.name}", :locals => options2)
|
189
193
|
rescue ActionView::MissingTemplate
|
194
|
+
#Caboose.log("Can't find partial: caboose/blocks/#{block.block_type.name}")
|
190
195
|
begin
|
191
196
|
str = view.render(:partial => "caboose/blocks/#{block.block_type.field_type}", :locals => options2)
|
192
197
|
rescue Exception => ex
|
198
|
+
#Caboose.log("Can't find partial: caboose/blocks/#{block.block_type.field_type}")
|
193
199
|
str = "<p class='note error'>#{self.block_message(block, ex)}</p>"
|
194
200
|
end
|
195
201
|
rescue Exception => ex
|
@@ -1,14 +1,14 @@
|
|
1
1
|
|
2
2
|
class Caboose::BlockType < ActiveRecord::Base
|
3
3
|
self.table_name = "block_types"
|
4
|
-
|
5
|
-
belongs_to :site, :class_name => 'Caboose::Site'
|
4
|
+
|
6
5
|
belongs_to :default_child_block_type, :foreign_key => 'default_child_block_type_id', :class_name => 'Caboose::BlockType'
|
7
6
|
belongs_to :block_type_category
|
8
7
|
belongs_to :parent, :foreign_key => 'parent_id', :class_name => 'Caboose::BlockType'
|
9
|
-
has_many :children, :foreign_key => 'parent_id', :class_name => 'Caboose::BlockType', :dependent => :destroy
|
10
|
-
|
11
|
-
|
8
|
+
has_many :children, :foreign_key => 'parent_id', :class_name => 'Caboose::BlockType', :dependent => :destroy
|
9
|
+
has_many :sites, :through => :block_type_site_memberships
|
10
|
+
has_many :block_type_site_memberships
|
11
|
+
attr_accessible :id,
|
12
12
|
:parent_id,
|
13
13
|
:name,
|
14
14
|
:description,
|
@@ -106,4 +106,33 @@ class Caboose::BlockType < ActiveRecord::Base
|
|
106
106
|
end
|
107
107
|
|
108
108
|
end
|
109
|
+
|
110
|
+
def toggle_site(site_id, value)
|
111
|
+
if value.to_i > 0
|
112
|
+
self.add_to_site(site_id)
|
113
|
+
else
|
114
|
+
self.remove_from_site(site_id)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
def add_to_site(site_id)
|
119
|
+
if site_id == 'all'
|
120
|
+
Caboose::BlockTypeSiteMembership.where(:block_type_id => self.id).destroy_all
|
121
|
+
Caboose::Site.reorder(:name).all.each do |site|
|
122
|
+
Caboose::BlockTypeSiteMembership.create(:block_type_id => self.id, :site_id => site.id)
|
123
|
+
end
|
124
|
+
else
|
125
|
+
if !Caboose::BlockTypeSiteMembership.where(:block_type_id => self.id, :site_id => site_id.to_i).exists?
|
126
|
+
Caboose::BlockTypeSiteMembership.create(:block_type_id => self.id, :site_id => site_id.to_i)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def remove_from_site(site_id)
|
132
|
+
if site_id == 'all'
|
133
|
+
Caboose::BlockTypeSiteMembership.where(:block_type_id => self.id).destroy_all
|
134
|
+
else
|
135
|
+
Caboose::BlockTypeSiteMembership.where(:block_type_id => self.id, :site_id => site_id.to_i).destroy_all
|
136
|
+
end
|
137
|
+
end
|
109
138
|
end
|
@@ -103,8 +103,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
103
103
|
[ :file , :attachment ],
|
104
104
|
[ :image , :attachment ]
|
105
105
|
],
|
106
|
-
Caboose::BlockType => [
|
107
|
-
[ :site_id , :integer ],
|
106
|
+
Caboose::BlockType => [
|
108
107
|
[ :parent_id , :integer ],
|
109
108
|
[ :name , :string ],
|
110
109
|
[ :description , :string ],
|
@@ -127,6 +126,10 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
127
126
|
[ :share , :boolean , { :default => true }],
|
128
127
|
[ :downloaded , :boolean , { :default => false }]
|
129
128
|
],
|
129
|
+
Caboose::BlockTypeSiteMembership => [
|
130
|
+
[ :site_id , :integer ],
|
131
|
+
[ :block_type_id , :integer ]
|
132
|
+
],
|
130
133
|
Caboose::BlockTypeCategory => [
|
131
134
|
[ :parent_id , :integer ],
|
132
135
|
[ :name , :string ]
|
@@ -7,8 +7,15 @@ bt = @block_type
|
|
7
7
|
</div>
|
8
8
|
|
9
9
|
<h1>Edit Block Type</h1>
|
10
|
-
|
10
|
+
|
11
11
|
<p><div id='blocktype_<%= bt.id %>_name' ></div></p>
|
12
|
+
<p><div id='blocktype_<%= bt.id %>_description' ></div></p>
|
13
|
+
|
14
|
+
<h2>Children</h2>
|
15
|
+
<p><a href='/admin/block-types/<%= @block_type.id %>/new'>New Child Block</a></p>
|
16
|
+
<div id='block_types'></div>
|
17
|
+
|
18
|
+
<h2>Advanced</h2>
|
12
19
|
<p><div id='blocktype_<%= bt.id %>_site_id' ></div></p>
|
13
20
|
<p><div id='blocktype_<%= bt.id %>_parent_id' ></div></p>
|
14
21
|
<p><div id='blocktype_<%= bt.id %>_block_type_category_id' ></div></p>
|
@@ -27,27 +34,6 @@ bt = @block_type
|
|
27
34
|
<p><div id='blocktype_<%= bt.id %>_render_function' ></div></p>
|
28
35
|
<p><div id='blocktype_<%= bt.id %>_options_function' ></div></p>
|
29
36
|
|
30
|
-
<h2>Children</h2>
|
31
|
-
<p><a href='/admin/block-types/<%= @block_type.id %>/new'>New Child Block</a></p>
|
32
|
-
<% if @block_type.children.count > 0 %>
|
33
|
-
<table class='data'>
|
34
|
-
<tr>
|
35
|
-
<th>Short Name</th>
|
36
|
-
<th>Long Name</th>
|
37
|
-
<th>Field Type</th>
|
38
|
-
</tr>
|
39
|
-
<% bt.children.each do |bt2| %>
|
40
|
-
<tr onclick="window.location='/admin/block-types/<%= bt2.id %>/edit';">
|
41
|
-
<td><%= bt2.name %></td>
|
42
|
-
<td><%= bt2.description %></td>
|
43
|
-
<td><%= bt2.field_type %></td>
|
44
|
-
</tr>
|
45
|
-
<% end %>
|
46
|
-
</table><br />
|
47
|
-
<% else %>
|
48
|
-
<p>This type of page block doesn't have any fields.</p>
|
49
|
-
<% end %>
|
50
|
-
|
51
37
|
<div id='message'></div>
|
52
38
|
<p>
|
53
39
|
<input type='button' value='< Back' onclick="window.location='/admin/block-types<%= bt.parent_id && bt.parent_id > 0 ? "/#{bt.parent_id}/edit" : '' %>';" />
|
@@ -89,23 +75,36 @@ function delete_block_type(block_type_id, confirm)
|
|
89
75
|
});
|
90
76
|
}
|
91
77
|
|
92
|
-
function select_icon(icon)
|
93
|
-
{
|
94
|
-
$.ajax({
|
95
|
-
url: '/admin/block-types/<%= @block_type.id %>',
|
96
|
-
type: 'put',
|
97
|
-
data: { icon: icon },
|
98
|
-
success: function(resp) {
|
99
|
-
$('div.icons a.selected').removeClass('selected');
|
100
|
-
$('#icon_' + icon).addClass('selected');
|
101
|
-
}
|
102
|
-
});
|
103
|
-
}
|
104
|
-
|
105
78
|
$(document).ready(function() {
|
106
|
-
|
107
|
-
|
108
|
-
|
79
|
+
|
80
|
+
var table = new IndexTable({
|
81
|
+
form_authenticity_token: '<%= form_authenticity_token %>',
|
82
|
+
container: 'block_types',
|
83
|
+
base_url: '/admin/block-types',
|
84
|
+
refresh_url: '/admin/block-types/json?parent_id=<%= @block_type.id %>',
|
85
|
+
allow_bulk_edit: false,
|
86
|
+
allow_bulk_delete: false,
|
87
|
+
allow_duplicate: false,
|
88
|
+
fields: [
|
89
|
+
{ name: 'parent_id' , sort: 'parent_id' , show: false , bulk_edit: false, nice_name: 'Parent' , type: 'select' , value: function(bt) { return bt.parent_id; }, width: 400, options_url: '/admin/block-types/tree-options' },
|
90
|
+
{ name: 'name' , sort: 'name' , show: true , bulk_edit: false, nice_name: 'Name' , type: 'text' , value: function(bt) { return bt.name; }, width: 400 },
|
91
|
+
{ name: 'description' , sort: 'description' , show: true , bulk_edit: false, nice_name: 'Description' , type: 'text' , value: function(bt) { return bt.description; }, width: 400 },
|
92
|
+
{ name: 'block_type_category_id' , sort: 'block_type_category_id' , show: false , bulk_edit: false, nice_name: 'Category' , type: 'select' , value: function(bt) { return bt.block_type_category_id; }, width: 400, options_url: '/admin/block-type-categories/tree-options' },
|
93
|
+
{ name: 'is_global' , sort: 'is_global' , show: false , bulk_edit: false, nice_name: 'Global' , type: 'checkbox' , value: function(bt) { return bt.is_global; }, width: 400 },
|
94
|
+
{ name: 'use_render_function' , sort: 'use_render_function' , show: false , bulk_edit: false, nice_name: 'Use Render Function' , type: 'checkbox' , value: function(bt) { return bt.use_render_function; }, width: 400 },
|
95
|
+
{ name: 'use_render_function_for_layout' , sort: 'use_render_function_for_layout' , show: false , bulk_edit: false, nice_name: 'Use Render Function for Layout' , type: 'checkbox' , value: function(bt) { return bt.use_render_function_for_layout; }, width: 400 },
|
96
|
+
{ name: 'allow_child_blocks' , sort: 'allow_child_blocks' , show: false , bulk_edit: false, nice_name: 'Allow Child Blocks' , type: 'checkbox' , value: function(bt) { return bt.allow_child_blocks; }, width: 400 },
|
97
|
+
{ name: 'default_child_block_type_id' , sort: 'default_child_block_type_id' , show: false , bulk_edit: false, nice_name: 'Default Child Block Type' , type: 'select' , value: function(bt) { return bt.default_child_block_type_id; }, width: 400, options_url: '/admin/block-types/options' },
|
98
|
+
{ name: 'render_function' , sort: 'render_function' , show: false , bulk_edit: false, nice_name: 'Render Function' , type: 'textarea' , value: function(bt) { return bt.render_function; }, width: 800, height: 200 },
|
99
|
+
{ name: 'field_type' , sort: 'field_type' , show: false , bulk_edit: false, nice_name: 'Field type' , type: 'select' , value: function(bt) { return bt.field_type; }, width: 400, options_url: '/admin/block-types/field-type-options' },
|
100
|
+
{ name: 'default' , sort: 'default' , show: false , bulk_edit: false, nice_name: 'Default value' , type: 'text' , value: function(bt) { return bt.default; }, width: 400 },
|
101
|
+
{ name: 'width' , sort: 'width' , show: false , bulk_edit: false, nice_name: 'Width' , type: 'text' , value: function(bt) { return bt.width; }, width: 400 },
|
102
|
+
{ name: 'height' , sort: 'height' , show: false , bulk_edit: false, nice_name: 'Height' , type: 'text' , value: function(bt) { return bt.height; }, width: 400 },
|
103
|
+
{ name: 'fixed_placeholder' , sort: 'fixed_placeholder' , show: false , bulk_edit: false, nice_name: 'Fixed placeholder' , type: 'checkbox' , value: function(bt) { return bt.fixed_placeholder; }, width: 400 },
|
104
|
+
{ name: 'options_url' , sort: 'options_url' , show: false , bulk_edit: false, nice_name: 'Options URL' , type: 'text' , value: function(bt) { return bt.options_url; }, width: 400 },
|
105
|
+
{ name: 'options_function' , sort: 'options_function' , show: false , bulk_edit: false, nice_name: 'Options Function' , type: 'textarea' , value: function(bt) { return bt.options_function; }, width: 400, height: 100 },
|
106
|
+
{ name: 'options' , sort: 'options' , show: false , bulk_edit: false, nice_name: 'Options' , type: 'textarea' , value: function(bt) { return bt.options; }, width: 400, height: 100 }
|
107
|
+
]
|
109
108
|
});
|
110
109
|
|
111
110
|
m = new ModelBinder({
|
@@ -113,8 +112,7 @@ $(document).ready(function() {
|
|
113
112
|
id: <%= @block_type.id %>,
|
114
113
|
update_url: '/admin/block-types/<%= @block_type.id %>',
|
115
114
|
authenticity_token: '<%= form_authenticity_token %>',
|
116
|
-
attributes: [
|
117
|
-
{ name: 'site_id' , nice_name: 'Site' , type: 'select' , value: <%= raw Caboose.json(bt.site_id ? bt.site_id : -1) %>, width: 400, options_url: '/admin/block-types/site-options' },
|
115
|
+
attributes: [
|
118
116
|
{ name: 'parent_id' , nice_name: 'Parent' , type: 'select' , value: <%= raw Caboose.json(bt.parent_id) %>, width: 400, options_url: '/admin/block-types/tree-options' },
|
119
117
|
{ name: 'name' , nice_name: 'Name' , type: 'text' , value: <%= raw Caboose.json(bt.name) %>, width: 400 },
|
120
118
|
{ name: 'description' , nice_name: 'Description' , type: 'text' , value: <%= raw Caboose.json(bt.description) %>, width: 400 },
|
@@ -9,26 +9,41 @@
|
|
9
9
|
<a href='/admin/block-types/store'>Block Type Store</a> |
|
10
10
|
<a href='/admin/block-types/new'>New Block Type</a>
|
11
11
|
</p>
|
12
|
+
<div id='block_types'></div>
|
12
13
|
|
13
|
-
<%
|
14
|
-
|
15
|
-
|
16
|
-
<tr>
|
17
|
-
<th>Site</th>
|
18
|
-
<th>Name</th>
|
19
|
-
<th>Description</th>
|
20
|
-
</tr>
|
21
|
-
<% @block_types.each do |bt| %>
|
22
|
-
<tr onclick="window.location='/admin/block-types/<%= bt.id %>/edit';">
|
23
|
-
<td><%= bt.site_id ? (bt.site.description && bt.site.description.strip.length > 0 ? bt.site.description : bt.site.name) : 'Global' %></td>
|
24
|
-
<td><%= bt.name %></td>
|
25
|
-
<td><%= bt.description %></td>
|
26
|
-
</tr>
|
27
|
-
<% end %>
|
28
|
-
</table>
|
29
|
-
|
30
|
-
<% else %>
|
31
|
-
|
32
|
-
<p>There are no block types.</p>
|
14
|
+
<% content_for :caboose_js do %>
|
15
|
+
<%= javascript_include_tag 'caboose/model/all' %>
|
16
|
+
<script type='text/javascript'>
|
33
17
|
|
18
|
+
$(document).ready(function() {
|
19
|
+
var that = this;
|
20
|
+
var table = new IndexTable({
|
21
|
+
form_authenticity_token: '<%= form_authenticity_token %>',
|
22
|
+
container: 'block_types',
|
23
|
+
base_url: '/admin/block-types',
|
24
|
+
fields: [
|
25
|
+
{ name: 'parent_id' , sort: 'parent_id' , show: false , bulk_edit: false, nice_name: 'Parent' , type: 'select' , value: function(bt) { return bt.parent_id; }, width: 400, options_url: '/admin/block-types/tree-options' },
|
26
|
+
{ name: 'name' , sort: 'name' , show: true , bulk_edit: false, nice_name: 'Name' , type: 'text' , value: function(bt) { return bt.name; }, width: 400 },
|
27
|
+
{ name: 'description' , sort: 'description' , show: true , bulk_edit: false, nice_name: 'Description' , type: 'text' , value: function(bt) { return bt.description; }, width: 400 },
|
28
|
+
{ name: 'site_id' , sort: 'site_id' , show: true , bulk_edit: false, nice_name: 'Site' , type: 'checkbox-multiple' , value: function(bt) { return bt.sites ? bt.sites.map(function(s) { return s.id }) : []; }, text: function(bt) { return bt.sites ? bt.sites.map(function(s) { return s.description }).join(', ') : ''; }, width: 400, height: 200, options_url: '/admin/block-types/site-options' },
|
29
|
+
{ name: 'block_type_category_id' , sort: 'block_type_category_id' , show: false , bulk_edit: false, nice_name: 'Category' , type: 'select' , value: function(bt) { return bt.block_type_category_id; }, width: 400, options_url: '/admin/block-type-categories/tree-options' },
|
30
|
+
{ name: 'is_global' , sort: 'is_global' , show: false , bulk_edit: false, nice_name: 'Global' , type: 'checkbox' , value: function(bt) { return bt.is_global; }, width: 400 },
|
31
|
+
{ name: 'use_render_function' , sort: 'use_render_function' , show: false , bulk_edit: false, nice_name: 'Use Render Function' , type: 'checkbox' , value: function(bt) { return bt.use_render_function; }, width: 400 },
|
32
|
+
{ name: 'use_render_function_for_layout' , sort: 'use_render_function_for_layout' , show: false , bulk_edit: false, nice_name: 'Use Render Function for Layout' , type: 'checkbox' , value: function(bt) { return bt.use_render_function_for_layout; }, width: 400 },
|
33
|
+
{ name: 'allow_child_blocks' , sort: 'allow_child_blocks' , show: false , bulk_edit: false, nice_name: 'Allow Child Blocks' , type: 'checkbox' , value: function(bt) { return bt.allow_child_blocks; }, width: 400 },
|
34
|
+
{ name: 'default_child_block_type_id' , sort: 'default_child_block_type_id' , show: false , bulk_edit: false, nice_name: 'Default Child Block Type' , type: 'select' , value: function(bt) { return bt.default_child_block_type_id; }, width: 400, options_url: '/admin/block-types/options' },
|
35
|
+
{ name: 'render_function' , sort: 'render_function' , show: false , bulk_edit: false, nice_name: 'Render Function' , type: 'textarea' , value: function(bt) { return bt.render_function; }, width: 800, height: 200 },
|
36
|
+
{ name: 'field_type' , sort: 'field_type' , show: false , bulk_edit: false, nice_name: 'Field type' , type: 'select' , value: function(bt) { return bt.field_type; }, width: 400, options_url: '/admin/block-types/field-type-options' },
|
37
|
+
{ name: 'default' , sort: 'default' , show: false , bulk_edit: false, nice_name: 'Default value' , type: 'text' , value: function(bt) { return bt.default; }, width: 400 },
|
38
|
+
{ name: 'width' , sort: 'width' , show: false , bulk_edit: false, nice_name: 'Width' , type: 'text' , value: function(bt) { return bt.width; }, width: 400 },
|
39
|
+
{ name: 'height' , sort: 'height' , show: false , bulk_edit: false, nice_name: 'Height' , type: 'text' , value: function(bt) { return bt.height; }, width: 400 },
|
40
|
+
{ name: 'fixed_placeholder' , sort: 'fixed_placeholder' , show: false , bulk_edit: false, nice_name: 'Fixed placeholder' , type: 'checkbox' , value: function(bt) { return bt.fixed_placeholder; }, width: 400 },
|
41
|
+
{ name: 'options_url' , sort: 'options_url' , show: false , bulk_edit: false, nice_name: 'Options URL' , type: 'text' , value: function(bt) { return bt.options_url; }, width: 400 },
|
42
|
+
{ name: 'options_function' , sort: 'options_function' , show: false , bulk_edit: false, nice_name: 'Options Function' , type: 'textarea' , value: function(bt) { return bt.options_function; }, width: 400, height: 100 },
|
43
|
+
{ name: 'options' , sort: 'options' , show: false , bulk_edit: false, nice_name: 'Options' , type: 'textarea' , value: function(bt) { return bt.options; }, width: 400, height: 100 }
|
44
|
+
]
|
45
|
+
});
|
46
|
+
});
|
47
|
+
|
48
|
+
</script>
|
34
49
|
<% end %>
|
@@ -1,7 +1,12 @@
|
|
1
1
|
<%
|
2
2
|
text = block.value
|
3
|
-
if text.nil? || text ==
|
4
|
-
text =
|
3
|
+
if text.nil? || text.strip.length == 0
|
4
|
+
text = empty_text ? "<p>#{empty_text}</p>" : ""
|
5
5
|
end
|
6
6
|
|
7
|
-
|
7
|
+
%>
|
8
|
+
<% if editing %>
|
9
|
+
<div id='block_<%= block.id %>'><%= raw text %></div>
|
10
|
+
<% else %>
|
11
|
+
<%= raw text %>
|
12
|
+
<% end %>
|
@@ -46,9 +46,14 @@ end
|
|
46
46
|
<% if @block.children.count > 0 %>
|
47
47
|
<% @block.children.each do |b| %>
|
48
48
|
<% if b.block_type.field_type != 'block' && b.block_type.field_type != 'richtext' %>
|
49
|
-
<
|
49
|
+
<div style='margin-bottom: 10px;'><div id='block_<%= b.id %>_value'></div></div>
|
50
50
|
<% else %>
|
51
51
|
<%
|
52
|
+
Caboose.log(b.value)
|
53
|
+
Caboose.log(b.name)
|
54
|
+
Caboose.log(b.block_type.full_name)
|
55
|
+
Caboose.log(b.block_type.name)
|
56
|
+
Caboose.log(b.block_type.field_type)
|
52
57
|
str = @block.render(b, {
|
53
58
|
:modal => true,
|
54
59
|
:empty_text => '[Empty, click to edit]',
|
data/config/routes.rb
CHANGED
@@ -181,16 +181,17 @@ Caboose::Engine.routes.draw do
|
|
181
181
|
get "admin/block-types/field-type-options" => "block_types#admin_field_type_options"
|
182
182
|
get "admin/block-types/tree-options" => "block_types#admin_tree_options"
|
183
183
|
get "admin/block-types/options" => "block_types#admin_options"
|
184
|
-
get "admin/block-types/new" => "block_types#admin_new"
|
185
|
-
get "admin/block-types
|
184
|
+
get "admin/block-types/new" => "block_types#admin_new"
|
185
|
+
get "admin/block-types/json" => "block_types#admin_json"
|
186
|
+
get "admin/block-types/:id/json" => "block_types#admin_json_single"
|
187
|
+
get "admin/block-types/:id/new" => "block_types#admin_new"
|
186
188
|
get "admin/block-types/:id/options" => "block_types#admin_value_options"
|
187
189
|
get "admin/block-types/:id/icon" => "block_types#admin_edit_icon"
|
188
|
-
get "admin/block-types/:id
|
189
|
-
get "admin/block-types/:id" => "block_types#admin_show"
|
190
|
-
get "admin/block-types" => "block_types#admin_index"
|
191
|
-
post "admin/block-types" => "block_types#admin_create"
|
190
|
+
get "admin/block-types/:id" => "block_types#admin_edit"
|
192
191
|
put "admin/block-types/:id" => "block_types#admin_update"
|
193
192
|
delete "admin/block-types/:id" => "block_types#admin_delete"
|
193
|
+
get "admin/block-types" => "block_types#admin_index"
|
194
|
+
post "admin/block-types" => "block_types#admin_create"
|
194
195
|
|
195
196
|
get "admin/block-type-categories/tree-options" => "block_type_categories#admin_tree_options"
|
196
197
|
|
data/lib/caboose/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.146
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
@@ -306,6 +306,7 @@ files:
|
|
306
306
|
- app/models/caboose/block_type.rb
|
307
307
|
- app/models/caboose/block_type_category.rb
|
308
308
|
- app/models/caboose/block_type_icons.rb
|
309
|
+
- app/models/caboose/block_type_site_membership.rb
|
309
310
|
- app/models/caboose/block_type_source.rb
|
310
311
|
- app/models/caboose/block_type_summary.rb
|
311
312
|
- app/models/caboose/caboose_plugin.rb
|