caboose-cms 0.9.229 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (187) hide show
  1. checksums.yaml +5 -5
  2. data/app/assets/javascripts/caboose/admin.js +1 -1
  3. data/app/assets/javascripts/caboose/admin/application.js +20 -0
  4. data/app/assets/javascripts/caboose/admin_main.js +13 -3
  5. data/app/assets/javascripts/caboose/admin_media_index.js +158 -161
  6. data/app/assets/javascripts/caboose/application.js +7 -8
  7. data/app/assets/javascripts/caboose/block_content_controller_dragdrop.js +4 -60
  8. data/app/assets/javascripts/caboose/block_modal_controllers/block_dd_modal_controller.js +2 -3
  9. data/app/assets/javascripts/caboose/block_modal_controllers/media_modal_controller.js +6 -17
  10. data/app/assets/javascripts/caboose/model/all.js +1 -5
  11. data/app/assets/stylesheets/caboose/admin/_config.scss +102 -0
  12. data/app/assets/stylesheets/caboose/admin/application.css +11 -0
  13. data/app/assets/stylesheets/caboose/admin/component.css +183 -0
  14. data/app/assets/stylesheets/caboose/admin/froala.min.css +91 -0
  15. data/app/assets/stylesheets/caboose/admin/ie.scss +67 -0
  16. data/app/assets/stylesheets/caboose/admin/integrations/main.scss +6 -0
  17. data/app/assets/stylesheets/caboose/admin/integrations/shopify.scss +128 -0
  18. data/app/assets/stylesheets/caboose/admin/jquery-ui-subnav-theme.min.css +5 -0
  19. data/app/assets/stylesheets/caboose/admin/layout.scss +150 -0
  20. data/app/assets/stylesheets/caboose/admin/main.scss +34 -0
  21. data/app/assets/stylesheets/caboose/admin/modules/body.scss +176 -0
  22. data/app/assets/stylesheets/caboose/admin/modules/buttons.scss +120 -0
  23. data/app/assets/stylesheets/caboose/admin/modules/countdown.css +21 -0
  24. data/app/assets/stylesheets/caboose/admin/modules/crumbtrail.scss +80 -0
  25. data/app/assets/stylesheets/caboose/admin/modules/data_table.scss +92 -0
  26. data/app/assets/stylesheets/caboose/admin/modules/footer.scss +62 -0
  27. data/app/assets/stylesheets/caboose/admin/modules/forms.scss +72 -0
  28. data/app/assets/stylesheets/caboose/admin/modules/functions.scss +31 -0
  29. data/app/assets/stylesheets/caboose/admin/modules/grid.scss +108 -0
  30. data/app/assets/stylesheets/caboose/admin/modules/header.scss +77 -0
  31. data/app/assets/stylesheets/caboose/admin/modules/headings.scss +38 -0
  32. data/app/assets/stylesheets/caboose/admin/modules/main_nav.scss +73 -0
  33. data/app/assets/stylesheets/caboose/admin/modules/message_boxes.scss +55 -0
  34. data/app/assets/stylesheets/caboose/admin/modules/model_binder.scss +189 -0
  35. data/app/assets/stylesheets/caboose/admin/modules/navigation.scss +261 -0
  36. data/app/assets/stylesheets/caboose/admin/modules/order_bumps.scss +57 -0
  37. data/app/assets/stylesheets/caboose/admin/modules/pager.scss +34 -0
  38. data/app/assets/stylesheets/caboose/admin/modules/product_images.scss +21 -0
  39. data/app/assets/stylesheets/caboose/admin/modules/products.css +86 -0
  40. data/app/assets/stylesheets/caboose/admin/modules/search.scss +49 -0
  41. data/app/assets/stylesheets/caboose/admin/modules/selects.scss +12 -0
  42. data/app/assets/stylesheets/caboose/admin/modules/subnav_tabs.scss +34 -0
  43. data/app/assets/stylesheets/caboose/admin/modules/tabs.scss +140 -0
  44. data/app/assets/stylesheets/caboose/admin/page_edit/block_anchors.scss +48 -0
  45. data/app/assets/stylesheets/caboose/admin/page_edit/block_overlays.scss +182 -0
  46. data/app/assets/stylesheets/caboose/admin/page_edit/device_selector.scss +65 -0
  47. data/app/assets/stylesheets/caboose/admin/page_edit/froala.scss +81 -0
  48. data/app/assets/stylesheets/caboose/admin/page_edit/group_overlay.scss +115 -0
  49. data/app/assets/stylesheets/caboose/admin/page_edit/layout.scss +128 -0
  50. data/app/assets/stylesheets/caboose/admin/page_edit/main.scss +18 -0
  51. data/app/assets/stylesheets/caboose/admin/page_edit/modal.scss +11 -0
  52. data/app/assets/stylesheets/caboose/admin/page_edit/preview.scss +25 -0
  53. data/app/assets/stylesheets/caboose/admin/page_edit/publish.scss +25 -0
  54. data/app/assets/stylesheets/caboose/admin/page_edit/revisions.scss +58 -0
  55. data/app/assets/stylesheets/caboose/admin/page_edit/subnav.scss +273 -0
  56. data/app/assets/stylesheets/caboose/admin/page_edit/top_nav.scss +109 -0
  57. data/app/assets/stylesheets/caboose/admin/pages/assets_index.css +48 -0
  58. data/app/assets/stylesheets/caboose/admin/pages/block_edit_image.css.scss +386 -0
  59. data/app/assets/stylesheets/caboose/admin/pages/media_index.css.scss +300 -0
  60. data/app/assets/stylesheets/caboose/admin/pages/new_block.css +9 -0
  61. data/app/assets/stylesheets/caboose/admin/pages/page_edit.scss +960 -0
  62. data/app/assets/stylesheets/caboose/admin/pages/page_edit_content.scss +103 -0
  63. data/app/assets/stylesheets/caboose/admin/pages/pages_index.scss +79 -0
  64. data/app/assets/stylesheets/caboose/admin/pages/post_edit_content.css +46 -0
  65. data/app/assets/stylesheets/caboose/admin/print.css +3 -0
  66. data/app/assets/stylesheets/caboose/admin/slack.scss +51 -0
  67. data/app/assets/stylesheets/caboose/admin_block_edit_image.css.scss +1 -2
  68. data/app/assets/stylesheets/caboose/admin_edit_page_content_dragdrop.scss +15 -71
  69. data/app/assets/stylesheets/caboose/admin_main.css.scss +29 -25
  70. data/app/assets/stylesheets/caboose/admin_media_index.css.scss +5 -26
  71. data/app/assets/stylesheets/caboose/application.css +5 -11
  72. data/app/assets/stylesheets/caboose/login.scss +0 -1
  73. data/app/assets/stylesheets/caboose/modal_main.css +19 -21
  74. data/app/assets/stylesheets/caboose/model_binder.css +4 -13
  75. data/app/assets/stylesheets/caboose/page_bar_generator.css +1 -2
  76. data/app/controllers/caboose/admin_controller.rb +4 -3
  77. data/app/controllers/caboose/application_controller.rb +19 -16
  78. data/app/controllers/caboose/assets_controller.rb +65 -0
  79. data/app/controllers/caboose/block_types_controller.rb +6 -8
  80. data/app/controllers/caboose/cart_controller.rb +2 -2
  81. data/app/controllers/caboose/fonts_controller.rb +2 -139
  82. data/app/controllers/caboose/invoices_controller.rb +4 -5
  83. data/app/controllers/caboose/login_logs_controller.rb +7 -5
  84. data/app/controllers/caboose/media_categories_controller.rb +2 -16
  85. data/app/controllers/caboose/media_controller.rb +11 -14
  86. data/app/controllers/caboose/pages_controller.rb +42 -104
  87. data/app/controllers/caboose/posts_controller.rb +7 -53
  88. data/app/controllers/caboose/products_controller.rb +1 -1
  89. data/app/controllers/caboose/sites_controller.rb +6 -25
  90. data/app/controllers/caboose/sns_controller.rb +3 -3
  91. data/app/controllers/caboose/themes_controller.rb +0 -30
  92. data/app/controllers/caboose/users_controller.rb +10 -17
  93. data/app/controllers/caboose/variants_controller.rb +9 -9
  94. data/app/models/caboose/ab_variant.rb +1 -1
  95. data/app/models/caboose/asset.rb +23 -0
  96. data/app/models/caboose/asset_manager.rb +92 -0
  97. data/app/models/caboose/asset_manifest.rb +91 -0
  98. data/app/models/caboose/block.rb +24 -100
  99. data/app/models/caboose/block_cache.rb +105 -0
  100. data/app/models/caboose/block_cache_file.rb +22 -0
  101. data/app/models/caboose/block_cache_image.rb +53 -0
  102. data/app/models/caboose/block_type.rb +3 -4
  103. data/app/models/caboose/block_type_category.rb +2 -2
  104. data/app/models/caboose/block_type_parser.rb +1 -1
  105. data/app/models/caboose/block_type_source.rb +2 -2
  106. data/app/models/caboose/calendar_event_group.rb +2 -2
  107. data/app/models/caboose/category.rb +2 -2
  108. data/app/models/caboose/comment_routes.rb +8 -7
  109. data/app/models/caboose/core_plugin.rb +3 -4
  110. data/app/models/caboose/export.rb +1 -1
  111. data/app/models/caboose/font.rb +2 -7
  112. data/app/models/caboose/font_variant.rb +0 -12
  113. data/app/models/caboose/invoice.rb +14 -14
  114. data/app/models/caboose/line_item.rb +4 -4
  115. data/app/models/caboose/media.rb +4 -15
  116. data/app/models/caboose/media_category.rb +7 -5
  117. data/app/models/caboose/modification.rb +2 -2
  118. data/app/models/caboose/page.rb +54 -325
  119. data/app/models/caboose/page_bar_generator.rb +10 -20
  120. data/app/models/caboose/page_cache.rb +12 -0
  121. data/app/models/caboose/page_cacher.rb +137 -0
  122. data/app/models/caboose/post.rb +8 -108
  123. data/app/models/caboose/product.rb +5 -5
  124. data/app/models/caboose/product_image.rb +1 -1
  125. data/app/models/caboose/role.rb +2 -2
  126. data/app/models/caboose/schema.rb +72 -73
  127. data/app/models/caboose/site.rb +1 -203
  128. data/app/models/caboose/theme.rb +5 -70
  129. data/app/views/caboose/admin/_content.html.erb +44 -0
  130. data/app/views/caboose/admin/_fonts.html.erb +47 -0
  131. data/app/views/caboose/admin/_footer.html.erb +1 -0
  132. data/app/views/caboose/admin/_header.html.erb +12 -0
  133. data/app/views/caboose/admin/_icons.html.erb +6 -0
  134. data/app/views/caboose/admin/_mobile_navigation.html.erb +22 -0
  135. data/app/views/caboose/admin/_post.html.erb +74 -0
  136. data/app/views/caboose/admin/index.html.erb +33 -36
  137. data/app/views/caboose/block_types/admin_edit.html.erb +8 -6
  138. data/app/views/caboose/blocks/_file.html.erb +2 -2
  139. data/app/views/caboose/blocks/_ga.html.erb +2 -1
  140. data/app/views/caboose/blocks/_image.html.erb +0 -4
  141. data/app/views/caboose/blocks/_render_function.html.erb +4 -9
  142. data/app/views/caboose/fonts/admin_index.html.erb +10 -55
  143. data/app/views/caboose/invoices_mailer/customer_status_updated.html.erb +14 -5
  144. data/app/views/caboose/login_logs/admin_index_for_user.html.erb +1 -1
  145. data/app/views/caboose/media/admin_index.html.erb +24 -14
  146. data/app/views/caboose/my_account/index.html.erb +0 -1
  147. data/app/views/caboose/pages/_admin_header.html.erb +0 -5
  148. data/app/views/caboose/pages/admin_edit_content.html.erb +2 -6
  149. data/app/views/caboose/pages/admin_edit_general.html.erb +4 -32
  150. data/app/views/caboose/pages/admin_new_old.html.erb +46 -0
  151. data/app/views/caboose/pages/test.html.erb +64 -0
  152. data/app/views/caboose/posts/_admin_header.html.erb +0 -5
  153. data/app/views/caboose/posts/admin_delete_form.html.erb +1 -1
  154. data/app/views/caboose/posts/admin_edit_content.html.erb +2 -6
  155. data/app/views/caboose/products/admin_group_variants.html.erb +1 -1
  156. data/app/views/caboose/products/admin_sort.html copy.erb +1 -1
  157. data/app/views/caboose/sites/admin_edit.html.erb +0 -21
  158. data/app/views/caboose/themes/admin_edit.html.erb +3 -7
  159. data/app/views/caboose/users/_admin_header.html.erb +0 -4
  160. data/app/views/caboose/users/admin_edit_roles.html.erb +0 -1
  161. data/app/views/caboose/variants/admin_group.html.erb +1 -1
  162. data/app/views/layouts/caboose/admin.html.erb +2 -9
  163. data/app/views/layouts/caboose/application.html.erb +92 -62
  164. data/config/routes.rb +1 -4
  165. data/lib/caboose/version.rb +1 -1
  166. data/lib/tasks/caboose.rake +14 -3
  167. metadata +238 -57
  168. data/app/controllers/caboose/change_logs_controller.rb +0 -13
  169. data/app/models/caboose/change_log.rb +0 -97
  170. data/app/views/caboose/blocks/_cached_block.html.erb +0 -28
  171. data/app/views/caboose/change_logs/admin_index.html.erb +0 -65
  172. data/app/views/caboose/fonts/admin_family_edit.html.erb +0 -63
  173. data/app/views/caboose/fonts/admin_family_index.html.erb +0 -42
  174. data/app/views/caboose/fonts/admin_variant_edit.html.erb +0 -84
  175. data/app/views/caboose/pages/admin_change_logs.html.erb +0 -56
  176. data/app/views/caboose/pages/compiled_asset.css.erb +0 -0
  177. data/app/views/caboose/pages/compiled_asset.js.erb +0 -0
  178. data/app/views/caboose/posts/admin_change_logs.html.erb +0 -56
  179. data/app/views/caboose/sites/compiled_asset.css.erb +0 -0
  180. data/app/views/caboose/sites/compiled_asset.js.erb +0 -0
  181. data/app/views/caboose/themes/admin_error_log.html.erb +0 -9
  182. data/app/views/caboose/themes/admin_js.html.erb +0 -131
  183. data/app/views/caboose/users/admin_change_logs.html.erb +0 -63
  184. data/app/views/layouts/caboose/css.css.erb +0 -44
  185. data/app/views/layouts/caboose/footer_css.css.erb +0 -41
  186. data/app/views/layouts/caboose/footer_js.js.erb +0 -31
  187. data/app/views/layouts/caboose/js.js.erb +0 -34
@@ -21,15 +21,13 @@ module Caboose
21
21
  # itemsPerPage: Number of items you want to show per page. Defaults to 10 if not present.
22
22
  # page: Current page number. Defaults to 0 if not present.
23
23
  #
24
- attr_accessor :original_params, :params, :options, :custom_url_vars, :post_get, :use_game, :game_id
24
+ attr_accessor :original_params, :params, :options, :custom_url_vars, :post_get
25
25
 
26
26
  #def initialize(post_get, params = nil, options = nil, &custom_url_vars = nil)
27
27
  def initialize(post_get, params = nil, options = nil)
28
28
 
29
29
  params = {} if params.nil?
30
30
  options = {} if options.nil?
31
- @use_game = false
32
- @game_id = 0
33
31
 
34
32
  # Note: a few keys are required:
35
33
  # base_url, page, itemCount, itemsPerPage
@@ -53,22 +51,19 @@ module Caboose
53
51
  # search_field_2 => [association_name, join_table, column_name]
54
52
  # }
55
53
  }
56
-
57
54
  params.each do |key, val|
58
55
  @original_params[key] = val
59
56
  @params[key] = val
60
57
  end
61
-
62
- if @post_get['game_id'] && !@post_get['game_id'].blank?
63
- @use_game = true
64
- @game_id = @post_get['game_id']
65
- end
66
-
67
58
  options.each { |key, val| @options[key] = val }
68
59
 
60
+ #@params.each { |key, val|
61
+ # k = @options['abbreviations'].include?(key) ? @options['abbreviations'][key] : nil
62
+ # @params[key] = post_get[key].nil? ? (k && !post_get[k].nil? ? post_get[k] : val) : post_get[key]
63
+ #}
64
+
69
65
  new_params = {}
70
66
  keys_to_delete = []
71
-
72
67
  @params.each { |key, val|
73
68
  next if !@options['abbreviations'].has_key?(key)
74
69
  long_key = @options['abbreviations'][key]
@@ -77,11 +72,9 @@ module Caboose
77
72
  }
78
73
  keys_to_delete.each { |k| @params.delete(k) }
79
74
  new_params.each { |k,v| @params[k] = v }
80
- @original_params.each { |k,v| @original_params[k] = post_get[k] ? post_get[k] : v }
81
-
75
+ @original_params.each { |k,v| @original_params[k] = post_get[k] ? post_get[k] : v }
82
76
  @params.each { |k,v| @params[k] = post_get[k] ? post_get[k] : v }
83
- @options.each { |k,v| @options[k] = ok(post_get[k]) ? post_get[k] : v }
84
-
77
+ @options.each { |k,v| @options[k] = ok(post_get[k]) ? post_get[k] : v }
85
78
  #@custom_url_vars = custom_url_vars if !custom_url_vars.nil?
86
79
  @use_url_params = @options['use_url_params'].nil? ? Caboose.use_url_params : @options['use_url_params']
87
80
 
@@ -248,9 +241,9 @@ module Caboose
248
241
  if !@custom_url_vars.nil?
249
242
  return @custom_url_vars.call @options['base_url'], @params
250
243
  end
251
-
244
+
252
245
  vars = []
253
- @original_params.each do |k,v|
246
+ @original_params.each do |k,v|
254
247
  next if @options['skip'].include?(k)
255
248
  k = @options['abbreviations'].include?(k) ? @options['abbreviations'][k] : k
256
249
  if v.kind_of?(Array)
@@ -270,9 +263,6 @@ module Caboose
270
263
  end
271
264
  end
272
265
  end
273
- if @use_game
274
- vars.push("game_id=#{@game_id}")
275
- end
276
266
  if @use_url_params
277
267
  vars.push("sort/#{@options['sort']}")
278
268
  vars.push("desc/#{@options['desc']}")
@@ -0,0 +1,12 @@
1
+ module Caboose
2
+ class PageCache < ActiveRecord::Base
3
+ self.table_name = "page_cache"
4
+
5
+ belongs_to :page
6
+ attr_accessible :id,
7
+ :page_id,
8
+ :render_function,
9
+ :block
10
+
11
+ end
12
+ end
@@ -0,0 +1,137 @@
1
+
2
+ module Caboose
3
+ class PageCacher
4
+
5
+ def self.refresh
6
+ PageCache.where(:refresh => true).all.each do |pc|
7
+ # self.delay(:queue => 'caboose_cache').cache(pc.page_id)
8
+ end
9
+
10
+ # Make sure all pages are cached
11
+ query = ["select id from pages where id not in (select distinct(page_id) from page_cache)"]
12
+ rows = ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
13
+ if rows
14
+ # rows.each{ |row| self.delay(:queue => 'caboose_cache').cache(row['id'].to_i) }
15
+ end
16
+ end
17
+
18
+ def self.cache_all
19
+ query = ["select id from pages order by id"]
20
+ rows = ActiveRecord::Base.connection.execute(ActiveRecord::Base.send(:sanitize_sql_array, query))
21
+ if rows
22
+ # rows.each{ |row| self.delay(:queue => 'caboose_cache').cache(row['id'].to_i) }
23
+ end
24
+ end
25
+
26
+ def self.cache(page_id)
27
+ p = (page_id.is_a?(Integer) ? Page.where(:id => page_id).first : page_id)
28
+ return if p.nil?
29
+ return if p.site_id.nil?
30
+ return if p.site.nil?
31
+ return if p.block.nil?
32
+
33
+ @render_functions = {} if @render_functions.nil?
34
+ @page_render_functions = {} if @page_render_functions.nil?
35
+ @page_render_functions[p.id] = []
36
+ @dups = {}
37
+
38
+ self.cache_helper(p.site, p, p.block)
39
+
40
+ arr = @page_render_functions[p.id].collect do |bt_id|
41
+ "<% def render_block_type_#{bt_id}(block, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site) %>#{@render_functions[bt_id]}<% end %>"
42
+ end
43
+
44
+ dups = []
45
+ @dups.each{ |bt_id, arr| dups << "#{bt_id} => [#{arr.join(',')}]" }
46
+ dups = dups.join(', ')
47
+
48
+ str = arr.join("\n\n")
49
+ str << "<%\n"
50
+ str << "def dup_id(bt_id)\n"
51
+ str << " dups = {#{dups}}\n"
52
+ str << " dups.each do |bt_id2, arr|\n"
53
+ str << " return bt_id2 if arr.include?(bt_id)\n"
54
+ str << " end\n"
55
+ str << " return bt_id\n"
56
+ str << "end\n"
57
+ str << "def render_block_type(block, child_block, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site)\n"
58
+ str << " b = child_block && child_block.is_a?(String) ? block.child(child_block) : child_block\n"
59
+ str << " send(\"render_block_type_\#\{dup_id(b.block_type_id)\}\", b, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site)\n"
60
+ str << "end\n\n"
61
+ str << "render_block_type_#{p.block.block_type_id}(@block, @page, @view, @controller_view_content, @modal, @empty_text, @editing, @css, @js, @csrf_meta_tags, @csrf_meta_tags2, @logged_in_user, @site)\n"
62
+ str << "%>\n"
63
+
64
+ pc = PageCache.where(:page_id => p.id).first
65
+ pc = PageCache.new(:page_id => p.id) if pc.nil?
66
+ pc.render_function = str
67
+ pc.block = Marshal.dump(BlockCache.new(p.block))
68
+ pc.refresh = false
69
+ pc.save
70
+ end
71
+
72
+ def self.cache_helper(site, p, block)
73
+ return if block.nil?
74
+ self.cache_helper2(site, p, block.block_type)
75
+ block.children.each{ |b2| self.cache_helper(site, p, b2) }
76
+ end
77
+
78
+ def self.cache_helper2(site, p, bt)
79
+ return if bt.nil?
80
+ self.add_block_type(site, p, bt)
81
+ bt.children.each{ |bt2| self.cache_helper2(site, p, bt2) }
82
+ end
83
+
84
+ def self.add_block_type(site, p, bt)
85
+ return if bt.nil?
86
+ if !@render_functions.has_key?(bt.id)
87
+ f = ''
88
+ if bt.use_render_function && bt.render_function
89
+ f = bt.render_function
90
+ else
91
+ full_name = bt.full_name
92
+ full_name = "lksdjflskfjslkfjlskdfjlkjsdf" if full_name.nil? || full_name.length == 0
93
+ #if File.file?(Rails.root.join("sites/#{site.name}/blocks/_#{full_name}.html.erb" )) then f = Rails.root.join("sites/#{site.name}/blocks/_#{full_name}.html.erb")
94
+ #elsif File.file?(Rails.root.join("sites/#{site.name}/blocks/_#{bt.name}.html.erb" )) then f = Rails.root.join("sites/#{site.name}/blocks/_#{bt.name}.html.erb")
95
+ #elsif File.file?(Rails.root.join("sites/#{site.name}/blocks/_#{bt.field_type}.html.erb" )) then f = Rails.root.join("sites/#{site.name}/blocks/_#{bt.field_type}.html.erb")
96
+ if File.file?(Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{full_name}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{full_name}.html.erb")
97
+ elsif File.file?(Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{bt.name}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{bt.name}.html.erb")
98
+ elsif File.file?(Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{bt.field_type}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/#{site.name}/_#{bt.field_type}.html.erb")
99
+ elsif File.file?(Rails.root.join("app/views/caboose/blocks/_#{full_name}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/_#{full_name}.html.erb")
100
+ elsif File.file?(Rails.root.join("app/views/caboose/blocks/_#{bt.name}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/_#{bt.name}.html.erb")
101
+ elsif File.file?(Rails.root.join("app/views/caboose/blocks/_#{bt.field_type}.html.erb" )) then f = Rails.root.join("app/views/caboose/blocks/_#{bt.field_type}.html.erb")
102
+ elsif File.file?("#{Caboose.root}/app/views/caboose/blocks/_#{full_name}.html.erb" ) then f = "#{Caboose.root}/app/views/caboose/blocks/_#{full_name}.html.erb"
103
+ elsif File.file?("#{Caboose.root}/app/views/caboose/blocks/_#{bt.name}.html.erb" ) then f = "#{Caboose.root}/app/views/caboose/blocks/_#{bt.name}.html.erb"
104
+ elsif File.file?("#{Caboose.root}/app/views/caboose/blocks/_#{bt.field_type}.html.erb" ) then f = "#{Caboose.root}/app/views/caboose/blocks/_#{bt.field_type}.html.erb"
105
+ end
106
+ f = (f && f.to_s.strip.length > 0 ? File.read(f) : '')
107
+ end
108
+ f.gsub!(/block\.partial\((.*?),(.*?)\)/ , 'render :partial => \1')
109
+ f.gsub!(/block\.render\((.*?),(.*?)\)/ , 'render_block_type(block, \1, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site)')
110
+ f.gsub!(/\=\s*render_block_type\(/ , 'render_block_type(')
111
+ f.gsub!(/\=\s*raw render_block_type\(/ , 'render_block_type(')
112
+ f.gsub!(/block.children.where\(([^\)]*?)\)\.all/, 'block.children_where(\1)')
113
+
114
+ #@render_functions[bt.id] = "<% def render_block_type_#{bt.id}(block, page, view, controller_view_content, modal, empty_text, editing, css, js, csrf_meta_tags, csrf_meta_tags2, logged_in_user, site) %>#{f}<% end %>"
115
+
116
+ @render_functions[bt.id] = f
117
+ end
118
+
119
+ is_dup = false
120
+ f = @render_functions[bt.id]
121
+ @render_functions.each do |bt_id, f2|
122
+ if f == f2 && @page_render_functions[p.id].include?(bt_id)
123
+ @dups[bt_id] = [] if !@dups.has_key?(bt_id)
124
+ @dups[bt_id] << bt.id if !@dups[bt_id].include?(bt.id)
125
+ is_dup = true
126
+ break
127
+ end
128
+ end
129
+
130
+ if !is_dup
131
+ @page_render_functions[p.id] = [] if !@page_render_functions.has_key?(p.id)
132
+ @page_render_functions[p.id] << bt.id if !@page_render_functions[p.id].include?(bt.id)
133
+ end
134
+ end
135
+
136
+ end
137
+ end
@@ -18,7 +18,8 @@ class Caboose::Post < ActiveRecord::Base
18
18
  :image_url ,
19
19
  :published ,
20
20
  :created_at ,
21
- :updated_at
21
+ :updated_at ,
22
+ :status
22
23
 
23
24
  has_attached_file :image,
24
25
  :path => ':caboose_prefixposts/:id_:style.:extension',
@@ -48,96 +49,9 @@ class Caboose::Post < ActiveRecord::Base
48
49
  Caboose::Block.where(:post_id => self.id).where('status != ?','published').count == 0 if !self.id.nil?
49
50
  end
50
51
 
51
- # Returns an array of block IDs for all descendant blocks of the homepage footer
52
- def self.home_page_footer_block_ids(post)
53
- home_page = Caboose::Page.index_page(post.site_id)
54
- home_footer = home_page ? home_page.block.child('footer') : nil
55
- if home_footer
56
- footer_ids = [home_footer.id]
57
- home_footer.children.where("name is null").each do |f1|
58
- footer_ids << f1.id
59
- f1.children.where("name is null").each do |f2|
60
- footer_ids << f2.id
61
- f2.children.where("name is null").each do |f3|
62
- footer_ids << f3.id
63
- f3.children.where("name is null").each do |f4|
64
- footer_ids << f4.id
65
- f4.children.where("name is null").each do |f5|
66
- footer_ids << f5.id
67
- end
68
- end
69
- end
70
- end
71
- end
72
- return footer_ids
73
- else
74
- return [0]
75
- end
76
- end
77
-
78
- def update_cached_blocks(block_ids)
79
- blocks = block_ids && block_ids.count > 0 ? Caboose::Block.where("id in (?)", block_ids).order(:id).all : []
80
- blocks.each do |b|
81
- b.use_cache = false
82
- b.save
83
- b.delay(:queue => 'caching', :priority => 6).update_cache
84
- end
85
- end
86
-
87
- def cached_css
88
- str = ''
89
- return str if self.site.nil? || !self.site.use_caching
90
- footer_ids = Caboose::Post.home_page_footer_block_ids(self)
91
- blocks = Caboose::Block.includes(:block_type).where("blocks.post_id = ? OR blocks.parent_id in (?)",self.id,footer_ids).where("blocks.cached_css IS NOT NULL").where("block_types.is_dynamic = false").all
92
- blocks.each do |b|
93
- str << b.cached_css
94
- end
95
- return str.blank? ? '' : str.gsub(/<\/style>(\s*)<style>/,'')
96
- end
97
-
98
- def cached_js
99
- str = ''
100
- return str if self.site.nil? || !self.site.use_caching
101
- footer_ids = Caboose::Post.home_page_footer_block_ids(self)
102
- blocks = Caboose::Block.includes(:block_type).where("blocks.post_id = ? OR blocks.parent_id in (?)",self.id,footer_ids).where("blocks.cached_js IS NOT NULL").where("block_types.is_dynamic = false").all
103
- blocks.each do |b|
104
- str << b.cached_js
105
- end
106
- return str
107
- end
108
-
109
- def publish(user_id)
52
+ def publish
110
53
  if !self.id.nil?
111
- use_caching = self.site.use_caching
112
- changed_ids = []
113
54
  Caboose::Block.where(:post_id => self.id).where('status = ? OR status = ?','edited','added').all.each do |b|
114
- if self.site && self.site.use_change_logs
115
- if b.new_parent_id.blank? && b.new_value.blank? && b.sort_order == b.new_sort_order && b.status == 'edited'
116
- # This one just got moved because something else was added
117
- else
118
- cl = Caboose::ChangeLog.create(:site_id => self.site_id, :user_id => user_id, :post_id => self.id, :block_id => b.id, :block_parent_id => b.parent_id, :timestamp => DateTime.now, :action => b.status)
119
- desc = ""
120
- desc += b.parent.parent.block_type.description + " -> " if b.parent && b.parent.parent && b.parent.parent.block_type && b.parent.parent.block_type.description != "Content" && !b.parent.parent.block_type.name.include?('layout')
121
- pos = b.parent && b.parent.block_type && b.parent.block_type.name == 'flex_grid_unit' ? b.parent.sort_order + 1 : nil
122
- desc += b.parent.block_type.description + " #{pos} -> " if b.parent && b.parent.block_type && b.parent.block_type.description != "Content" && !b.parent.block_type.name.include?('layout')
123
- desc += b.block_type.description if b.block_type
124
- cl.description = desc
125
- cl.is_field = true if !b.name.blank?
126
- ov = ['page','page_id'].include?(b.name) ? Caboose::Page.title_for_id(b.value) : b.value
127
- nv = ['page','page_id'].include?(b.name) ? Caboose::Page.title_for_id(b.new_value) : b.new_value
128
- if b.new_value.blank? && !b.new_media_id.blank?
129
- ov = Caboose::Media.title_for_id(b.media_id)
130
- nv = Caboose::Media.title_for_id(b.new_media_id)
131
- end
132
- cl.old_value = ov
133
- cl.new_value = nv
134
- cl.old_sort_order = b.sort_order
135
- cl.new_sort_order = b.new_sort_order
136
- cl.old_parent_id = b.parent_id
137
- cl.new_parent_id = b.new_parent_id
138
- cl.save
139
- end
140
- end
141
55
  if b.new_value == 'EMPTY'
142
56
  b.value = nil
143
57
  elsif !b.new_value.blank?
@@ -153,32 +67,16 @@ class Caboose::Post < ActiveRecord::Base
153
67
  b.status = 'published'
154
68
  b.new_value = nil
155
69
  b.new_media_id = nil
156
- b.new_sort_order = b.sort_order
70
+ b.new_sort_order = nil
157
71
  b.new_parent_id = nil
158
72
  b.save
159
- # Update cached value for the closest cached ancestor of this block
160
- changed_ids << b.cached_ancestor if use_caching
161
- end
162
- if use_caching # Catch published blocks that have never been cached before
163
- content = self.block.child('content')
164
- Caboose::Block.includes(:block_type).where(:parent_id => content.id, :status => 'published', :cached_value => nil, :name => nil).where("block_types.is_dynamic = false").all.each do |b|
165
- changed_ids << b.cached_ancestor
166
- end
167
73
  end
168
74
  deleted_blocks = Caboose::Block.where(:post_id => self.id, :status => 'deleted').pluck(:id)
169
75
  dids = deleted_blocks.blank? ? 0 : deleted_blocks
170
- if self.site && self.site.use_change_logs
171
- Caboose::Block.where("id in (?)",dids).all.each do |b|
172
- cl = Caboose::ChangeLog.create(:site_id => self.site_id, :user_id => user_id, :post_id => self.id, :block_id => b.id, :block_parent_id => b.parent_id, :timestamp => DateTime.now, :action => 'deleted')
173
- cl.old_value = b.new_value.blank? ? b.value : b.new_value
174
- cl.description = b.block_type.description if b.block_type
175
- cl.is_field = true if !b.name.blank?
176
- cl.save
177
- end
178
- end
179
76
  Caboose::Block.where("id in (?) or parent_id in (?)",dids,dids).destroy_all
180
77
  Caboose::Block.where(:post_id => self.id, :status => nil).update_all(:status => 'published')
181
- self.update_cached_blocks(changed_ids) if use_caching
78
+ self.status = 'published'
79
+ self.save
182
80
  end
183
81
  end
184
82
 
@@ -186,6 +84,8 @@ class Caboose::Post < ActiveRecord::Base
186
84
  if !self.id.nil?
187
85
  Caboose::Block.where(:post_id => self.id).where(:status => 'added').destroy_all
188
86
  Caboose::Block.where(:post_id => self.id).update_all("status = 'published', new_value = null, new_media_id = null, new_sort_order = sort_order, new_parent_id = null")
87
+ self.status = 'published'
88
+ self.save
189
89
  end
190
90
  end
191
91
 
@@ -10,11 +10,11 @@ module Caboose
10
10
  has_many :customizations, :class_name => 'Caboose::Product', :through => :customization_memberships
11
11
  has_many :customization_memberships, :class_name => 'Caboose::CustomizationMembership'
12
12
  has_many :categories, :class_name => 'Caboose::Category', :through => :category_memberships
13
- has_many :category_memberships, :class_name => 'Caboose::CategoryMembership'
14
- has_many :variants, :class_name => 'Caboose::Variant', :order => 'option1_sort_order, option2_sort_order, option3_sort_order'
13
+ has_many :category_memberships, :class_name => 'Caboose::CategoryMembership'
14
+ has_many :variants, -> { order('option1_sort_order, option2_sort_order, option3_sort_order') }, :class_name => 'Caboose::Variant'
15
15
  has_many :product_images, :class_name => 'Caboose::ProductImage'
16
- has_many :product_inputs, :class_name => 'Caboose::ProductInput'
17
- has_many :modifications, :class_name => 'Caboose::Modification', :order => 'sort_order'
16
+ has_many :product_inputs, :class_name => 'Caboose::ProductInput'
17
+ has_many :modifications, -> { order(:sort_order) }, :class_name => 'Caboose::Modification'
18
18
  has_many :reviews, :class_name => 'Caboose::Review'
19
19
  has_many :product_category_sorts, :class_name => 'Caboose::ProductCategorySort'
20
20
 
@@ -218,7 +218,7 @@ module Caboose
218
218
 
219
219
  def Product.update_on_sale
220
220
  Product.reorder(:id).all.each do |p|
221
- p.delay(:queue => 'general', :priority => 15).update_on_sale
221
+ p.delay(:queue => 'caboose_store').update_on_sale
222
222
  end
223
223
  end
224
224
 
@@ -35,7 +35,7 @@ module Caboose
35
35
  do_not_validate_attachment_file_type :image
36
36
  #validates_attachment_content_type :image, :content_type => ["image/jpg", "image/jpeg", "image/png"]
37
37
 
38
- default_scope order('position ASC')
38
+ default_scope { order('position ASC') }
39
39
 
40
40
  def process
41
41
  config = AssetSync.config
@@ -43,10 +43,10 @@ class Caboose::Role < ActiveRecord::Base
43
43
 
44
44
  def is_allowed(resource, action)
45
45
  # Check for the admin permission
46
- exc = ["theme","site_settings"] # Excluded resources for ALL permission - must be specifically designated
47
46
  for perm in permissions
48
- return true if (perm.resource == "all" && perm.action == "all" && !exc.include?(resource))
47
+ return true if (perm.resource == "all" && perm.action == "all")
49
48
  end
49
+
50
50
  if (resource.is_a?(Caboose::Page))
51
51
  for perm in page_permissions
52
52
  return true if (perm.page_id == resource.id && perm.action == action)
@@ -6,6 +6,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
6
6
  {
7
7
  :roles_users => :role_memberships,
8
8
  :permissions_roles => :role_permissions,
9
+ #:page_block_field_values => :fields,
10
+ #:page_block_fields => :field_types,
9
11
  :page_block_types => :block_types,
10
12
  :page_blocks => :blocks,
11
13
  :store_order_discounts => :store_invoice_discounts,
@@ -88,9 +90,8 @@ class Caboose::Schema < Caboose::Utilities::Schema
88
90
  :decremented ,
89
91
  :user_subscription_id
90
92
  ],
93
+ #Caboose::PageCache => [:block],
91
94
  #Caboose::RetargetingConfig => [:fb_pixels_function],
92
- Caboose::Page => [:content_format, :linked_resources, :layout, :status],
93
- Caboose::Post => [:hide, :image_url, :status],
94
95
  Caboose::ShippingPackage => [:price, :carrier, :service_code, :service_name, :shipping_method_id, :length, :width, :height],
95
96
  Caboose::Site => [:shipping_cost_function],
96
97
  Caboose::StoreConfig => [:use_usps, :allowed_shipping_codes, :default_shipping_code, :pp_relay_url, :pp_response_url],
@@ -145,6 +146,15 @@ class Caboose::Schema < Caboose::Utilities::Schema
145
146
  [ :country , :string ],
146
147
  [ :country_code , :string ],
147
148
  [ :phone , :string ]
149
+ ],
150
+ Caboose::Asset => [
151
+ [ :page_id , :integer ],
152
+ [ :user_id , :integer ],
153
+ [ :date_uploaded , :datetime ],
154
+ [ :name , :string ],
155
+ [ :filename , :string ],
156
+ [ :description , :string ],
157
+ [ :extension , :string ]
148
158
  ],
149
159
  Caboose::Block => [
150
160
  [ :page_id , :integer ],
@@ -165,11 +175,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
165
175
  [ :new_parent_id, :integer ],
166
176
  [ :new_sort_order, :integer ],
167
177
  [ :new_value, :text ],
168
- [ :new_media_id , :integer ],
169
- [ :cached_value, :text ],
170
- [ :cached_css, :text ],
171
- [ :cached_js, :text ],
172
- [ :use_cache, :boolean , { :default => false }]
178
+ [ :new_media_id , :integer ]
173
179
  ],
174
180
  Caboose::BlockType => [
175
181
  [ :parent_id , :integer ],
@@ -198,8 +204,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
198
204
  [ :default_included , :boolean , { :default => false }],
199
205
  [ :default_full_width , :boolean , { :default => false }],
200
206
  [ :share , :boolean , { :default => true }],
201
- [ :downloaded , :boolean , { :default => false }],
202
- [ :is_dynamic, :boolean , { :default => false }]
207
+ [ :downloaded , :boolean , { :default => false }]
203
208
  ],
204
209
  Caboose::BlockTypeSiteMembership => [
205
210
  [ :site_id , :integer ],
@@ -283,25 +288,6 @@ class Caboose::Schema < Caboose::Utilities::Schema
283
288
  [ :product_id , :integer ],
284
289
  [ :sort_order , :integer , { :default => 0 }]
285
290
  ],
286
- Caboose::ChangeLog => [
287
- [ :site_id, :integer ],
288
- [ :page_id, :integer ],
289
- [ :post_id, :integer ],
290
- [ :block_id, :integer ],
291
- [ :media_id, :integer ],
292
- [ :user_id, :integer ],
293
- [ :description, :string ],
294
- [ :action, :string ],
295
- [ :timestamp, :datetime ],
296
- [ :old_value, :text ],
297
- [ :new_value, :text ],
298
- [ :old_parent_id, :integer ],
299
- [ :new_parent_id, :integer ],
300
- [ :old_sort_order, :integer ],
301
- [ :new_sort_order, :integer ],
302
- [ :is_field, :boolean , { :default => false }],
303
- [ :block_parent_id, :integer ]
304
- ],
305
291
  Caboose::CustomizationMembership => [
306
292
  [ :product_id , :integer ],
307
293
  [ :customization_id , :integer ]
@@ -339,8 +325,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
339
325
  [ :name , :string ],
340
326
  [ :family , :string ],
341
327
  [ :variant , :string ],
342
- [ :url , :string ],
343
- [ :variant_id , :integer ]
328
+ [ :url , :string ]
344
329
  ],
345
330
  Caboose::FontFamily => [
346
331
  [ :name , :string ]
@@ -351,9 +336,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
351
336
  [ :ttf_url , :string ],
352
337
  [ :weight , :string ],
353
338
  [ :style , :string ],
354
- [ :sort_order , :integer ],
355
- [ :ttf_file , :attachment ],
356
- [ :woff_file , :attachment ]
339
+ [ :sort_order , :integer ]
357
340
  ],
358
341
  Caboose::FormSubmission => [
359
342
  [ :site_id, :integer ],
@@ -495,8 +478,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
495
478
  [ :original_name , :string ],
496
479
  [ :image , :attachment ],
497
480
  [ :file , :attachment ],
498
- [ :processed , :boolean , { :default => false }],
499
- [ :deleted , :boolean , { :default => false }]
481
+ [ :processed , :boolean , { :default => false }]
500
482
  ],
501
483
  Caboose::Modification => [
502
484
  [ :product_id , :integer ],
@@ -587,6 +569,24 @@ class Caboose::Schema < Caboose::Utilities::Schema
587
569
  [ :gift_message , :text ],
588
570
  [ :include_receipt , :boolean , { :default => true }],
589
571
  [ :instore_pickup , :boolean , { :default => false }]
572
+
573
+ #[ :email , :string ],
574
+ #[ :invoice_number , :string ],
575
+ #[ :payment_id , :integer ],
576
+ #[ :gateway_id , :integer ],
577
+ #[ :date_authorized , :datetime ],
578
+ #[ :date_captured , :datetime ],
579
+ #[ :date_cancelled , :datetime ],
580
+ #[ :shipping_carrier , :string ],
581
+ #[ :shipping_service_code , :string ],
582
+ #[ :shipping_service_name , :string ],
583
+ #[ :transaction_id , :string ],
584
+ #[ :transaction_id , :string ],
585
+ #[ :transaction_service , :string ],
586
+ #[ :amount_discounted , :numeric ],
587
+ #[ :auth_code , :string ],
588
+ #[ :date_shipped , :datetime ],
589
+ #[ :decremented , :boolean ]
590
590
  ],
591
591
  Caboose::Page => [
592
592
  [ :site_id , :integer ],
@@ -598,10 +598,13 @@ class Caboose::Schema < Caboose::Utilities::Schema
598
598
  [ :uri , :string ],
599
599
  [ :redirect_url , :string ],
600
600
  [ :hide , :boolean , { :default => false }],
601
+ [ :content_format , :integer , { :default => Caboose::Page::CONTENT_FORMAT_HTML }],
601
602
  [ :custom_css , :text ],
602
603
  [ :custom_css_files , :text ],
603
604
  [ :custom_js , :text ],
604
605
  [ :custom_js_files , :text ],
606
+ [ :linked_resources , :text ],
607
+ [ :layout , :string ],
605
608
  [ :sort_order , :integer , { :default => 0 }],
606
609
  [ :custom_sort_children , :boolean , { :default => false }],
607
610
  [ :seo_title , :string , { :limit => 200 }],
@@ -611,9 +614,14 @@ class Caboose::Schema < Caboose::Utilities::Schema
611
614
  [ :canonical_url , :string ],
612
615
  [ :fb_description , :string , { :limit => 300 }],
613
616
  [ :gp_description , :string , { :limit => 300 }],
614
- [ :css_digest , :string ],
615
- [ :js_digest , :string ]
616
- ],
617
+ [ :status, :string ]
618
+ ],
619
+ Caboose::PageCache => [
620
+ [ :page_id , :integer ],
621
+ [ :render_function , :text ],
622
+ [ :block , :binary ],
623
+ [ :refresh , :boolean , { :default => false }]
624
+ ],
617
625
  Caboose::PageCustomField => [
618
626
  [ :site_id , :integer ],
619
627
  [ :key , :string ],
@@ -675,12 +683,15 @@ class Caboose::Schema < Caboose::Utilities::Schema
675
683
  [ :author , :text ],
676
684
  [ :body , :text ],
677
685
  [ :preview , :text ],
686
+ [ :hide , :boolean ],
687
+ [ :image_url , :text ],
678
688
  [ :published , :boolean ],
679
689
  [ :created_at , :datetime ],
680
690
  [ :updated_at , :datetime ],
681
691
  [ :image , :attachment ],
682
692
  [ :slug , :string ],
683
- [ :uri , :string ]
693
+ [ :uri , :string ],
694
+ [ :status , :string ]
684
695
  ],
685
696
  Caboose::PostCategory => [
686
697
  [ :site_id , :integer ],
@@ -892,14 +903,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
892
903
  [ :head_code, :text ],
893
904
  [ :body_open_code, :text ],
894
905
  [ :body_close_code, :text ],
895
- [ :recaptcha_threshold, :float, { :default => 0.05 } ],
896
- [ :use_change_logs, :boolean , { :default => false }],
897
- [ :google_api_key, :string ],
898
- [ :use_caching, :boolean , { :default => false }],
899
- [ :footer_css_digest, :string ],
900
- [ :footer_js_digest, :string ],
901
- [ :custom_css_files , :text ],
902
- [ :custom_js_files , :text ]
906
+ [ :recaptcha_threshold, :float, { :default => 0.05 } ]
903
907
  ],
904
908
  Caboose::SiteMembership => [
905
909
  [ :site_id , :integer ],
@@ -1098,12 +1102,7 @@ class Caboose::Schema < Caboose::Utilities::Schema
1098
1102
  [ :mobile_logo_height, :string ],
1099
1103
  [ :mobile_logo_top_padding, :string ],
1100
1104
  [ :constrain_footer, :string ],
1101
- [ :heading_base_font_size, :string ],
1102
- [ :sass_error, :text ],
1103
- [ :main_js, :text ],
1104
- [ :js_digest, :string ],
1105
- [ :default_page_padding, :string ],
1106
- [ :default_page_constrain, :string ]
1105
+ [ :heading_base_font_size, :string ]
1107
1106
  ],
1108
1107
  Caboose::ThemeFile => [
1109
1108
  [ :filename, :string ],
@@ -1363,28 +1362,28 @@ class Caboose::Schema < Caboose::Utilities::Schema
1363
1362
  btc.create(:name => 'Rows', :parent_id => content.id) if !btc.where(:name => 'Rows', :parent_id => content.id).exists?
1364
1363
 
1365
1364
  # Create default block types
1366
- # if !Caboose::BlockType.where(:name => 'layout_basic').exists?
1367
- # bt = Caboose::BlockType.create(:name => 'layout_basic', :description => 'Basic', :block_type_category_id => layouts.id, :use_render_function_for_layout => true, :allow_child_blocks => false, :field_type => 'block')
1368
- # Caboose::BlockType.create(:name => 'header' , :description => 'Header' , :parent_id => bt.id, :field_type => 'block')
1369
- # Caboose::BlockType.create(:name => 'content' , :description => 'Content' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1370
- # Caboose::BlockType.create(:name => 'footer' , :description => 'Footer' , :parent_id => bt.id, :field_type => 'block')
1371
- # end
1365
+ if !Caboose::BlockType.where(:name => 'layout_basic').exists?
1366
+ bt = Caboose::BlockType.create(:name => 'layout_basic', :description => 'Basic', :block_type_category_id => layouts.id, :use_render_function_for_layout => true, :allow_child_blocks => false, :field_type => 'block')
1367
+ Caboose::BlockType.create(:name => 'header' , :description => 'Header' , :parent_id => bt.id, :field_type => 'block')
1368
+ Caboose::BlockType.create(:name => 'content' , :description => 'Content' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1369
+ Caboose::BlockType.create(:name => 'footer' , :description => 'Footer' , :parent_id => bt.id, :field_type => 'block')
1370
+ end
1372
1371
 
1373
- # if !Caboose::BlockType.where(:name => 'layout_left_sidebar').exists?
1374
- # bt = Caboose::BlockType.create(:name => 'layout_left_sidebar', :description => 'Left Sidebar', :block_type_category_id => layouts.id, :use_render_function_for_layout => true, :allow_child_blocks => false, :field_type => 'block')
1375
- # Caboose::BlockType.create(:name => 'header' , :description => 'Header' , :parent_id => bt.id, :field_type => 'block')
1376
- # Caboose::BlockType.create(:name => 'sidebar' , :description => 'Sidebar' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1377
- # Caboose::BlockType.create(:name => 'content' , :description => 'Content' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1378
- # Caboose::BlockType.create(:name => 'footer' , :description => 'Footer' , :parent_id => bt.id, :field_type => 'block')
1379
- # end
1372
+ if !Caboose::BlockType.where(:name => 'layout_left_sidebar').exists?
1373
+ bt = Caboose::BlockType.create(:name => 'layout_left_sidebar', :description => 'Left Sidebar', :block_type_category_id => layouts.id, :use_render_function_for_layout => true, :allow_child_blocks => false, :field_type => 'block')
1374
+ Caboose::BlockType.create(:name => 'header' , :description => 'Header' , :parent_id => bt.id, :field_type => 'block')
1375
+ Caboose::BlockType.create(:name => 'sidebar' , :description => 'Sidebar' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1376
+ Caboose::BlockType.create(:name => 'content' , :description => 'Content' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1377
+ Caboose::BlockType.create(:name => 'footer' , :description => 'Footer' , :parent_id => bt.id, :field_type => 'block')
1378
+ end
1380
1379
 
1381
- # if !Caboose::BlockType.where(:name => 'layout_right_sidebar').exists?
1382
- # bt = Caboose::BlockType.create(:name => 'layout_right_sidebar', :description => 'Right Sidebar', :block_type_category_id => layouts.id, :use_render_function_for_layout => true, :allow_child_blocks => false, :field_type => 'block')
1383
- # Caboose::BlockType.create(:name => 'header' , :description => 'Header' , :parent_id => bt.id, :field_type => 'block')
1384
- # Caboose::BlockType.create(:name => 'sidebar' , :description => 'Sidebar' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1385
- # Caboose::BlockType.create(:name => 'content' , :description => 'Content' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1386
- # Caboose::BlockType.create(:name => 'footer' , :description => 'Footer' , :parent_id => bt.id, :field_type => 'block')
1387
- # end
1380
+ if !Caboose::BlockType.where(:name => 'layout_right_sidebar').exists?
1381
+ bt = Caboose::BlockType.create(:name => 'layout_right_sidebar', :description => 'Right Sidebar', :block_type_category_id => layouts.id, :use_render_function_for_layout => true, :allow_child_blocks => false, :field_type => 'block')
1382
+ Caboose::BlockType.create(:name => 'header' , :description => 'Header' , :parent_id => bt.id, :field_type => 'block')
1383
+ Caboose::BlockType.create(:name => 'sidebar' , :description => 'Sidebar' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1384
+ Caboose::BlockType.create(:name => 'content' , :description => 'Content' , :parent_id => bt.id, :field_type => 'block', :allow_child_blocks => true)
1385
+ Caboose::BlockType.create(:name => 'footer' , :description => 'Footer' , :parent_id => bt.id, :field_type => 'block')
1386
+ end
1388
1387
 
1389
1388
  if !Caboose::BlockType.where(:name => 'heading').exists?
1390
1389
  bt = Caboose::BlockType.create(:name => 'heading', :description => 'Heading', :field_type => 'block')