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
@@ -18,27 +18,7 @@
18
18
 
19
19
  #uploader {
20
20
  .caboose-btn {
21
- margin-right: 5px;
22
- font-size: 14px;
23
- line-height: 25px;
24
- &.red {
25
- background: #bc5252;
26
- &:hover {
27
- background: shade(#bc5252, 15%);
28
- }
29
- }
30
- &.green {
31
- background: #51bd63;
32
- &:hover {
33
- background: shade(#51bd63, 15%);
34
- }
35
- }
36
- &.blue {
37
- background: #516dbb;
38
- &:hover {
39
- background: shade(#516dbb, 15%);
40
- }
41
- }
21
+ margin-right: 6px;
42
22
  }
43
23
  }
44
24
 
@@ -122,7 +102,6 @@
122
102
  }
123
103
 
124
104
  #media {
125
- margin-top: 10px;
126
105
  padding-right: 2%;
127
106
  ul {
128
107
  list-style: none;
@@ -195,7 +174,7 @@
195
174
  font-size: 12px;
196
175
  text-align: center;
197
176
  background: rgba(0,0,0,0.7);
198
- padding: 3px 5px 4px 5px;
177
+ padding: 3px;
199
178
  color: #fff;
200
179
  text-decoration: none !important;
201
180
  }
@@ -227,7 +206,7 @@
227
206
  text-align: center;
228
207
  color: #000;
229
208
  border-radius: 4px;
230
- padding: 3px 5px 4px 5px;
209
+ padding: 4px;
231
210
  &:focus {
232
211
  outline-width: 0;
233
212
  }
@@ -236,7 +215,7 @@
236
215
  color: #fff;
237
216
  float: left;
238
217
  &:hover {
239
- background: shade(#516dbb, 15%);
218
+ background: shade(#516dbb, 10%);
240
219
  }
241
220
  }
242
221
  &.dl {
@@ -247,7 +226,7 @@
247
226
  color: #fff;
248
227
  // width: 100%;
249
228
  &:hover {
250
- background: shade(#51bd63, 15%);
229
+ background: shade(#51bd63, 10%);
251
230
  }
252
231
  &.i {
253
232
  width: auto;
@@ -7,17 +7,12 @@
7
7
  *
8
8
  * You're free to add application-wide styles to this file and they'll appear at the top of the
9
9
  * compiled file, but it's generally better to create a new file per style scope.
10
- *
10
+ *
11
+ *= require colorbox-rails
12
+ *= require caboose/page_bar_generator
13
+ *= require caboose/model_binder
11
14
  */
12
15
 
13
-
14
-
15
- /* Removed:; */
16
- /*
17
- require colorbox-rails
18
- require caboose/page_bar_generator
19
- require caboose/model_binder
20
-
21
16
  #cboxLoadedContent { margin-bottom: 0; }
22
17
 
23
18
  #cboxTopLeft,
@@ -29,5 +24,4 @@ require caboose/model_binder
29
24
  #cboxTopCenter,
30
25
  #cboxBottomCenter,
31
26
  #cboxClose { background: #111; }
32
- #cboxWrapper { border-radius: 7px !important; }
33
- */
27
+ #cboxWrapper { border-radius: 7px !important; }
@@ -82,7 +82,6 @@
82
82
  border-radius: 0;
83
83
  line-height: 40px;
84
84
  text-align: left;
85
- color: #000;
86
85
  &:focus {
87
86
  outline-width: 0;
88
87
  border-color: #b1d9f5;
@@ -7,10 +7,10 @@ html { width: 100%; }
7
7
  @import url('https://fonts.googleapis.com/css?family=Roboto:400,400i,700,700i');
8
8
 
9
9
  body {
10
- background: #111111;
10
+ background: #fff;
11
11
  margin: 0;
12
12
  padding: 0;
13
- color: #fff;
13
+ color: #000;
14
14
  width: 100%;
15
15
  font-family: "Roboto", Arial;
16
16
  font-weight: 400;
@@ -30,8 +30,7 @@ body {
30
30
  #modal_content h1 {
31
31
  margin: 0 0 12px 0;
32
32
  padding: 0;
33
- font-weight: normal;
34
- background: #111111;
33
+ font-weight: normal;
35
34
  }
36
35
 
37
36
  #modal_content a {
@@ -41,7 +40,7 @@ body {
41
40
  }
42
41
 
43
42
  #modal_content p.loading {
44
- background-image: url('/assets/caboose/loading_white_on_black.gif');
43
+ background-image: url('/assets/caboose/loading.gif');
45
44
  background-position: 0 center;
46
45
  background-repeat: no-repeat;
47
46
  color: #ccc;
@@ -87,9 +86,9 @@ div.model_attribute_text {
87
86
  input, select, textarea {
88
87
  font-family: "Roboto", Arial;
89
88
  font-weight: 400;
90
- border: 2px solid #ccc;
91
- background: #000;
92
- color: #fff;
89
+ border: 1px solid #ccc;
90
+ background: #fff;
91
+ color: #000;
93
92
  /*
94
93
  -moz-border-radius: 2px;
95
94
  -webkit-border-radius: 2px;
@@ -211,9 +210,9 @@ select.fake option {
211
210
  }
212
211
 
213
212
  #modal_content table.data th {
214
- background: #000;
213
+ background: #666;
215
214
  border: #333 1px solid;
216
- color: #efefef;
215
+ color: #fff;
217
216
  margin: 0;
218
217
  padding: 0;
219
218
  }
@@ -231,8 +230,7 @@ select.fake option {
231
230
  background: #333;
232
231
  }
233
232
 
234
- #modal_content table.data td {
235
- background: #111111;
233
+ #modal_content table.data td {
236
234
  border: #333 1px solid;
237
235
  color: #fff;
238
236
  margin: 0;
@@ -240,7 +238,7 @@ select.fake option {
240
238
  }
241
239
 
242
240
  #modal_content table.data tr:nth-child(even) td {
243
- background-color: #000;
241
+ background-color: #efefef;
244
242
  }
245
243
 
246
244
 
@@ -251,8 +249,8 @@ select.fake option {
251
249
  #modal_content table.data tr:hover td,
252
250
  #modal_content table.data tr:nth-child(even):hover td,
253
251
  #modal_content table.data tr:nth-child(odd):hover td {
254
- background: #333;
255
- color: #fff;
252
+ background: #fff;
253
+ color: #000;
256
254
  }
257
255
 
258
256
  /*******************************************************************************
@@ -260,14 +258,14 @@ Modeljs
260
258
  *******************************************************************************/
261
259
 
262
260
  #modal_content div.model_attribute_text {
263
- color: #fff;
261
+ color: #000;
264
262
  }
265
263
 
266
264
  #modal_content .model_attribute {
267
- background: none repeat scroll 0 0 transparent;
268
- display: block;
269
- padding: 2px 4px;
270
- text-decoration: none;
265
+ background: none repeat scroll 0 0 transparent;
266
+ display: block;
267
+ padding: 2px 4px;
268
+ text-decoration: none;
271
269
  }
272
270
 
273
271
  #modal_content .clear {
@@ -325,7 +323,7 @@ Message boxes
325
323
  #cboxMiddleRight,
326
324
  #cboxTopCenter,
327
325
  #cboxBottomCenter,
328
- #cboxClose { background: #111 !important; }
326
+ #cboxClose { background: #fff !important; }
329
327
 
330
328
  /*******************************************************************************
331
329
  Page Bar Generator
@@ -1,16 +1,7 @@
1
- #cboxLoadedContent { margin-bottom: 0; }
2
-
3
- #cboxTopLeft,
4
- #cboxTopRight,
5
- #cboxBottomLeft,
6
- #cboxBottomRight,
7
- #cboxMiddleLeft,
8
- #cboxMiddleRight,
9
- #cboxTopCenter,
10
- #cboxBottomCenter,
11
- #cboxClose { background: #111; }
12
- #cboxWrapper { border-radius: 7px !important; }
13
-
1
+ /*
2
+ require caboose/spectrum
3
+ */
4
+
14
5
  .mb_container {
15
6
  width: 100%;
16
7
  overflow: hidden;
@@ -1,4 +1,4 @@
1
- /* DEPRECATED
1
+
2
2
  .page_links {
3
3
 
4
4
  }
@@ -32,4 +32,3 @@
32
32
  color: #fff;
33
33
  text-decoration: none;
34
34
  }
35
- */
@@ -1,11 +1,12 @@
1
+
1
2
  module Caboose
2
3
  class AdminController < ApplicationController
3
4
 
4
5
  # @route GET /admin
5
- def index
6
- return if !user_is_allowed_to('view', 'admin')
6
+ def index
7
+ return if !user_is_allowed('admin', 'view')
7
8
  @return_url = params[:return_url].nil? ? '/admin/pages' : params[:return_url]
8
9
  end
9
10
 
10
11
  end
11
- end
12
+ end
@@ -12,7 +12,9 @@ module Caboose
12
12
 
13
13
  # Modify the built-in params array with URL params if necessary
14
14
  parse_url_params if Caboose.use_url_params
15
-
15
+
16
+ # @use_page_cache = !request.fullpath.starts_with?('/admin')
17
+
16
18
  # Get the site we're working with
17
19
  @domain = Domain.where(:domain => request.host_with_port).first
18
20
  @site = @domain ? @domain.site : nil
@@ -24,17 +26,15 @@ module Caboose
24
26
  CabooseMailer.site = @site
25
27
 
26
28
  # Make sure someone is logged in
27
- if !logged_in? && @site
28
- elo_id = cookies[:caboose_elo_id]
29
- if elo_id.blank?
30
- elo_id = User.logged_out_user_id(@site.id)
31
- cookies[:caboose_elo_id] = elo_id # Cache the site's ELO id in browser to prevent multiple lookups
32
- end
33
- elo = User.find(elo_id)
29
+ if !logged_in? && @site
30
+ elo = User.logged_out_user(@site.id)
34
31
  login_user(elo) if elo
35
32
  end
36
33
 
37
- session['use_redirect_urls'] = true if session['use_redirect_urls'].nil?
34
+ session['use_redirect_urls'] = true if session['use_redirect_urls'].nil?
35
+
36
+ # Initialize AB Testing
37
+ AbTesting.init(request.session_options[:id]) if Caboose.use_ab_testing
38
38
 
39
39
  # Try to find the page
40
40
  @request = request
@@ -47,8 +47,13 @@ module Caboose
47
47
  @is_real_page = false
48
48
  @ga_events = []
49
49
 
50
- @page = Page.page_with_uri(request.host_with_port, request.fullpath)
50
+ #if @find_page
51
+ @page = Page.page_with_uri(request.host_with_port, request.fullpath)
52
+ # @crumb_trail = Caboose::Page.crumb_trail(@page)
53
+ #end
54
+
51
55
 
56
+
52
57
  # Sets an instance variable of the logged in user
53
58
  @logged_in_user = logged_in_user
54
59
 
@@ -150,12 +155,7 @@ module Caboose
150
155
  def logged_in?
151
156
  validate_token
152
157
  validate_cookie
153
- elo_id = cookies[:caboose_elo_id]
154
- if elo_id.blank?
155
- elo_id = User.logged_out_user_id(@site.id)
156
- cookies[:caboose_elo_id] = elo_id # Cache the site's ELO id in browser to prevent multiple lookups
157
- end
158
- return true if !session["app_user"].nil? && session["app_user"] != false && session["app_user"].id != -1 && session["app_user"].id.to_s != elo_id.to_s
158
+ return true if !session["app_user"].nil? && session["app_user"] != false && session["app_user"].id != -1 && session["app_user"].id != User.logged_out_user_id(@site.id)
159
159
  return false
160
160
  end
161
161
 
@@ -164,8 +164,10 @@ module Caboose
164
164
  def validate_token
165
165
  token = params[:token]
166
166
  return false if token.nil?
167
+
167
168
  user = User.validate_token(token)
168
169
  return false if user.nil?
170
+
169
171
  login_user(user)
170
172
  return true
171
173
  end
@@ -240,6 +242,7 @@ module Caboose
240
242
  end
241
243
  return false
242
244
  end
245
+
243
246
  @user = logged_in_user
244
247
  unless @user.is_allowed(resource, action)
245
248
  if json
@@ -0,0 +1,65 @@
1
+ module Caboose
2
+ class AssetsController < Caboose::ApplicationController
3
+ layout 'caboose/admin'
4
+
5
+ ## @route GET /admin/assets/ace
6
+ #def admin_ace
7
+ # return if !user_is_allowed('assets', 'edit')
8
+ #end
9
+ #
10
+ ## @route GET /admin/assets
11
+ #def admin_index
12
+ # return if !user_is_allowed('assets', 'edit')
13
+ # config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))[Rails.env]
14
+ # bucket = config['bucket']
15
+ # @assets_path = "http://#{bucket}.s3.amazonaws.com/assets"
16
+ #end
17
+ #
18
+ ## @route GET /admin/assets/manifest
19
+ #def admin_manifest
20
+ # return if !user_is_allowed('assets', 'edit')
21
+ #
22
+ # config = YAML.load(File.read(Rails.root.join('config', 'aws.yml')))[Rails.env]
23
+ # bucket = config['bucket']
24
+ # resp = HTTParty.get("http://#{bucket}.s3.amazonaws.com/assets/manifest.yml")
25
+ # str = resp.body
26
+ # manifest = self.parse_manifest(str, true)
27
+ #
28
+ # render :json => manifest
29
+ #end
30
+ #
31
+ #def parse_manifest(str, exclude_images = true)
32
+ # lines = str.split("\n")
33
+ # h = {}
34
+ # lines.each_with_index do |line, i|
35
+ # next if i == 0
36
+ # path = line.split(": ").first.split('/')
37
+ #
38
+ # if exclude_images
39
+ # ext = line.split('.')
40
+ # next if ext.count > 0 && ['png','jpg','gif','ico'].include?(ext.last.downcase)
41
+ # end
42
+ # self.verify_path_exists(path, h)
43
+ # end
44
+ # return h
45
+ #end
46
+ #
47
+ #def verify_path_exists(path, h, i = 0)
48
+ # return if i >= path.count
49
+ # h[path[i]] = i == (path.count - 1) ? true : {} if h[path[i]].nil?
50
+ # self.verify_path_exists(path, h[path[i]], i+1)
51
+ #end
52
+ #
53
+ ## @route PUT /admin/assets
54
+ #def admin_update
55
+ # return if !user_is_allowed('assets', 'edit')
56
+ #
57
+ # path = params[:path]
58
+ # value = params[:value]
59
+ #
60
+ # resp = AssetManifest.save_asset(path, value)
61
+ # render :json => resp
62
+ #end
63
+
64
+ end
65
+ end
@@ -155,8 +155,7 @@ module Caboose
155
155
 
156
156
  # @route PUT /admin/block-types/:id
157
157
  def admin_update
158
- can_edit = (params[:site_id] && params[:site_id][0] && params[:site_id][0] == @site.id.to_s && logged_in_user.is_allowed('site_settings', 'edit')) || logged_in_user.is_super_admin?
159
- render :json => false and return if !can_edit
158
+ render :json => false and return if !logged_in_user.is_super_admin?
160
159
 
161
160
  resp = StdClass.new({'attributes' => {}})
162
161
  bt = BlockType.find(params[:id])
@@ -187,8 +186,7 @@ module Caboose
187
186
  when 'options_url' then bt.options_url = v
188
187
  when 'default_constrain' then bt.default_constrain = v
189
188
  when 'default_full_width' then bt.default_full_width = v
190
- when 'is_dynamic' then bt.is_dynamic = v
191
- when 'default_included' then bt.default_included = v
189
+ when 'default_included' then bt.default_included = v
192
190
  when 'site_id' then resp.btsm_id = bt.toggle_site(v[0], v[1])
193
191
  end
194
192
  end
@@ -295,7 +293,7 @@ module Caboose
295
293
 
296
294
  # @route GET /admin/block-type-site-memberships/:id/html
297
295
  def admin_edit_btsm_html
298
- redirect_to '/admin' and return if !logged_in_user.is_allowed('site_settings', 'edit')
296
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
299
297
  @btsm = BlockTypeSiteMembership.find(params[:id])
300
298
  if (@site.id != @btsm.site_id && !@site.is_master)
301
299
  @error = "You are not allowed to edit this site."
@@ -306,7 +304,7 @@ module Caboose
306
304
 
307
305
  # @route PUT /admin/block-type-site-memberships/:id/html
308
306
  def admin_update_btsm_html
309
- render :json => false and return if !logged_in_user.is_allowed('site_settings', 'edit')
307
+ render :json => false and return if !logged_in_user.is_super_admin?
310
308
  resp = StdClass.new
311
309
  @btsm = BlockTypeSiteMembership.find(params[:id])
312
310
  code = params['code'].blank? ? '' : params['code'].gsub('<%==','<%= raw')
@@ -319,7 +317,7 @@ module Caboose
319
317
 
320
318
  # @route GET /admin/block-type-site-memberships/:id/css
321
319
  def admin_edit_btsm_css
322
- redirect_to '/admin' and return if !logged_in_user.is_allowed('site_settings', 'edit')
320
+ redirect_to '/admin' and return if !logged_in_user.is_super_admin?
323
321
  @btsm = BlockTypeSiteMembership.find(params[:id])
324
322
  if (@site.id != @btsm.site_id && !@site.is_master)
325
323
  @error = "You are not allowed to edit this site."
@@ -330,7 +328,7 @@ module Caboose
330
328
 
331
329
  # @route PUT /admin/block-type-site-memberships/:id/css
332
330
  def admin_update_btsm_css
333
- render :json => false and return if !logged_in_user.is_allowed('site_settings', 'edit')
331
+ render :json => false and return if !logged_in_user.is_super_admin?
334
332
  resp = StdClass.new
335
333
  @btsm = BlockTypeSiteMembership.find(params[:id])
336
334
  @btsm.custom_css = params['code']