spontaneous 0.2.0.alpha2 → 0.2.0.alpha3

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.
Files changed (404) hide show
  1. data/Gemfile +3 -40
  2. data/Rakefile +29 -41
  3. data/Readme.markdown +21 -8
  4. data/application/css/add_alias_dialogue.css.scss +79 -0
  5. data/application/css/{v2.scss → core.css.scss} +537 -550
  6. data/application/css/{definitions.scss → definitions.css.scss} +121 -33
  7. data/application/css/dialogue.css.scss +409 -0
  8. data/application/css/{editing.scss → editing.css.scss} +25 -262
  9. data/application/css/font.css.scss +8 -0
  10. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  11. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  12. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_flat_10_000000_40x100.png +0 -0
  13. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  14. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  15. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  16. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  17. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  18. data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  19. data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_222222_256x240.png +0 -0
  20. data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_228ef1_256x240.png +0 -0
  21. data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ef8c08_256x240.png +0 -0
  22. data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffd27a_256x240.png +0 -0
  23. data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffffff_256x240.png +0 -0
  24. data/application/css/jquery-ui-1.8.21.custom/ui-lightness.css.scss +565 -0
  25. data/application/css/{login.scss → login.css.scss} +4 -4
  26. data/application/css/meta.css.scss +331 -0
  27. data/application/css/{popover.scss → popover.css.scss} +9 -8
  28. data/application/css/{schema_error.scss → schema_error.css.scss} +4 -4
  29. data/application/css/spontaneous.css +5 -0
  30. data/application/css/unsupported.css.scss +42 -0
  31. data/application/js/add_alias_dialogue.js +72 -10
  32. data/application/js/ajax.js +50 -16
  33. data/application/js/compatibility.js +19 -15
  34. data/application/js/content.js +39 -36
  35. data/application/js/content_area.js +53 -5
  36. data/application/js/dialogue.js +17 -0
  37. data/application/js/dom.js +1 -1
  38. data/application/js/edit_panel.js +23 -8
  39. data/application/js/extensions.js +7 -2
  40. data/application/js/field_preview.js +2 -1
  41. data/application/js/field_types/date_field.js +11 -8
  42. data/application/js/field_types/file_field.js +188 -9
  43. data/application/js/field_types/image_field.js +46 -29
  44. data/application/js/field_types/markdown_field.js +57 -14
  45. data/application/js/field_types/select_field.js +72 -0
  46. data/application/js/field_types/string_field.js +8 -0
  47. data/application/js/field_types/webvideo_field.js +8 -0
  48. data/application/js/init.js +1 -7
  49. data/application/js/location.js +41 -13
  50. data/application/js/login.js +3 -0
  51. data/application/js/meta_view/user_admin.js +543 -0
  52. data/application/js/meta_view.js +1 -0
  53. data/application/js/metadata.js +20 -0
  54. data/application/js/page.js +17 -3
  55. data/application/js/page_browser.js +40 -30
  56. data/application/js/page_entry.js +4 -0
  57. data/application/js/panel/root_menu.js +66 -0
  58. data/application/js/popover.js +2 -2
  59. data/application/js/preview.js +1 -1
  60. data/application/js/publish.js +138 -30
  61. data/application/js/services.js +43 -0
  62. data/application/js/sharded_upload.js +2 -2
  63. data/application/js/spontaneous.js +64 -5
  64. data/application/js/state.js +20 -9
  65. data/application/js/top_bar.js +273 -150
  66. data/application/js/types.js +20 -15
  67. data/application/js/upload.js +1 -2
  68. data/application/js/user.js +18 -4
  69. data/application/js/vendor/date.js +104 -0
  70. data/application/js/vendor/jquery-ui-1.8.18.custom.min.js +356 -0
  71. data/application/js/views/box_view.js +15 -8
  72. data/application/js/views/page_piece_view.js +11 -8
  73. data/application/js/views/page_view.js +21 -3
  74. data/application/js/views/piece_view.js +19 -10
  75. data/application/js/views.js +3 -0
  76. data/application/static/chromelogo-200x52-45c7cbc93be080bea342df5fcda2ef8b.png +0 -0
  77. data/application/static/dot-texture-9eea29e4ac7ad9a772285252078ec127.png +0 -0
  78. data/application/static/editing-textarea-resize-s-b5af62365eb7e19ea4beccf7242d508e.png +0 -0
  79. data/application/static/editing-texture-1-42b06a3439752490988f30f2a06d5e7c.png +0 -0
  80. data/application/static/font/fontawesome-webfont-5c5c21100a346972a82c34c5e96ffcfe.ttf +0 -0
  81. data/application/static/loop_alt1-white-7894b458528e92216196cae26b4c2c96.svg +12 -0
  82. data/application/static/spontaneous-states-e91ec89db525c62da0105b97cdd781ce.png +0 -0
  83. data/application/views/index.erb +2 -2
  84. data/application/views/login.erb +4 -8
  85. data/application/views/schema_modification_error.html.erb +1 -4
  86. data/application/views/unsupported.erb +9 -7
  87. data/bin/spot +1 -1
  88. data/db/migrations/20110209152710_users_and_groups.rb +10 -10
  89. data/db/migrations/20120305112647_site_modification_time.rb +11 -0
  90. data/db/migrations/20120418153903_add_ownership_of_content.rb +14 -0
  91. data/db/migrations/20120423175416_add_pending_modifications.rb +21 -0
  92. data/db/migrations/20120525164947_add_field_versions.rb +27 -0
  93. data/lib/sequel/plugins/scoped_table_name.rb +10 -1
  94. data/lib/spontaneous/asset/file.rb +25 -0
  95. data/lib/spontaneous/asset/source.rb +28 -0
  96. data/lib/spontaneous/asset.rb +75 -0
  97. data/lib/spontaneous/box.rb +6 -4
  98. data/lib/spontaneous/capistrano/deploy.rb +47 -0
  99. data/lib/spontaneous/capistrano/sync.rb +81 -0
  100. data/lib/spontaneous/capistrano.rb +13 -0
  101. data/lib/spontaneous/change.rb +60 -68
  102. data/lib/spontaneous/cli/assets.rb +29 -0
  103. data/lib/spontaneous/cli/base.rb +0 -48
  104. data/lib/spontaneous/cli/console.rb +1 -1
  105. data/lib/spontaneous/cli/server.rb +6 -4
  106. data/lib/spontaneous/cli/site.rb +28 -17
  107. data/lib/spontaneous/cli/user.rb +107 -0
  108. data/lib/spontaneous/cli.rb +100 -4
  109. data/lib/spontaneous/collections/entry_set.rb +2 -2
  110. data/lib/spontaneous/collections/field_set.rb +48 -22
  111. data/lib/spontaneous/collections/prototype_set.rb +20 -13
  112. data/lib/spontaneous/constants.rb +3 -0
  113. data/lib/spontaneous/content.rb +22 -5
  114. data/lib/spontaneous/errors.rb +3 -3
  115. data/lib/spontaneous/extensions/array.rb +12 -0
  116. data/lib/spontaneous/extensions/enumerable.rb +30 -0
  117. data/lib/spontaneous/extensions/nil.rb +3 -1
  118. data/lib/spontaneous/extensions/string.rb +16 -0
  119. data/lib/spontaneous/field_types/date_field.rb +45 -2
  120. data/lib/spontaneous/field_types/field.rb +42 -9
  121. data/lib/spontaneous/field_types/file_field.rb +68 -0
  122. data/lib/spontaneous/field_types/image_field.rb +63 -0
  123. data/lib/spontaneous/field_types/select_field.rb +109 -0
  124. data/lib/spontaneous/field_types/string_field.rb +6 -1
  125. data/lib/spontaneous/field_types/webvideo_field.rb +85 -27
  126. data/lib/spontaneous/field_types.rb +1 -1
  127. data/lib/spontaneous/field_version.rb +8 -0
  128. data/lib/spontaneous/generators/page.rb +1 -1
  129. data/lib/spontaneous/generators/site/Capfile.tt +1 -4
  130. data/lib/spontaneous/generators/site/Gemfile.tt +13 -6
  131. data/lib/spontaneous/generators/site/config/deploy.rb.tt +28 -0
  132. data/lib/spontaneous/generators/site/config/environments/production.rb.tt +7 -2
  133. data/lib/spontaneous/generators/site.rb +1 -0
  134. data/lib/spontaneous/json.rb +34 -11
  135. data/lib/spontaneous/layout.rb +22 -0
  136. data/lib/spontaneous/media/file.rb +4 -0
  137. data/lib/spontaneous/output/assets/compression.rb +58 -0
  138. data/lib/spontaneous/output/assets.rb +32 -0
  139. data/lib/spontaneous/output/context.rb +179 -0
  140. data/lib/spontaneous/output/format/html.rb +5 -0
  141. data/lib/spontaneous/output/format/plain.rb +5 -0
  142. data/lib/spontaneous/output/format.rb +180 -0
  143. data/lib/spontaneous/output/helpers/classes_helper.rb +18 -0
  144. data/lib/spontaneous/{render/helpers/html_helper.rb → output/helpers/conditional_comment_helper.rb} +3 -12
  145. data/lib/spontaneous/output/helpers/script_helper.rb +73 -0
  146. data/lib/spontaneous/output/helpers/stylesheet_helper.rb +61 -0
  147. data/lib/spontaneous/output/helpers.rb +28 -0
  148. data/lib/spontaneous/output/template/engine.rb +59 -0
  149. data/lib/spontaneous/output/template/renderer.rb +153 -0
  150. data/lib/spontaneous/output/template.rb +21 -0
  151. data/lib/spontaneous/output.rb +163 -0
  152. data/lib/spontaneous/page.rb +2 -1
  153. data/lib/spontaneous/paths.rb +6 -1
  154. data/lib/spontaneous/permissions/access_key.rb +5 -5
  155. data/lib/spontaneous/permissions/user.rb +81 -35
  156. data/lib/spontaneous/permissions/user_level.rb +26 -22
  157. data/lib/spontaneous/plugins/aliases.rb +76 -12
  158. data/lib/spontaneous/plugins/allowed_types.rb +60 -18
  159. data/lib/spontaneous/plugins/application/paths.rb +0 -28
  160. data/lib/spontaneous/plugins/application/system.rb +35 -0
  161. data/lib/spontaneous/plugins/boxes.rb +4 -0
  162. data/lib/spontaneous/plugins/content_groups.rb +16 -0
  163. data/lib/spontaneous/plugins/entries.rb +50 -30
  164. data/lib/spontaneous/plugins/fields.rb +15 -0
  165. data/lib/spontaneous/plugins/layouts.rb +8 -2
  166. data/lib/spontaneous/plugins/modifications.rb +228 -0
  167. data/lib/spontaneous/plugins/page/formats.rb +67 -42
  168. data/lib/spontaneous/plugins/page/request.rb +10 -0
  169. data/lib/spontaneous/plugins/page/site_timestamps.rb +28 -0
  170. data/lib/spontaneous/plugins/paths.rb +15 -3
  171. data/lib/spontaneous/plugins/publishing.rb +124 -45
  172. data/lib/spontaneous/plugins/render.rb +13 -8
  173. data/lib/spontaneous/plugins/schema_hierarchy.rb +18 -6
  174. data/lib/spontaneous/plugins/site/helpers.rb +53 -0
  175. data/lib/spontaneous/plugins/site/hooks.rb +50 -0
  176. data/lib/spontaneous/plugins/site/map.rb +1 -1
  177. data/lib/spontaneous/plugins/site/paths.rb +13 -0
  178. data/lib/spontaneous/plugins/site/publishing.rb +6 -2
  179. data/lib/spontaneous/plugins/site/{revisions.rb → state.rb} +5 -1
  180. data/lib/spontaneous/plugins/site/storage.rb +4 -0
  181. data/lib/spontaneous/plugins/site/url.rb +15 -0
  182. data/lib/spontaneous/plugins/site_map.rb +13 -3
  183. data/lib/spontaneous/plugins/styles.rb +5 -1
  184. data/lib/spontaneous/plugins/visibility.rb +39 -12
  185. data/lib/spontaneous/prototypes/box_prototype.rb +4 -0
  186. data/lib/spontaneous/prototypes/field_prototype.rb +15 -10
  187. data/lib/spontaneous/publishing/event_client.rb +46 -0
  188. data/lib/spontaneous/publishing/immediate.rb +81 -44
  189. data/lib/spontaneous/publishing/simultaneous.rb +23 -6
  190. data/lib/spontaneous/publishing.rb +4 -3
  191. data/lib/spontaneous/rack/around_back.rb +1 -5
  192. data/lib/spontaneous/rack/around_front.rb +4 -4
  193. data/lib/spontaneous/rack/around_preview.rb +4 -3
  194. data/lib/spontaneous/rack/assets.rb +81 -54
  195. data/lib/spontaneous/rack/authentication.rb +0 -1
  196. data/lib/spontaneous/rack/back.rb +160 -72
  197. data/lib/spontaneous/rack/cookie_authentication.rb +2 -2
  198. data/lib/spontaneous/rack/css.rb +18 -15
  199. data/lib/spontaneous/rack/event_source.rb +9 -21
  200. data/lib/spontaneous/rack/fiber_pool.rb +26 -0
  201. data/lib/spontaneous/rack/front.rb +12 -4
  202. data/lib/spontaneous/rack/helpers.rb +35 -13
  203. data/lib/spontaneous/rack/js.rb +41 -0
  204. data/lib/spontaneous/rack/public.rb +34 -44
  205. data/lib/spontaneous/rack/sse.rb +18 -0
  206. data/lib/spontaneous/rack/static.rb +3 -0
  207. data/lib/spontaneous/rack/user_admin.rb +100 -0
  208. data/lib/spontaneous/rack/user_helpers.rb +1 -1
  209. data/lib/spontaneous/rack.rb +6 -2
  210. data/lib/spontaneous/schema.rb +31 -4
  211. data/lib/spontaneous/search/index.rb +19 -3
  212. data/lib/spontaneous/search/results.rb +1 -1
  213. data/lib/spontaneous/sequel.rb +17 -0
  214. data/lib/spontaneous/site.rb +11 -4
  215. data/lib/spontaneous/state.rb +11 -0
  216. data/lib/spontaneous/storage/cloud.rb +4 -0
  217. data/lib/spontaneous/storage/local.rb +11 -0
  218. data/lib/spontaneous/style.rb +2 -2
  219. data/lib/spontaneous/tasks/database.rake +21 -22
  220. data/lib/spontaneous/utils/database/mysql_dumper.rb +4 -0
  221. data/lib/spontaneous/utils/database/postgres_dumper.rb +78 -0
  222. data/lib/spontaneous/utils/database.rb +6 -3
  223. data/lib/spontaneous/utils/smart_quotes.rb +499 -0
  224. data/lib/spontaneous/utils/smush_it.rb +66 -0
  225. data/lib/spontaneous/utils.rb +3 -1
  226. data/lib/spontaneous/version.rb +2 -2
  227. data/lib/spontaneous.rb +25 -29
  228. data/spontaneous.gemspec +186 -106
  229. data/test/experimental/test_features.rb +1 -1
  230. data/test/fixtures/asset_pipeline/application/css/basic.css.scss +4 -0
  231. data/test/fixtures/asset_pipeline/application/css/complex.css.scss.erb +6 -0
  232. data/test/fixtures/asset_pipeline/application/css/simple.css +3 -0
  233. data/test/fixtures/asset_pipeline/application/css/spontaneous.css +7 -0
  234. data/test/fixtures/asset_pipeline/application/css/subdir/complex.css.scss.erb +6 -0
  235. data/test/fixtures/asset_pipeline/application/css/subdir/library.css.scss +1 -0
  236. data/test/fixtures/asset_pipeline/application/css/subdir/simple.css +3 -0
  237. data/test/fixtures/asset_pipeline/application/js/basic.js.coffee +1 -0
  238. data/test/fixtures/asset_pipeline/application/js/complex.js.coffee.erb +1 -0
  239. data/test/fixtures/asset_pipeline/application/js/login.js +1 -0
  240. data/test/fixtures/asset_pipeline/application/js/require.js +1 -0
  241. data/test/fixtures/asset_pipeline/application/js/simple.js +1 -0
  242. data/test/fixtures/asset_pipeline/application/js/spontaneous.js +5 -0
  243. data/test/fixtures/asset_pipeline/application/js/subdir/complex.js.coffee.erb +1 -0
  244. data/test/fixtures/asset_pipeline/application/js/subdir/library.js.coffee +1 -0
  245. data/test/fixtures/asset_pipeline/application/js/subdir/simple.js +1 -0
  246. data/test/fixtures/asset_pipeline/application/js/vendor/jquery.js +1 -0
  247. data/test/fixtures/asset_pipeline/application/static/dot-texture.png +0 -0
  248. data/test/fixtures/asset_pipeline/application/static/subdir/px.gif +0 -0
  249. data/test/fixtures/assets/public1/css/a.scss +1 -0
  250. data/test/fixtures/assets/public1/js/a.js +1 -0
  251. data/test/fixtures/assets/public1/js/m.coffee +1 -0
  252. data/test/fixtures/assets/public2/css/b.scss +1 -0
  253. data/test/fixtures/assets/public2/css/c.css +1 -0
  254. data/test/fixtures/assets/public2/js/b.js +1 -0
  255. data/test/fixtures/assets/public2/js/c.js +1 -0
  256. data/test/fixtures/assets/public2/js/n.coffee +1 -0
  257. data/test/fixtures/back/config/user_levels.yml +3 -0
  258. data/test/fixtures/back/public/js/coffeescript.coffee +1 -0
  259. data/test/fixtures/back/templates/layouts/standard.css.cut +1 -0
  260. data/test/fixtures/back/templates/layouts/standard.js.cut +1 -0
  261. data/test/fixtures/example_application/config/database.yml +4 -4
  262. data/test/fixtures/helpers/templates/layouts/standard.html.cut +1 -0
  263. data/test/fixtures/helpers/templates/layouts/standard.mobile.cut +1 -0
  264. data/test/fixtures/images/vimlogo.pdf +0 -0
  265. data/test/fixtures/outputs/templates/layouts/standard.atom.cut +1 -0
  266. data/test/fixtures/permissions/config/user_levels.yml +6 -3
  267. data/test/fixtures/serialisation/class_hash.yaml.erb +1 -0
  268. data/test/fixtures/serialisation/root_hash.yaml.erb +2 -2
  269. data/test/fixtures/templates/extended/grandparent.html.cut +7 -7
  270. data/test/fixtures/templates/extended/main.html.cut +5 -5
  271. data/test/fixtures/templates/extended/parent.html.cut +8 -8
  272. data/test/fixtures/templates/extended/partial_with_locals.html.cut +1 -1
  273. data/test/fixtures/templates/extended/with_includes.html.cut +6 -6
  274. data/test/fixtures/templates/extended/with_includes_and_locals.html.cut +6 -7
  275. data/test/fixtures/templates/layouts/entries.html.cut +4 -4
  276. data/test/fixtures/templates/layouts/standard.html.cut +1 -0
  277. data/test/fixtures/templates/layouts/variables.html.cut +1 -1
  278. data/test/fixtures/templates/publishing/templates/layouts/static.html.cut +1 -1
  279. data/test/fixtures/templates/publishing/templates/layouts/static.rtf.cut +1 -0
  280. data/test/fixtures/templates/template_class/complex_template.html.cut +2 -2
  281. data/test/fixtures/templates/template_class/complex_template.pdf.cut +2 -2
  282. data/test/fixtures/templates/template_class/default_template_style.html.cut +1 -1
  283. data/test/fixtures/templates/template_class/images_with_template.html.cut +2 -2
  284. data/test/fixtures/templates/template_class/slots_template.html.cut +2 -2
  285. data/test/fixtures/templates/template_class/slots_template.pdf.cut +2 -2
  286. data/test/fixtures/user_manager/config/user_levels.yml +9 -0
  287. data/test/functional/test_application.rb +7 -7
  288. data/test/functional/test_back.rb +352 -97
  289. data/test/functional/test_front.rb +71 -20
  290. data/test/functional/test_user_manager.rb +284 -0
  291. data/test/javascript/env.js +13505 -0
  292. data/test/javascript/test_markdown.rb +43 -3
  293. data/test/support/custom_matchers.rb +3 -2
  294. data/test/test_helper.rb +50 -9
  295. data/test/test_javascript.rb +13 -13
  296. data/test/ui_helper.rb +1 -1
  297. data/test/unit/test_alias.rb +79 -8
  298. data/test/unit/test_asset_bundler.rb +220 -0
  299. data/test/unit/test_assets.rb +213 -0
  300. data/test/unit/test_async.rb +55 -0
  301. data/test/unit/test_authentication.rb +52 -39
  302. data/test/unit/test_boxes.rb +20 -15
  303. data/test/unit/test_changesets.rb +261 -0
  304. data/test/unit/test_content.rb +73 -33
  305. data/test/unit/test_content_inheritance.rb +18 -18
  306. data/test/unit/test_extensions.rb +26 -0
  307. data/test/unit/test_fields.rb +303 -16
  308. data/test/unit/test_formats.rb +267 -34
  309. data/test/unit/test_helpers.rb +79 -2
  310. data/test/unit/test_images.rb +10 -0
  311. data/test/unit/test_layouts.rb +21 -13
  312. data/test/unit/test_modifications.rb +648 -0
  313. data/test/unit/test_page.rb +6 -2
  314. data/test/unit/test_permissions.rb +101 -27
  315. data/test/unit/test_piece.rb +4 -4
  316. data/test/unit/test_plugins.rb +3 -2
  317. data/test/unit/test_publishing.rb +332 -0
  318. data/test/unit/test_render.rb +118 -67
  319. data/test/unit/test_revisions.rb +546 -0
  320. data/test/unit/test_schema.rb +83 -1
  321. data/test/unit/test_search.rb +59 -0
  322. data/test/unit/test_serialisation.rb +2 -47
  323. data/test/unit/test_site.rb +217 -108
  324. data/test/unit/test_storage.rb +26 -0
  325. data/test/unit/test_structure.rb +2 -2
  326. data/test/unit/test_styles.rb +90 -75
  327. data/test/unit/test_table_scoping.rb +21 -17
  328. data/test/unit/test_templates.rb +75 -69
  329. data/test/{slow → unit}/test_visibility.rb +78 -22
  330. metadata +528 -221
  331. data/application/css/add_alias_dialogue.scss +0 -27
  332. data/application/css/min/14c2a35812c443001b15d8b12a4780f88c678035.css +0 -1
  333. data/application/css/min/565d4c25e82148acb01c45c8d675b37a08676d77.css +0 -1
  334. data/application/css/min/84dbe894ea96eafd321c30823d630817bfc4b03b.css +0 -1
  335. data/application/css/spontaneous.scss +0 -111
  336. data/application/css/unsupported.scss +0 -16
  337. data/application/css/variables.scss +0 -80
  338. data/application/js/min/2a0c2962537a3181fedfff5c92596ba6d3122dc9.js +0 -3
  339. data/application/js/min/4cf1c493d3379ecba5287758c61238034c0893f9.js +0 -2
  340. data/application/js/min/78ac6b99d96750bb6b9f9aad4cb9cd91cd03f391.js +0 -3
  341. data/application/js/min/b8abf302a824c35385ff517b34111e1710ff3b37.js +0 -2
  342. data/application/js/min/c8efb9b9f7c3f6613fcebc6be60f605b6570a382.js +0 -90
  343. data/application/static/diagonal-texture.png +0 -0
  344. data/application/static/editing-0-noise.png +0 -0
  345. data/application/static/editing-1-noise.png +0 -0
  346. data/application/static/editing-texture-1.png +0 -0
  347. data/application/static/editing-texture.png +0 -0
  348. data/application/static/editing-toolbar-shadow-bottom.png +0 -0
  349. data/application/static/editing-toolbar-shadow-top.png +0 -0
  350. data/application/static/inner-glow.png +0 -0
  351. data/application/static/item-buttons-highlight.png +0 -0
  352. data/application/static/item-buttons.png +0 -0
  353. data/application/static/paper-texture-dark.png +0 -0
  354. data/application/static/plus_alt.svg +0 -8
  355. data/application/static/select-arrow-root.png +0 -0
  356. data/application/static/slot-up-arrow.png +0 -0
  357. data/application/static/spontaneous.png +0 -0
  358. data/lib/cutaneous/context_helper.rb +0 -187
  359. data/lib/cutaneous/preview_context.rb +0 -32
  360. data/lib/cutaneous/preview_renderer.rb +0 -10
  361. data/lib/cutaneous/publish_context.rb +0 -10
  362. data/lib/cutaneous/publish_renderer.rb +0 -14
  363. data/lib/cutaneous/publish_template.rb +0 -62
  364. data/lib/cutaneous/publish_token_parser.rb +0 -8
  365. data/lib/cutaneous/renderer.rb +0 -124
  366. data/lib/cutaneous/request_context.rb +0 -9
  367. data/lib/cutaneous/request_renderer.rb +0 -15
  368. data/lib/cutaneous/request_template.rb +0 -11
  369. data/lib/cutaneous/request_token_parser.rb +0 -9
  370. data/lib/cutaneous/token_parser.rb +0 -125
  371. data/lib/cutaneous.rb +0 -48
  372. data/lib/spontaneous/render/context_base.rb +0 -143
  373. data/lib/spontaneous/render/development_renderer.rb +0 -14
  374. data/lib/spontaneous/render/engine.rb +0 -19
  375. data/lib/spontaneous/render/format/html.rb +0 -5
  376. data/lib/spontaneous/render/format.rb +0 -75
  377. data/lib/spontaneous/render/helpers/script_helper.rb +0 -17
  378. data/lib/spontaneous/render/helpers/stylesheet_helper.rb +0 -16
  379. data/lib/spontaneous/render/helpers.rb +0 -14
  380. data/lib/spontaneous/render/preview_context.rb +0 -8
  381. data/lib/spontaneous/render/preview_renderer.rb +0 -24
  382. data/lib/spontaneous/render/publish_context.rb +0 -22
  383. data/lib/spontaneous/render/published_renderer.rb +0 -53
  384. data/lib/spontaneous/render/publishing_renderer.rb +0 -16
  385. data/lib/spontaneous/render/render_cache.rb +0 -26
  386. data/lib/spontaneous/render/renderer.rb +0 -50
  387. data/lib/spontaneous/render/request_context.rb +0 -8
  388. data/lib/spontaneous/render.rb +0 -214
  389. data/test/experimental/test_cutaneous.rb +0 -309
  390. data/test/fixtures/application/css/test.less +0 -5
  391. data/test/slow/test_publishing.rb +0 -1006
  392. /data/application/css/{developer.scss → developer.css.scss} +0 -0
  393. /data/application/js/vendor/{jquery-1.7.1.min.js → jquery.js} +0 -0
  394. /data/application/static/{location-arrow.png → location-arrow-c1c1d3ca472481c61a0a5f8cb289d743.png} +0 -0
  395. /data/application/static/{missing.png → missing-911ce6dbd9f4602e0f3fbcd7e78846a2.png} +0 -0
  396. /data/application/static/{orange-down-arrow.png → orange-down-arrow-395ae1929e8662b2ff0977daf12c35bb.png} +0 -0
  397. /data/application/static/{page-browser-next.png → page-browser-next-ce781a242c23b980b99b9db7abc20b05.png} +0 -0
  398. /data/application/static/{plus-box.png → plus-box-dcde74a1e496f68298c9b443caa1c5d5.png} +0 -0
  399. /data/application/static/{select-arrow.png → select-arrow-6e7dd3745b00e934b0d7a3250c46558b.png} +0 -0
  400. /data/application/static/{slot-down-arrow.png → slot-down-arrow-59ad5f5ee5b52a7ebd00bca4b3104194.png} +0 -0
  401. /data/application/static/{splash.png → splash-65b493a714df9b8b3ab170103401b53d.png} +0 -0
  402. /data/application/static/{spot.png → spot-71fab1d2f065034f5fc15e7bea2ad36c.png} +0 -0
  403. /data/application/static/{spot.svg → spot-8505041082d8d3bbe8d34c29dddb3b7d.svg} +0 -0
  404. /data/application/static/{texture.png → texture-03f7627e8264b1d607113ab32c593a58.png} +0 -0
@@ -105,10 +105,11 @@ Spontaneous.Views.BoxView = (function($, S) {
105
105
  }
106
106
  },
107
107
  add_allowed_types_bar: function(position, insert_at) {
108
- var allowed = this.box.allowed_types()
109
- // var allowed_bar = $(dom.div, {'class':'slot-addable'});
110
- , _box = this
108
+ var allowed = this.box.allowed_types();
109
+ if (allowed.length === 0) { return ""; }
110
+ var _box = this
111
111
  , allowed_bar = dom.div('.slot-addable')
112
+ , inner = dom.div(".addable-inner")
112
113
  , dropper = allowed_bar
113
114
  , drop = function(event) {
114
115
  dropper.removeClass('drop-active').addClass('uploading');
@@ -128,7 +129,6 @@ Spontaneous.Views.BoxView = (function($, S) {
128
129
 
129
130
  , drag_enter = function(event) {
130
131
  // var files = event.originalEvent.dataTransfer.files;
131
- // console.log(event.originalEvent.dataTransfer, files)
132
132
  $(this).addClass('drop-active');
133
133
  event.stopPropagation();
134
134
  event.preventDefault();
@@ -166,9 +166,10 @@ Spontaneous.Views.BoxView = (function($, S) {
166
166
  }.bind(_box, type);
167
167
  }
168
168
  a.click(add_allowed);
169
- allowed_bar.append(a)
169
+ inner.append(a)
170
170
  });
171
- allowed_bar.append(dom.span('.down'));
171
+ allowed_bar.data("allowed-count", allowed.length);
172
+ allowed_bar.append(inner, dom.span('.down'));
172
173
 
173
174
  return allowed_bar;
174
175
  },
@@ -296,11 +297,17 @@ Spontaneous.Views.BoxView = (function($, S) {
296
297
  }
297
298
  }
298
299
  bar = this.add_allowed_types_bar('floating', position + 1);
299
- entry_spacer.addClass('add-entry').append(bar.show());
300
+ if (bar && bar.data("allowed-count") > 0) {
301
+ entry_spacer.addClass('add-entry').append(bar.show());
302
+ if (!entry_spacer.data("auto-height")) {
303
+ entry_spacer.data("auto-height", entry_spacer.height());
304
+ }
305
+ entry_spacer.animate({height:bar.find('.addable-inner').outerHeight() + 12}, 200)
306
+ }
300
307
  },
301
308
  hide_add_after: function(entry, entry_spacer) {
302
309
  entry_spacer.empty();
303
- entry_spacer.removeClass('add-entry');
310
+ entry_spacer.removeClass('add-entry').animate({height: entry_spacer.data("auto-height")}, 200);
304
311
  }
305
312
  });
306
313
 
@@ -1,6 +1,7 @@
1
1
  // console.log('Loading PageEntry...')
2
2
 
3
3
  Spontaneous.Views.PagePieceView = (function($, S) {
4
+ "use strict";
4
5
  var dom = S.Dom;
5
6
 
6
7
  var PagePieceView = new JS.Class(Spontaneous.Views.PieceView, {
@@ -11,7 +12,7 @@ Spontaneous.Views.PagePieceView = (function($, S) {
11
12
  var inside = dom.div('.entry-inner');
12
13
  var outline = dom.div('.white-bg').mouseover(this.mouseover.bind(this)).mouseout(this.mouseout.bind(this)).click(this.edit.bind(this))
13
14
  inside.append(outline)
14
- contents.append(this.title_bar(contents));
15
+ contents.append(this.action_buttons(contents));
15
16
  if (this.content.type().is_alias()) {
16
17
  contents.append(this.alias_target_panel());
17
18
  }
@@ -31,13 +32,15 @@ Spontaneous.Views.PagePieceView = (function($, S) {
31
32
  return wrapper;
32
33
  },
33
34
  page_title_panel: function() {
34
- var wrapper = dom.div('.page-title'),
35
- __content = this,
36
- title = dom.a().html(this.content.title()).click(function() {
37
- S.Location.load_id(__content.id());
38
- });
39
- this.content.title_field().watch('value', function(t) { title.text(t); }.bind(this));
40
- wrapper.append(title);
35
+ var wrapper = dom.div('.page-title').click(function() {
36
+ S.Location.load_id(self.id());
37
+ }),
38
+ self = this,
39
+ content = self.content,
40
+ title = dom.a().html(this.content.title()),
41
+ type = dom.span(".content-type").text(content.type().display_title(content));
42
+ this.content.title_field().watch('value', function(t) { title.html(t); }.bind(this));
43
+ wrapper.append(title, type);
41
44
  return wrapper;
42
45
  }
43
46
  });
@@ -8,6 +8,7 @@ Spontaneous.Views.PageView = (function($, S) {
8
8
  };
9
9
  FunctionBar.prototype = {
10
10
  panel: function() {
11
+ var self = this;
11
12
  this.panel = dom.div('#page-info');
12
13
  this.title = $('<h1/>');
13
14
  this.set_title();
@@ -23,8 +24,16 @@ Spontaneous.Views.PageView = (function($, S) {
23
24
  this.open_url_editor();
24
25
  }
25
26
  }.bind(this));
27
+
26
28
  path_wrap.append(path_text);
27
29
 
30
+ if (!self.page.is_root()) {
31
+ var resync = dom.a({ "title":"Sync the path to the page title"}).click(function() {
32
+ Spontaneous.Ajax.post(['/slug', self.page.id(), "titlesync"].join("/"), {}, self.save_complete.bind(self));
33
+ });
34
+ path_wrap.append( dom.h3('.titlesync').append(resync));
35
+ }
36
+
28
37
 
29
38
  if (user.is_developer()) {
30
39
  var uid_text = dom.h3('.developer.uid' + (!this.page.content.uid ? '.missing' : '')).text('#' + (this.page.content.uid || "----")).click(function() {
@@ -111,6 +120,7 @@ Spontaneous.Views.PageView = (function($, S) {
111
120
  },
112
121
  open_url_editor: function() {
113
122
  this.unavailable = false;
123
+ this.url_editor_open = true;
114
124
  Spontaneous.Ajax.get(['/slug', this.page.id(), 'unavailable'].join('/'), this.unavailable_loaded.bind(this));
115
125
  this.panel.animate({'height': '+=14'}, 200, function() {
116
126
  var view = $('h3', this.panel), edit = $('.edit', this.panel);
@@ -196,8 +206,9 @@ Spontaneous.Views.PageView = (function($, S) {
196
206
  this.input.addClass('error');
197
207
  },
198
208
  hide_path_error: function(error_text) {
199
- this.error.fadeOut(100);
200
- if (this.input.hasClass('error')) { this.input.removeClass('error'); }
209
+ if (this.error) { this.error.fadeOut(100); }
210
+
211
+ if (this.input && this.input.hasClass('error')) { this.input.removeClass('error'); }
201
212
  },
202
213
  save: function(slug) {
203
214
  Spontaneous.Ajax.post('/slug/'+this.page.id(), {'slug':slug}, this.save_complete.bind(this));
@@ -205,11 +216,14 @@ Spontaneous.Views.PageView = (function($, S) {
205
216
 
206
217
  save_complete: function(response, status, xhr) {
207
218
  if (status === 'success') {
219
+ if (this.url_editor_open) {
220
+
208
221
  this.hide_path_error();
209
222
  var view = $('h3.path', this.panel), edit = $('.edit', this.panel);
223
+ this.close();
224
+ }
210
225
  this.page.set('path', response.path);
211
226
  this.page.set('slug', response.slug);
212
- this.close();
213
227
  // HACK: see preview.js (Preview.display)
214
228
  Spontaneous.Location.set('path', this.page.get('path'))
215
229
  } else {
@@ -222,6 +236,7 @@ Spontaneous.Views.PageView = (function($, S) {
222
236
  }
223
237
  },
224
238
  close: function() {
239
+ this.url_editor_open = false;
225
240
  var view = $('h3', this.panel), edit = $('.edit', this.panel);
226
241
  view.show();
227
242
  edit.hide();
@@ -236,6 +251,9 @@ Spontaneous.Views.PageView = (function($, S) {
236
251
 
237
252
  panel: function() {
238
253
  this.panel = dom.div('#page-content');
254
+ if (this.page.hidden()) {
255
+ this.panel.addClass('hidden')
256
+ }
239
257
  this.panel.append(new FunctionBar(this.page).panel());
240
258
 
241
259
  var fields = dom.div('#page-fields')
@@ -57,7 +57,10 @@ Spontaneous.Views.PieceView = (function($, S) {
57
57
  inside.append(dom.div('.grey-bg'));
58
58
  }
59
59
 
60
- contents.append(this.title_bar(contents));
60
+ if (!this.content.type().is_alias()) {
61
+ wrapper.append(this.content_type_info());
62
+ }
63
+ contents.append( this.action_buttons(contents));
61
64
  if (this.content.type().is_alias()) {
62
65
  contents.append(this.alias_target_panel());
63
66
  }
@@ -99,10 +102,11 @@ Spontaneous.Views.PieceView = (function($, S) {
99
102
  },
100
103
  alias_target_panel: function() {
101
104
  var content = this.content,
102
- wrap = dom.div('.alias-target'),
103
- icon = content.alias_icon,
104
105
  click = function() { S.Location.load_id(content.target().id); },
105
- title = dom.a().html(content.content.alias_title).click(click);
106
+ wrap = dom.div('.alias-target').click(click),
107
+ icon = content.alias_icon,
108
+ type = dom.span(".content-type").text(content.type().display_title(content));
109
+ title = dom.a().html(content.content.alias_title);
106
110
 
107
111
  if (!content.has_fields()) { wrap.addClass('no-fields'); }
108
112
 
@@ -111,18 +115,22 @@ Spontaneous.Views.PieceView = (function($, S) {
111
115
  wrap.append(img.icon(60, 60).click(click))
112
116
  }
113
117
 
114
- return wrap.append(title)
118
+ return wrap.append(title, type)
119
+ },
120
+ content_type_info: function() {
121
+ var type = dom.div(".content-type.piece").text(this.content.type().display_title(this.content));
122
+ return type;
115
123
  },
116
- title_bar: function(wrapper) {
124
+ action_buttons: function(wrapper) {
117
125
  if (!this._title_bar) {
118
126
  var label = user.is_developer() ? dom.a('.developer.source').attr('href', this.content.developer_edit_url()).text(this.content.developer_description()) : (this.content.type().title);
119
- var title_bar = dom.div('.title-bar')//.append(label);
127
+ var action_buttons = dom.div('.title-bar');//.append(label);
120
128
  var actions = dom.div('.actions', {'xstyle':'display: none'});
121
129
  var destroy = dom.a('.delete');
122
130
  var visibility = dom.a('.visibility');
123
131
  actions.append(destroy);
124
132
  actions.append(visibility);
125
- title_bar.append(actions);
133
+ action_buttons.append(actions);
126
134
  var _hide_pause;
127
135
  // wrapper.mouseenter(function() {
128
136
  // if (_hide_pause) { window.clearTimeout(_hide_pause); }
@@ -133,9 +141,9 @@ Spontaneous.Views.PieceView = (function($, S) {
133
141
  destroy.click(this.confirm_destroy.bind(this));
134
142
  this.content.watch('hidden', this.visibility_changed.bind(this));
135
143
  visibility.click(this.toggle_visibility.bind(this));
136
- this._title_bar = title_bar;
144
+ this._action_buttons = action_buttons;
137
145
  }
138
- return this._title_bar;
146
+ return this._action_buttons;
139
147
  },
140
148
  reposition: function(position, callback) {
141
149
  this.content.bind('repositioned', callback);
@@ -194,6 +202,7 @@ Spontaneous.Views.PieceView = (function($, S) {
194
202
  }.bind(this));
195
203
  }
196
204
  });
205
+ PieceView.ConfirmDeletePopup = ConfirmDeletePopup;
197
206
  return PieceView;
198
207
  }(jQuery, Spontaneous));
199
208
 
@@ -37,6 +37,9 @@ Spontaneous.Views = (function($, S) {
37
37
  text_fields: function() {
38
38
  return this.content.text_fields();
39
39
  },
40
+ string_fields: function() {
41
+ return this.content.string_fields();
42
+ },
40
43
  file_fields: function() {
41
44
  return this.content.file_fields();
42
45
  },
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
+ width="32px" height="24px" viewBox="0 0 32 24" enable-background="new 0 0 32 24" xml:space="preserve">
6
+ <g>
7
+ <path fill="#FFFFFF" d="M26,12l-6,6h4c0,1.102-0.896,2-2,2H10c-1.101,0-2-0.898-2-2v-2H4v2c0,3.309,2.691,6,6,6h12
8
+ c3.312,0,6-2.691,6-6h4L26,12z"/>
9
+ <path fill="#FFFFFF" d="M22,0H10C6.691,0,4,2.692,4,6v0.062H0L6,12l6-5.938H8V6c0-1.102,0.899-2,2-2h12c1.104,0,2,0.898,2,2v2h4V6
10
+ C28,2.692,25.312,0,22,0z"/>
11
+ </g>
12
+ </svg>
@@ -22,10 +22,10 @@
22
22
  site_id: '<%= Spontaneous::Site.config.site_id %>',
23
23
  debug: <%= Spontaneous.development? %>,
24
24
  development: <%= Spontaneous.development? %>,
25
- asynchronous: false,
25
+ asynchronous: <%= Spontaneous.production? %>,
26
26
  editor_protocol: 'mvim',
27
27
  <% if Spontaneous.config.auto_login; %>
28
- auto_login: 'garry',
28
+ auto_login: '<%= Spontaneous.config.auto_login %>',
29
29
  user_key: '<%= env[Spontaneous::Rack::ACTIVE_KEY].key_id %>',
30
30
  <% end %>
31
31
  onload: function() {
@@ -4,17 +4,13 @@
4
4
  <meta charset="utf-8" />
5
5
  <title><%= Spontaneous::Site.config.site_domain %>: Please Login</title>
6
6
  <link REL="SHORTCUT ICON" HREF="/@spontaneous/static/favicon.ico" />
7
- <link rel="apple-touch-icon" href="/@spontaneous/static/spot.png" />
7
+ <link rel="apple-touch-icon" href="/@spontaneous/static/spot-71fab1d2f065034f5fc15e7bea2ad36c.png" />
8
8
  <% Spontaneous::Rack::Assets::CSS::LOGIN_CSS.each do |css_file| %>
9
9
  <link rel="stylesheet" href="<%= style_url(css_file) %>" type="text/css" media="screen" charset="utf-8" />
10
10
  <% end %>
11
11
  <% Spontaneous::Rack::Assets::JavaScript::JQUERY.each do |js_file| %>
12
12
  <script type="text/javascript" charset="utf-8" src="<%= script_url(js_file) %>"></script>
13
13
  <% end %>
14
- <% Spontaneous::Rack::Assets::JavaScript::COMPATIBILITY.each do |js_file| %>
15
- <script type="text/javascript" charset="utf-8" src="<%= script_url(js_file) %>"></script>
16
- <% end %>
17
-
18
14
  <script type="text/javascript">
19
15
  var Spontaneous = {
20
16
  site_domain: '<%= Spontaneous::Site.config.site_domain %>',
@@ -43,7 +39,7 @@
43
39
  }(jQuery));
44
40
  </script>
45
41
  </head>
46
- <body id="spontaneous">
42
+ <body id="login">
47
43
  <div id="outer" style="display: none">
48
44
  <h1>Please Login</h1>
49
45
  <div id="login">
@@ -53,7 +49,7 @@
53
49
  <p id="error-message" class="error" <% unless locals[:failed] %>style="display: none"<% end %>><span id="failure-message">Login failed for &lsquo;<span id="failed-name"><%= locals[:login] %></span>&rsquo;</span></p>
54
50
 
55
51
  <div class="inputs">
56
- <input type="hidden" name="origin" value="<%= request.path_info %>" />
52
+ <input type="hidden" name="origin" value="<%= locals[:origin] || request.path_info %>" />
57
53
  <p>
58
54
  <label><input type="text" class="text" id="user-login" name="user[login]" value="<%= locals[:login] %>" /><span>Username</span></label>
59
55
  </p>
@@ -67,7 +63,7 @@
67
63
  </div>
68
64
  <form action="/@spontaneous/reauthenticate" method="post" accept-charset="UTF-8">
69
65
  <input type="hidden" id="reauthenticate-key" name="api_key" value="" />
70
- <input type="hidden" id="reauthenticate-origin" name="origin" value="<%= request.path_info %>" />
66
+ <input type="hidden" id="reauthenticate-origin" name="origin" value="<%= locals[:origin] || request.path_info %>" />
71
67
  </form>
72
68
  </body>
73
69
  </html>
@@ -16,9 +16,6 @@
16
16
  <script type="text/javascript">
17
17
  var Spontaneous = {};
18
18
  </script>
19
- <% Spontaneous::Rack::Assets::JavaScript::LOGIN_JS.each do |js_file| %>
20
- <script type="text/javascript" charset="utf-8" src="<%= script_url(js_file) %>"></script>
21
- <% end %>
22
19
  <script type="text/javascript">
23
20
  function _confirm(id) {
24
21
  var t = 200;
@@ -33,7 +30,7 @@
33
30
  }
34
31
  </script>
35
32
  </head>
36
- <body id="spontaneous">
33
+ <body id="schema-error">
37
34
  <div id="container">
38
35
 
39
36
  <%
@@ -11,13 +11,15 @@
11
11
  <div id="outer">
12
12
  <h1>Sorry!</h1>
13
13
  <h2>You are using an unsupported browser...</h2>
14
- <p>In order to provide the best editing experience Spontaneous uses features found in the best, modern, browsers.</p>
15
- <p>Please download and install one of the following browsers in order to use this CMS as well as enjoy the best of the internet. You won&rsquo;t regret it...</p>
16
- <ul>
17
- <li><a href="http://www.google.com/chrome">Google Chrome</a></li>
18
- <li><a href="http://www.mozilla.com/firefox/">Firefox 4</a></li>
19
- <!-- <li><a href="http://www.mozilla.com/firefox/">Safari</a></li> -->
20
- </ul>
14
+ <div class="error">
15
+ <p class="feature"><%= params[:msg] %></p>
16
+ <p class="user-agent">Browser: <%= params[:useragent] %></p>
17
+ </div>
18
+ <p>In order to provide the best editing experience Spontaneous uses features only found in the latest browsers.</p>
19
+ <p>Please download and install <a href="http://www.google.com/chrome">Google Chrome</a> or <a href="http://www.google.com/chromeframe">Chrome Frame</a> in order to use this CMS as well as enjoy the best of the internet. You won&rsquo;t regret it...</p>
20
+ <p class="chrome"><a href="http://www.google.com/chrome">
21
+ <img src="/@spontaneous/static/chromelogo-200x52-45c7cbc93be080bea342df5fcda2ef8b.png" alt="" />
22
+ </a></p>
21
23
  </div>
22
24
  </body>
23
25
  </html>
data/bin/spot CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby -KU
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems' unless defined?(Gem) # Useful only on --dev mode
4
4
  require 'bundler'
@@ -3,7 +3,7 @@
3
3
  Sequel.migration do
4
4
  up do
5
5
  adapter_scheme = self.adapter_scheme
6
- create_table!(:spontaneous_users, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
6
+ create_table(:spontaneous_users, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
7
7
  primary_key :id
8
8
  varchar :name
9
9
  varchar :login, :size => 32, :index => true, :unique => true
@@ -12,13 +12,13 @@ Sequel.migration do
12
12
  varchar :crypted_password
13
13
  boolean :disabled, :default => false
14
14
 
15
- datetime :last_login_at
16
- datetime :created_at
15
+ timestamp :last_login_at, :default => nil, :null => true
16
+ timestamp :created_at
17
17
 
18
18
  index [:login, :disabled], :name => "enabled_login_index"
19
19
  end
20
20
 
21
- create_table!(:spontaneous_groups, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
21
+ create_table(:spontaneous_groups, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
22
22
  primary_key :id
23
23
  foreign_key :user_id, :spontaneous_users, :key => :id, :on_delete => :cascade # test for being a single user group is user_id.nil?
24
24
  index :user_id
@@ -29,21 +29,21 @@ Sequel.migration do
29
29
  end
30
30
 
31
31
 
32
- create_table!(:spontaneous_groups_users, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
32
+ create_table(:spontaneous_groups_users, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
33
33
  primary_key :id
34
- foreign_key :user_id, :spontaneous_users, :key => :id
35
- foreign_key :group_id, :spontaneous_groups, :key => :id
34
+ foreign_key :user_id, :spontaneous_users, :key => :id, :on_delete => :cascade
35
+ foreign_key :group_id, :spontaneous_groups, :key => :id, :on_delete => :cascade
36
36
  end
37
37
 
38
- create_table!(:spontaneous_access_keys, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
38
+ create_table(:spontaneous_access_keys, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
39
39
  primary_key :id
40
40
  foreign_key :user_id, :spontaneous_users, :key => :id, :on_delete => :cascade
41
41
  index :user_id
42
42
  char :key_id, :size => 44, :index => true, :unique => true
43
- datetime :last_access_at
43
+ timestamp :last_access_at
44
44
  varchar :last_access_ip
45
45
  varchar :source_ip
46
- datetime :created_at
46
+ timestamp :created_at
47
47
  end
48
48
  end
49
49
 
@@ -0,0 +1,11 @@
1
+ # encoding: UTF-8
2
+
3
+ Sequel.migration do
4
+ up do
5
+ add_column :spontaneous_state, :modified_at, DateTime
6
+ end
7
+
8
+ down do
9
+ drop_column :spontaneous_state, :modified_at, DateTime
10
+ end
11
+ end
@@ -0,0 +1,14 @@
1
+ # encoding: UTF-8
2
+
3
+ Sequel.migration do
4
+ up do
5
+ alter_table :content do
6
+ add_foreign_key :created_by_id, :spontaneous_users, :key => :id, :on_delete => :set_null
7
+ end
8
+ end
9
+
10
+ down do
11
+ drop_column :content, :created_by_id
12
+ end
13
+ end
14
+
@@ -0,0 +1,21 @@
1
+ # encoding: UTF-8
2
+
3
+ Sequel.migration do
4
+ up do
5
+ adapter_scheme = self.adapter_scheme
6
+ alter_table(:content) do
7
+ case adapter_scheme
8
+ when :mysql, :mysql2
9
+ add_column :serialized_modifications, 'mediumtext'
10
+ else
11
+ add_column :serialized_modifications, :text
12
+ end
13
+ end
14
+ end
15
+
16
+ down do
17
+ alter_table(:content) do
18
+ drop_column :serialized_modifications
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ Sequel.migration do
2
+ up do
3
+ adapter_scheme = self.adapter_scheme
4
+ create_table(:spontaneous_field_versions, :engine => "INNODB", :charset => "UTF8", :collate => "utf8_general_ci") do
5
+ primary_key :id
6
+
7
+ case adapter_scheme
8
+ when :mysql, :mysql2
9
+ column :value, 'mediumtext'
10
+ else
11
+ text :value
12
+ end
13
+
14
+ Integer :content_id
15
+ String :field_sid
16
+ DateTime :created_at
17
+ Integer :version
18
+ Integer :user_id
19
+
20
+ index [:content_id, :field_sid]
21
+ end
22
+ end
23
+
24
+ down do
25
+ drop_table :spontaneous_field_versions
26
+ end
27
+ end
@@ -13,8 +13,16 @@ module Sequel::Plugins
13
13
  class_variable_get :"@@unscoped_table_name"
14
14
  end
15
15
 
16
+ def fast_instance_delete_sql
17
+ nil
18
+ end
19
+
20
+ def primary_key_lookup(pk)
21
+ dataset[primary_key_hash(pk)]
22
+ end
23
+
16
24
  def with_table(table_name, &block)
17
- dataset.with_table(unscoped_table_name, table_name, &block)
25
+ @dataset.with_table(unscoped_table_name, table_name, &block)
18
26
  end
19
27
  end
20
28
 
@@ -25,6 +33,7 @@ module Sequel::Plugins
25
33
  def with_table(original_table_name, current_table_name)
26
34
  saved_table_name = table_mappings[original_table_name]
27
35
  table_mappings[original_table_name] = current_table_name.to_s
36
+
28
37
  yield if block_given?
29
38
  ensure
30
39
  table_mappings[original_table_name] = saved_table_name
@@ -0,0 +1,25 @@
1
+ require 'pathname'
2
+
3
+ module Spontaneous::Asset
4
+ class File
5
+ def initialize(source, relative_path)
6
+ @source, @relative_path = source, relative_path
7
+ end
8
+
9
+ def load_path
10
+ [name, extensions.first].join(".")
11
+ end
12
+
13
+ def basename
14
+ @basename ||= ::File.basename(@relative_path)
15
+ end
16
+
17
+ def name
18
+ basename.split(".").first
19
+ end
20
+
21
+ def extensions
22
+ @extensions ||= basename.split(".")[1..-1]
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,28 @@
1
+ require 'pathname'
2
+
3
+ module Spontaneous::Asset
4
+ class Source
5
+ def initialize(source_dir)
6
+ @source_dir = ::File.expand_path(source_dir)
7
+ end
8
+
9
+ def source_path
10
+ @source_path ||= Pathname.new(@source_dir)
11
+ end
12
+
13
+ def source_files
14
+ source_paths.map(&:to_s)
15
+ end
16
+
17
+ def source_paths
18
+ @source_files ||= find_source_paths
19
+ end
20
+
21
+ def find_source_paths
22
+ absolute_paths = Dir[@source_dir / "**/*.*"].map { |path| Pathname.new(path) }
23
+ source_path = self.source_path
24
+ absolute_paths.map { |path| path.relative_path_from(source_path) }
25
+ end
26
+ end
27
+ end
28
+