caboose-cms 0.9.180 → 0.9.181
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/caboose/block_type_categories_controller.rb +7 -0
- data/app/controllers/caboose/block_types_controller.rb +3 -1
- data/app/models/caboose/block.rb +10 -1
- data/app/models/caboose/block_type.rb +1 -0
- data/app/models/caboose/page.rb +4 -3
- data/app/models/caboose/schema.rb +1 -0
- data/app/views/caboose/block_types/admin_edit.html.erb +5 -6
- data/app/views/caboose/block_types/admin_error_log.html.erb +1 -1
- data/app/views/caboose/blocks/_render_function.html.erb +20 -5
- data/app/views/caboose/themes/admin_edit.html.erb +2 -1
- data/lib/caboose/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef969e5eae4c2719750d5823845b9d9253070924
|
4
|
+
data.tar.gz: 769aa0063fc099a95ff534f78e884755fa81b730
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5f9064f3e3fae1d27406ccb8abbcc5373db02a78dd4d86f59db4767737e0c3bacfa957b2c929c477c65f9777695d455e61498c5d72fc7dc6feeb87b0cc9cc766
|
7
|
+
data.tar.gz: 7450e9e4e97e7c87e05b82dde4296a62b0cde924b9fb5979e5ef865ab00112042bbefde0ad85960da1b648fae779dfa0eb07e86a2c87eba8040ecc698abbf00e
|
@@ -7,6 +7,13 @@ module Caboose
|
|
7
7
|
return unless user_is_allowed('pages', 'edit')
|
8
8
|
render :json => BlockTypeCategory.tree
|
9
9
|
end
|
10
|
+
|
11
|
+
# @route GET /admin/block-type-categories/:id/options
|
12
|
+
def admin_options
|
13
|
+
btc = BlockTypeCategory.find(params[:id])
|
14
|
+
options = BlockType.joins(:block_type_site_memberships).where("block_type_site_memberships.site_id = ?",@site.id).where("block_type_site_memberships.block_type_id = block_types.id").where("block_types.block_type_category_id = ?",btc.id).reorder('block_types.description').all.collect { |s| { 'value' => s.id, 'text' => s.description }}
|
15
|
+
render :json => options
|
16
|
+
end
|
10
17
|
|
11
18
|
end
|
12
19
|
end
|
@@ -188,6 +188,7 @@ module Caboose
|
|
188
188
|
when 'options_url' then bt.options_url = v
|
189
189
|
when 'default_constrain' then bt.default_constrain = v
|
190
190
|
when 'default_full_width' then bt.default_full_width = v
|
191
|
+
when 'default_included' then bt.default_included = v
|
191
192
|
when 'site_id' then resp.btsm_id = bt.toggle_site(v[0], v[1])
|
192
193
|
end
|
193
194
|
end
|
@@ -307,7 +308,8 @@ module Caboose
|
|
307
308
|
return if !user_is_allowed_to('edit', 'sites')
|
308
309
|
resp = StdClass.new
|
309
310
|
@btsm = BlockTypeSiteMembership.find(params[:id])
|
310
|
-
|
311
|
+
code = params['code'].blank? ? '' : params['code'].gsub('<%==','<%= raw')
|
312
|
+
@btsm.custom_html = code
|
311
313
|
@btsm.save
|
312
314
|
resp.success = true
|
313
315
|
resp.message = "Code has been saved!"
|
data/app/models/caboose/block.rb
CHANGED
@@ -212,8 +212,17 @@ class Caboose::Block < ActiveRecord::Base
|
|
212
212
|
|
213
213
|
view = options2[:view]
|
214
214
|
view = ActionView::Base.new(ActionController::Base.view_paths) if view.nil?
|
215
|
+
|
216
|
+
btsm_rf = Caboose::BlockTypeSiteMembership.where(:site_id => options2[:site].id, :block_type_id => block.block_type.id).where('custom_html IS NOT NULL and custom_html != ?', '').first
|
217
|
+
bt_rf = btsm_rf.nil? ? (block.block_type.use_render_function && block.block_type.render_function ? block.block_type.render_function : nil) : btsm_rf
|
218
|
+
rf = btsm_rf.nil? ? bt_rf : btsm_rf.custom_html
|
215
219
|
|
216
|
-
if
|
220
|
+
if !rf.blank?
|
221
|
+
options2[:caboose_js] = rf.match(/<% content_for :js do %>(.*?)<% end %>/m)
|
222
|
+
options2[:caboose_css] = rf.match(/<% content_for :css do %>(.*?)<% end %>/m)
|
223
|
+
rf = rf.gsub(/<% content_for :js do %>(.*?)<% end %>/m, '')
|
224
|
+
rf = rf.gsub(/<% content_for :css do %>(.*?)<% end %>/m, '')
|
225
|
+
options2[:render_function] = rf
|
217
226
|
begin
|
218
227
|
str = view.render(:partial => "caboose/blocks/render_function", :locals => options2)
|
219
228
|
rescue Exception => ex
|
data/app/models/caboose/page.rb
CHANGED
@@ -130,7 +130,8 @@ class Caboose::Page < ActiveRecord::Base
|
|
130
130
|
parts = uri.split('/')
|
131
131
|
|
132
132
|
# See where to start looking
|
133
|
-
|
133
|
+
pagealias = parts[0].blank? ? '' : parts[0].downcase
|
134
|
+
page_ids = self.where(:site_id => site_id, :alias => pagealias).limit(1).pluck(:id)
|
134
135
|
page_id = !page_ids.nil? && page_ids.count > 0 ? page_ids[0] : false
|
135
136
|
|
136
137
|
# Search for the page
|
@@ -146,14 +147,14 @@ class Caboose::Page < ActiveRecord::Base
|
|
146
147
|
page = self.find(page_id)
|
147
148
|
|
148
149
|
if (!get_closest_parent) # // Look for an exact match
|
149
|
-
return false if page.uri != uri
|
150
|
+
return false if (page.uri.blank? ? '' : page.uri.downcase) != (uri.blank? ? '' : uri.downcase)
|
150
151
|
end
|
151
152
|
return page
|
152
153
|
end
|
153
154
|
|
154
155
|
def self.page_with_uri_helper(parts, level, parent_id)
|
155
156
|
return parent_id if level >= parts.count
|
156
|
-
slug = parts[level]
|
157
|
+
slug = parts[level].downcase
|
157
158
|
page_ids = self.where(:parent_id => parent_id, :slug => slug).limit(1).pluck(:id)
|
158
159
|
return parent_id if page_ids.nil? || page_ids.count == 0
|
159
160
|
return self.page_with_uri_helper(parts, level+1, page_ids[0])
|
@@ -201,6 +201,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
|
|
201
201
|
[ :options_url , :string ],
|
202
202
|
[ :latest_error , :text ],
|
203
203
|
[ :default_constrain , :boolean , { :default => false }],
|
204
|
+
[ :default_included , :boolean , { :default => false }],
|
204
205
|
[ :default_full_width , :boolean , { :default => false }],
|
205
206
|
[ :share , :boolean , { :default => true }],
|
206
207
|
[ :downloaded , :boolean , { :default => false }]
|
@@ -37,6 +37,7 @@ bt = @block_type
|
|
37
37
|
<p><div id='blocktype_<%= bt.id %>_default_child_block_type_id' ></div></p>
|
38
38
|
<p><div id='blocktype_<%= bt.id %>_default_constrain' ></div></p>
|
39
39
|
<p><div id='blocktype_<%= bt.id %>_default_full_width' ></div></p>
|
40
|
+
<p><div id='blocktype_<%= bt.id %>_default_included' ></div></p>
|
40
41
|
<p>
|
41
42
|
|
42
43
|
</p>
|
@@ -54,7 +55,6 @@ bt = @block_type
|
|
54
55
|
<% content_for :caboose_css do %>
|
55
56
|
<%= stylesheet_link_tag 'caboose/icomoon_fonts' %>
|
56
57
|
<style type='text/css'>
|
57
|
-
#blocktype_<%= bt.id %>_render_function { font-family: Courier; font-size: 80%; width: 100%; }
|
58
58
|
#blocktype_<%= bt.id %>_options_function { font-family: Courier; font-size: 80%; width: 100%; }
|
59
59
|
</style>
|
60
60
|
<% end %>
|
@@ -106,8 +106,7 @@ $(document).ready(function() {
|
|
106
106
|
{ name: 'use_render_function_for_layout' , sort: 'use_render_function_for_layout' , show: true , bulk_edit: false, nice_name: 'Use Render Function for Modal' , type: 'checkbox' , value: function(bt) { return bt.use_render_function_for_layout; }, text: function(bt) { return bt.use_render_function_for_layout ? 'Yes' : 'No' }, width: 400 },
|
107
107
|
{ name: 'use_js_for_modal' , sort: 'use_js_for_modal' , show: true , bulk_edit: false, nice_name: 'Use JS for Modal' , type: 'checkbox' , value: function(bt) { return bt.use_js_for_modal; }, text: function(bt) { return bt.use_js_for_modal ? 'Yes' : 'No' }, width: 400 },
|
108
108
|
{ name: 'allow_child_blocks' , sort: 'allow_child_blocks' , show: true , bulk_edit: false, nice_name: 'Allow Child Blocks' , type: 'checkbox' , value: function(bt) { return bt.allow_child_blocks; }, text: function(bt) { return bt.allow_child_blocks ? 'Yes' : 'No' }, width: 400 },
|
109
|
-
{ name: 'default_child_block_type_id' , sort: 'default_child_block_type_id' , show: false , bulk_edit: false, nice_name: 'Default Child Block Type ID' , type: 'text' , value: function(bt) { return bt.default_child_block_type_id; }, width: 400 },
|
110
|
-
{ 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 },
|
109
|
+
{ name: 'default_child_block_type_id' , sort: 'default_child_block_type_id' , show: false , bulk_edit: false, nice_name: 'Default Child Block Type ID' , type: 'text' , value: function(bt) { return bt.default_child_block_type_id; }, width: 400 },
|
111
110
|
{ name: 'default' , sort: 'default' , show: false , bulk_edit: false, nice_name: 'Default value' , type: 'text' , value: function(bt) { return bt.default; }, width: 400 },
|
112
111
|
{ name: 'width' , sort: 'width' , show: false , bulk_edit: false, nice_name: 'Width' , type: 'text' , value: function(bt) { return bt.width; }, width: 400 },
|
113
112
|
{ name: 'height' , sort: 'height' , show: false , bulk_edit: false, nice_name: 'Height' , type: 'text' , value: function(bt) { return bt.height; }, width: 400 },
|
@@ -139,8 +138,7 @@ $(document).ready(function() {
|
|
139
138
|
{ name: 'use_render_function_for_layout' , nice_name: 'Use Render Function for Modal' , type: 'checkbox' , value: <%= bt.use_render_function_for_layout ? 'true' : 'false' %>, width: 400 },
|
140
139
|
{ name: 'use_js_for_modal' , nice_name: 'Use JS for Modal' , type: 'checkbox' , value: <%= bt.use_js_for_modal ? 'true' : 'false' %>, width: 400 },
|
141
140
|
{ name: 'allow_child_blocks' , nice_name: 'Allow Child Blocks' , type: 'checkbox' , value: <%= bt.allow_child_blocks ? 'true' : 'false' %>, width: 400 },
|
142
|
-
{ name: 'default_child_block_type_id' , nice_name: 'Default Child Block Type ID' , type: 'text' , value: <%= raw Caboose.json(bt.default_child_block_type_id) %>, width: 400 },
|
143
|
-
{ name: 'render_function' , nice_name: 'Render Function' , type: 'textarea' , value: <%= raw Caboose.json(bt.render_function) %>, width: 800, height: 200 },
|
141
|
+
{ name: 'default_child_block_type_id' , nice_name: 'Default Child Block Type ID' , type: 'text' , value: <%= raw Caboose.json(bt.default_child_block_type_id) %>, width: 400 },
|
144
142
|
{ 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' },
|
145
143
|
{ name: 'default' , nice_name: 'Default value' , type: 'text' , value: <%= raw Caboose.json(bt.default) %>, width: 400 },
|
146
144
|
{ name: 'width' , nice_name: 'Width' , type: 'text' , value: <%= raw Caboose.json(bt.width) %>, width: 400 },
|
@@ -148,7 +146,8 @@ $(document).ready(function() {
|
|
148
146
|
{ name: 'fixed_placeholder' , nice_name: 'Fixed placeholder' , type: 'checkbox' , value: <%= raw Caboose.json(bt.fixed_placeholder) %>, width: 400 },
|
149
147
|
{ name: 'options_url' , nice_name: 'Options URL' , type: 'text' , value: <%= raw Caboose.json(bt.options_url) %>, width: 400 },
|
150
148
|
{ name: 'options_function' , nice_name: 'Options Function' , type: 'textarea' , value: <%= raw Caboose.json(bt.options_function) %>, width: 400, height: 100 },
|
151
|
-
{ name: 'options' , nice_name: 'Options' , type: 'textarea' , value: <%= raw Caboose.json(bt.options) %>, width: 400, height: 100 }
|
149
|
+
{ name: 'options' , nice_name: 'Options' , type: 'textarea' , value: <%= raw Caboose.json(bt.options) %>, width: 400, height: 100 },
|
150
|
+
{ name: 'default_included' , sort: 'default_included' , nice_name: 'Include on New Sites' , type: 'checkbox' , value: <%= bt.default_included ? 'true' : 'false' %> , width: 400 }
|
152
151
|
]
|
153
152
|
});
|
154
153
|
});
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<h1>Error Log</h1>
|
2
2
|
|
3
|
-
<a href="
|
3
|
+
<a href="#" onclick="window.history.back();return false;" class="caboose-btn">Back</a>
|
4
4
|
|
5
5
|
<% if !@block_type.latest_error.blank? %>
|
6
6
|
<div class="error" style="font-size:13px;line-height:18px;font-family:monospace;margin-top:10px;">
|
@@ -1,5 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
%>
|
5
|
-
|
1
|
+
<%= raw ERB.new(render_function).result(self.instance_eval { binding }) %>
|
2
|
+
|
3
|
+
<% if caboose_js && caboose_js.length > 1 %>
|
4
|
+
<% caboose_js.to_a.each_with_index do |js, ind| %>
|
5
|
+
<% next if ind == 0 %>
|
6
|
+
<% content_for :js do %>
|
7
|
+
<% erb = ERB.new(js).result(self.instance_eval { binding }) %>
|
8
|
+
<%== erb %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
12
|
+
<% if caboose_css && caboose_css.length > 1 %>
|
13
|
+
<% caboose_css.to_a.each_with_index do |css, ind| %>
|
14
|
+
<% next if ind == 0 %>
|
15
|
+
<% content_for :css do %>
|
16
|
+
<% erb = ERB.new(css).result(self.instance_eval { binding }) %>
|
17
|
+
<%== erb %>
|
18
|
+
<% end %>
|
19
|
+
<% end %>
|
20
|
+
<% end %>
|
@@ -272,7 +272,8 @@ $(document).ready(function() {
|
|
272
272
|
{ name: 'banner_overlay_color', nice_name: "<%= 'banner_overlay_color'.titleize %>", type: 'color', value: <%== Caboose.json(@theme.banner_overlay_color) %>, width: 400 },
|
273
273
|
{ name: 'banner_overlay_opacity', nice_name: "<%= 'banner_overlay_opacity'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.banner_overlay_opacity) %>, width: 400 },
|
274
274
|
<% if style %>
|
275
|
-
|
275
|
+
<% cat = Caboose::BlockTypeCategory.where(:name => 'Headers').first %>
|
276
|
+
{ name: 'default_header_style', nice_name: "<%= 'default_style'.titleize %>", type: 'select', value: <%== Caboose.json(@theme.default_header_style) %>, options_url: '/admin/block-type-categories/<%= cat.id %>/options', width: 400 },
|
276
277
|
<% else %>
|
277
278
|
{ name: 'default_header_style', nice_name: "<%= 'default_style'.titleize %>", type: 'text', value: <%== Caboose.json(@theme.default_header_style) %>, width: 400 },
|
278
279
|
<% end %>
|
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.9.
|
4
|
+
version: 0.9.181
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- William Barry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|