spontaneous 0.2.0.alpha2 → 0.2.0.alpha3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -40
- data/Rakefile +29 -41
- data/Readme.markdown +21 -8
- data/application/css/add_alias_dialogue.css.scss +79 -0
- data/application/css/{v2.scss → core.css.scss} +537 -550
- data/application/css/{definitions.scss → definitions.css.scss} +121 -33
- data/application/css/dialogue.css.scss +409 -0
- data/application/css/{editing.scss → editing.css.scss} +25 -262
- data/application/css/font.css.scss +8 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_222222_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_228ef1_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ef8c08_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffd27a_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/images/ui-icons_ffffff_256x240.png +0 -0
- data/application/css/jquery-ui-1.8.21.custom/ui-lightness.css.scss +565 -0
- data/application/css/{login.scss → login.css.scss} +4 -4
- data/application/css/meta.css.scss +331 -0
- data/application/css/{popover.scss → popover.css.scss} +9 -8
- data/application/css/{schema_error.scss → schema_error.css.scss} +4 -4
- data/application/css/spontaneous.css +5 -0
- data/application/css/unsupported.css.scss +42 -0
- data/application/js/add_alias_dialogue.js +72 -10
- data/application/js/ajax.js +50 -16
- data/application/js/compatibility.js +19 -15
- data/application/js/content.js +39 -36
- data/application/js/content_area.js +53 -5
- data/application/js/dialogue.js +17 -0
- data/application/js/dom.js +1 -1
- data/application/js/edit_panel.js +23 -8
- data/application/js/extensions.js +7 -2
- data/application/js/field_preview.js +2 -1
- data/application/js/field_types/date_field.js +11 -8
- data/application/js/field_types/file_field.js +188 -9
- data/application/js/field_types/image_field.js +46 -29
- data/application/js/field_types/markdown_field.js +57 -14
- data/application/js/field_types/select_field.js +72 -0
- data/application/js/field_types/string_field.js +8 -0
- data/application/js/field_types/webvideo_field.js +8 -0
- data/application/js/init.js +1 -7
- data/application/js/location.js +41 -13
- data/application/js/login.js +3 -0
- data/application/js/meta_view/user_admin.js +543 -0
- data/application/js/meta_view.js +1 -0
- data/application/js/metadata.js +20 -0
- data/application/js/page.js +17 -3
- data/application/js/page_browser.js +40 -30
- data/application/js/page_entry.js +4 -0
- data/application/js/panel/root_menu.js +66 -0
- data/application/js/popover.js +2 -2
- data/application/js/preview.js +1 -1
- data/application/js/publish.js +138 -30
- data/application/js/services.js +43 -0
- data/application/js/sharded_upload.js +2 -2
- data/application/js/spontaneous.js +64 -5
- data/application/js/state.js +20 -9
- data/application/js/top_bar.js +273 -150
- data/application/js/types.js +20 -15
- data/application/js/upload.js +1 -2
- data/application/js/user.js +18 -4
- data/application/js/vendor/date.js +104 -0
- data/application/js/vendor/jquery-ui-1.8.18.custom.min.js +356 -0
- data/application/js/views/box_view.js +15 -8
- data/application/js/views/page_piece_view.js +11 -8
- data/application/js/views/page_view.js +21 -3
- data/application/js/views/piece_view.js +19 -10
- data/application/js/views.js +3 -0
- data/application/static/chromelogo-200x52-45c7cbc93be080bea342df5fcda2ef8b.png +0 -0
- data/application/static/dot-texture-9eea29e4ac7ad9a772285252078ec127.png +0 -0
- data/application/static/editing-textarea-resize-s-b5af62365eb7e19ea4beccf7242d508e.png +0 -0
- data/application/static/editing-texture-1-42b06a3439752490988f30f2a06d5e7c.png +0 -0
- data/application/static/font/fontawesome-webfont-5c5c21100a346972a82c34c5e96ffcfe.ttf +0 -0
- data/application/static/loop_alt1-white-7894b458528e92216196cae26b4c2c96.svg +12 -0
- data/application/static/spontaneous-states-e91ec89db525c62da0105b97cdd781ce.png +0 -0
- data/application/views/index.erb +2 -2
- data/application/views/login.erb +4 -8
- data/application/views/schema_modification_error.html.erb +1 -4
- data/application/views/unsupported.erb +9 -7
- data/bin/spot +1 -1
- data/db/migrations/20110209152710_users_and_groups.rb +10 -10
- data/db/migrations/20120305112647_site_modification_time.rb +11 -0
- data/db/migrations/20120418153903_add_ownership_of_content.rb +14 -0
- data/db/migrations/20120423175416_add_pending_modifications.rb +21 -0
- data/db/migrations/20120525164947_add_field_versions.rb +27 -0
- data/lib/sequel/plugins/scoped_table_name.rb +10 -1
- data/lib/spontaneous/asset/file.rb +25 -0
- data/lib/spontaneous/asset/source.rb +28 -0
- data/lib/spontaneous/asset.rb +75 -0
- data/lib/spontaneous/box.rb +6 -4
- data/lib/spontaneous/capistrano/deploy.rb +47 -0
- data/lib/spontaneous/capistrano/sync.rb +81 -0
- data/lib/spontaneous/capistrano.rb +13 -0
- data/lib/spontaneous/change.rb +60 -68
- data/lib/spontaneous/cli/assets.rb +29 -0
- data/lib/spontaneous/cli/base.rb +0 -48
- data/lib/spontaneous/cli/console.rb +1 -1
- data/lib/spontaneous/cli/server.rb +6 -4
- data/lib/spontaneous/cli/site.rb +28 -17
- data/lib/spontaneous/cli/user.rb +107 -0
- data/lib/spontaneous/cli.rb +100 -4
- data/lib/spontaneous/collections/entry_set.rb +2 -2
- data/lib/spontaneous/collections/field_set.rb +48 -22
- data/lib/spontaneous/collections/prototype_set.rb +20 -13
- data/lib/spontaneous/constants.rb +3 -0
- data/lib/spontaneous/content.rb +22 -5
- data/lib/spontaneous/errors.rb +3 -3
- data/lib/spontaneous/extensions/array.rb +12 -0
- data/lib/spontaneous/extensions/enumerable.rb +30 -0
- data/lib/spontaneous/extensions/nil.rb +3 -1
- data/lib/spontaneous/extensions/string.rb +16 -0
- data/lib/spontaneous/field_types/date_field.rb +45 -2
- data/lib/spontaneous/field_types/field.rb +42 -9
- data/lib/spontaneous/field_types/file_field.rb +68 -0
- data/lib/spontaneous/field_types/image_field.rb +63 -0
- data/lib/spontaneous/field_types/select_field.rb +109 -0
- data/lib/spontaneous/field_types/string_field.rb +6 -1
- data/lib/spontaneous/field_types/webvideo_field.rb +85 -27
- data/lib/spontaneous/field_types.rb +1 -1
- data/lib/spontaneous/field_version.rb +8 -0
- data/lib/spontaneous/generators/page.rb +1 -1
- data/lib/spontaneous/generators/site/Capfile.tt +1 -4
- data/lib/spontaneous/generators/site/Gemfile.tt +13 -6
- data/lib/spontaneous/generators/site/config/deploy.rb.tt +28 -0
- data/lib/spontaneous/generators/site/config/environments/production.rb.tt +7 -2
- data/lib/spontaneous/generators/site.rb +1 -0
- data/lib/spontaneous/json.rb +34 -11
- data/lib/spontaneous/layout.rb +22 -0
- data/lib/spontaneous/media/file.rb +4 -0
- data/lib/spontaneous/output/assets/compression.rb +58 -0
- data/lib/spontaneous/output/assets.rb +32 -0
- data/lib/spontaneous/output/context.rb +179 -0
- data/lib/spontaneous/output/format/html.rb +5 -0
- data/lib/spontaneous/output/format/plain.rb +5 -0
- data/lib/spontaneous/output/format.rb +180 -0
- data/lib/spontaneous/output/helpers/classes_helper.rb +18 -0
- data/lib/spontaneous/{render/helpers/html_helper.rb → output/helpers/conditional_comment_helper.rb} +3 -12
- data/lib/spontaneous/output/helpers/script_helper.rb +73 -0
- data/lib/spontaneous/output/helpers/stylesheet_helper.rb +61 -0
- data/lib/spontaneous/output/helpers.rb +28 -0
- data/lib/spontaneous/output/template/engine.rb +59 -0
- data/lib/spontaneous/output/template/renderer.rb +153 -0
- data/lib/spontaneous/output/template.rb +21 -0
- data/lib/spontaneous/output.rb +163 -0
- data/lib/spontaneous/page.rb +2 -1
- data/lib/spontaneous/paths.rb +6 -1
- data/lib/spontaneous/permissions/access_key.rb +5 -5
- data/lib/spontaneous/permissions/user.rb +81 -35
- data/lib/spontaneous/permissions/user_level.rb +26 -22
- data/lib/spontaneous/plugins/aliases.rb +76 -12
- data/lib/spontaneous/plugins/allowed_types.rb +60 -18
- data/lib/spontaneous/plugins/application/paths.rb +0 -28
- data/lib/spontaneous/plugins/application/system.rb +35 -0
- data/lib/spontaneous/plugins/boxes.rb +4 -0
- data/lib/spontaneous/plugins/content_groups.rb +16 -0
- data/lib/spontaneous/plugins/entries.rb +50 -30
- data/lib/spontaneous/plugins/fields.rb +15 -0
- data/lib/spontaneous/plugins/layouts.rb +8 -2
- data/lib/spontaneous/plugins/modifications.rb +228 -0
- data/lib/spontaneous/plugins/page/formats.rb +67 -42
- data/lib/spontaneous/plugins/page/request.rb +10 -0
- data/lib/spontaneous/plugins/page/site_timestamps.rb +28 -0
- data/lib/spontaneous/plugins/paths.rb +15 -3
- data/lib/spontaneous/plugins/publishing.rb +124 -45
- data/lib/spontaneous/plugins/render.rb +13 -8
- data/lib/spontaneous/plugins/schema_hierarchy.rb +18 -6
- data/lib/spontaneous/plugins/site/helpers.rb +53 -0
- data/lib/spontaneous/plugins/site/hooks.rb +50 -0
- data/lib/spontaneous/plugins/site/map.rb +1 -1
- data/lib/spontaneous/plugins/site/paths.rb +13 -0
- data/lib/spontaneous/plugins/site/publishing.rb +6 -2
- data/lib/spontaneous/plugins/site/{revisions.rb → state.rb} +5 -1
- data/lib/spontaneous/plugins/site/storage.rb +4 -0
- data/lib/spontaneous/plugins/site/url.rb +15 -0
- data/lib/spontaneous/plugins/site_map.rb +13 -3
- data/lib/spontaneous/plugins/styles.rb +5 -1
- data/lib/spontaneous/plugins/visibility.rb +39 -12
- data/lib/spontaneous/prototypes/box_prototype.rb +4 -0
- data/lib/spontaneous/prototypes/field_prototype.rb +15 -10
- data/lib/spontaneous/publishing/event_client.rb +46 -0
- data/lib/spontaneous/publishing/immediate.rb +81 -44
- data/lib/spontaneous/publishing/simultaneous.rb +23 -6
- data/lib/spontaneous/publishing.rb +4 -3
- data/lib/spontaneous/rack/around_back.rb +1 -5
- data/lib/spontaneous/rack/around_front.rb +4 -4
- data/lib/spontaneous/rack/around_preview.rb +4 -3
- data/lib/spontaneous/rack/assets.rb +81 -54
- data/lib/spontaneous/rack/authentication.rb +0 -1
- data/lib/spontaneous/rack/back.rb +160 -72
- data/lib/spontaneous/rack/cookie_authentication.rb +2 -2
- data/lib/spontaneous/rack/css.rb +18 -15
- data/lib/spontaneous/rack/event_source.rb +9 -21
- data/lib/spontaneous/rack/fiber_pool.rb +26 -0
- data/lib/spontaneous/rack/front.rb +12 -4
- data/lib/spontaneous/rack/helpers.rb +35 -13
- data/lib/spontaneous/rack/js.rb +41 -0
- data/lib/spontaneous/rack/public.rb +34 -44
- data/lib/spontaneous/rack/sse.rb +18 -0
- data/lib/spontaneous/rack/static.rb +3 -0
- data/lib/spontaneous/rack/user_admin.rb +100 -0
- data/lib/spontaneous/rack/user_helpers.rb +1 -1
- data/lib/spontaneous/rack.rb +6 -2
- data/lib/spontaneous/schema.rb +31 -4
- data/lib/spontaneous/search/index.rb +19 -3
- data/lib/spontaneous/search/results.rb +1 -1
- data/lib/spontaneous/sequel.rb +17 -0
- data/lib/spontaneous/site.rb +11 -4
- data/lib/spontaneous/state.rb +11 -0
- data/lib/spontaneous/storage/cloud.rb +4 -0
- data/lib/spontaneous/storage/local.rb +11 -0
- data/lib/spontaneous/style.rb +2 -2
- data/lib/spontaneous/tasks/database.rake +21 -22
- data/lib/spontaneous/utils/database/mysql_dumper.rb +4 -0
- data/lib/spontaneous/utils/database/postgres_dumper.rb +78 -0
- data/lib/spontaneous/utils/database.rb +6 -3
- data/lib/spontaneous/utils/smart_quotes.rb +499 -0
- data/lib/spontaneous/utils/smush_it.rb +66 -0
- data/lib/spontaneous/utils.rb +3 -1
- data/lib/spontaneous/version.rb +2 -2
- data/lib/spontaneous.rb +25 -29
- data/spontaneous.gemspec +186 -106
- data/test/experimental/test_features.rb +1 -1
- data/test/fixtures/asset_pipeline/application/css/basic.css.scss +4 -0
- data/test/fixtures/asset_pipeline/application/css/complex.css.scss.erb +6 -0
- data/test/fixtures/asset_pipeline/application/css/simple.css +3 -0
- data/test/fixtures/asset_pipeline/application/css/spontaneous.css +7 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/complex.css.scss.erb +6 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/library.css.scss +1 -0
- data/test/fixtures/asset_pipeline/application/css/subdir/simple.css +3 -0
- data/test/fixtures/asset_pipeline/application/js/basic.js.coffee +1 -0
- data/test/fixtures/asset_pipeline/application/js/complex.js.coffee.erb +1 -0
- data/test/fixtures/asset_pipeline/application/js/login.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/require.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/simple.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/spontaneous.js +5 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/complex.js.coffee.erb +1 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/library.js.coffee +1 -0
- data/test/fixtures/asset_pipeline/application/js/subdir/simple.js +1 -0
- data/test/fixtures/asset_pipeline/application/js/vendor/jquery.js +1 -0
- data/test/fixtures/asset_pipeline/application/static/dot-texture.png +0 -0
- data/test/fixtures/asset_pipeline/application/static/subdir/px.gif +0 -0
- data/test/fixtures/assets/public1/css/a.scss +1 -0
- data/test/fixtures/assets/public1/js/a.js +1 -0
- data/test/fixtures/assets/public1/js/m.coffee +1 -0
- data/test/fixtures/assets/public2/css/b.scss +1 -0
- data/test/fixtures/assets/public2/css/c.css +1 -0
- data/test/fixtures/assets/public2/js/b.js +1 -0
- data/test/fixtures/assets/public2/js/c.js +1 -0
- data/test/fixtures/assets/public2/js/n.coffee +1 -0
- data/test/fixtures/back/config/user_levels.yml +3 -0
- data/test/fixtures/back/public/js/coffeescript.coffee +1 -0
- data/test/fixtures/back/templates/layouts/standard.css.cut +1 -0
- data/test/fixtures/back/templates/layouts/standard.js.cut +1 -0
- data/test/fixtures/example_application/config/database.yml +4 -4
- data/test/fixtures/helpers/templates/layouts/standard.html.cut +1 -0
- data/test/fixtures/helpers/templates/layouts/standard.mobile.cut +1 -0
- data/test/fixtures/images/vimlogo.pdf +0 -0
- data/test/fixtures/outputs/templates/layouts/standard.atom.cut +1 -0
- data/test/fixtures/permissions/config/user_levels.yml +6 -3
- data/test/fixtures/serialisation/class_hash.yaml.erb +1 -0
- data/test/fixtures/serialisation/root_hash.yaml.erb +2 -2
- data/test/fixtures/templates/extended/grandparent.html.cut +7 -7
- data/test/fixtures/templates/extended/main.html.cut +5 -5
- data/test/fixtures/templates/extended/parent.html.cut +8 -8
- data/test/fixtures/templates/extended/partial_with_locals.html.cut +1 -1
- data/test/fixtures/templates/extended/with_includes.html.cut +6 -6
- data/test/fixtures/templates/extended/with_includes_and_locals.html.cut +6 -7
- data/test/fixtures/templates/layouts/entries.html.cut +4 -4
- data/test/fixtures/templates/layouts/standard.html.cut +1 -0
- data/test/fixtures/templates/layouts/variables.html.cut +1 -1
- data/test/fixtures/templates/publishing/templates/layouts/static.html.cut +1 -1
- data/test/fixtures/templates/publishing/templates/layouts/static.rtf.cut +1 -0
- data/test/fixtures/templates/template_class/complex_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/complex_template.pdf.cut +2 -2
- data/test/fixtures/templates/template_class/default_template_style.html.cut +1 -1
- data/test/fixtures/templates/template_class/images_with_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/slots_template.html.cut +2 -2
- data/test/fixtures/templates/template_class/slots_template.pdf.cut +2 -2
- data/test/fixtures/user_manager/config/user_levels.yml +9 -0
- data/test/functional/test_application.rb +7 -7
- data/test/functional/test_back.rb +352 -97
- data/test/functional/test_front.rb +71 -20
- data/test/functional/test_user_manager.rb +284 -0
- data/test/javascript/env.js +13505 -0
- data/test/javascript/test_markdown.rb +43 -3
- data/test/support/custom_matchers.rb +3 -2
- data/test/test_helper.rb +50 -9
- data/test/test_javascript.rb +13 -13
- data/test/ui_helper.rb +1 -1
- data/test/unit/test_alias.rb +79 -8
- data/test/unit/test_asset_bundler.rb +220 -0
- data/test/unit/test_assets.rb +213 -0
- data/test/unit/test_async.rb +55 -0
- data/test/unit/test_authentication.rb +52 -39
- data/test/unit/test_boxes.rb +20 -15
- data/test/unit/test_changesets.rb +261 -0
- data/test/unit/test_content.rb +73 -33
- data/test/unit/test_content_inheritance.rb +18 -18
- data/test/unit/test_extensions.rb +26 -0
- data/test/unit/test_fields.rb +303 -16
- data/test/unit/test_formats.rb +267 -34
- data/test/unit/test_helpers.rb +79 -2
- data/test/unit/test_images.rb +10 -0
- data/test/unit/test_layouts.rb +21 -13
- data/test/unit/test_modifications.rb +648 -0
- data/test/unit/test_page.rb +6 -2
- data/test/unit/test_permissions.rb +101 -27
- data/test/unit/test_piece.rb +4 -4
- data/test/unit/test_plugins.rb +3 -2
- data/test/unit/test_publishing.rb +332 -0
- data/test/unit/test_render.rb +118 -67
- data/test/unit/test_revisions.rb +546 -0
- data/test/unit/test_schema.rb +83 -1
- data/test/unit/test_search.rb +59 -0
- data/test/unit/test_serialisation.rb +2 -47
- data/test/unit/test_site.rb +217 -108
- data/test/unit/test_storage.rb +26 -0
- data/test/unit/test_structure.rb +2 -2
- data/test/unit/test_styles.rb +90 -75
- data/test/unit/test_table_scoping.rb +21 -17
- data/test/unit/test_templates.rb +75 -69
- data/test/{slow → unit}/test_visibility.rb +78 -22
- metadata +528 -221
- data/application/css/add_alias_dialogue.scss +0 -27
- data/application/css/min/14c2a35812c443001b15d8b12a4780f88c678035.css +0 -1
- data/application/css/min/565d4c25e82148acb01c45c8d675b37a08676d77.css +0 -1
- data/application/css/min/84dbe894ea96eafd321c30823d630817bfc4b03b.css +0 -1
- data/application/css/spontaneous.scss +0 -111
- data/application/css/unsupported.scss +0 -16
- data/application/css/variables.scss +0 -80
- data/application/js/min/2a0c2962537a3181fedfff5c92596ba6d3122dc9.js +0 -3
- data/application/js/min/4cf1c493d3379ecba5287758c61238034c0893f9.js +0 -2
- data/application/js/min/78ac6b99d96750bb6b9f9aad4cb9cd91cd03f391.js +0 -3
- data/application/js/min/b8abf302a824c35385ff517b34111e1710ff3b37.js +0 -2
- data/application/js/min/c8efb9b9f7c3f6613fcebc6be60f605b6570a382.js +0 -90
- data/application/static/diagonal-texture.png +0 -0
- data/application/static/editing-0-noise.png +0 -0
- data/application/static/editing-1-noise.png +0 -0
- data/application/static/editing-texture-1.png +0 -0
- data/application/static/editing-texture.png +0 -0
- data/application/static/editing-toolbar-shadow-bottom.png +0 -0
- data/application/static/editing-toolbar-shadow-top.png +0 -0
- data/application/static/inner-glow.png +0 -0
- data/application/static/item-buttons-highlight.png +0 -0
- data/application/static/item-buttons.png +0 -0
- data/application/static/paper-texture-dark.png +0 -0
- data/application/static/plus_alt.svg +0 -8
- data/application/static/select-arrow-root.png +0 -0
- data/application/static/slot-up-arrow.png +0 -0
- data/application/static/spontaneous.png +0 -0
- data/lib/cutaneous/context_helper.rb +0 -187
- data/lib/cutaneous/preview_context.rb +0 -32
- data/lib/cutaneous/preview_renderer.rb +0 -10
- data/lib/cutaneous/publish_context.rb +0 -10
- data/lib/cutaneous/publish_renderer.rb +0 -14
- data/lib/cutaneous/publish_template.rb +0 -62
- data/lib/cutaneous/publish_token_parser.rb +0 -8
- data/lib/cutaneous/renderer.rb +0 -124
- data/lib/cutaneous/request_context.rb +0 -9
- data/lib/cutaneous/request_renderer.rb +0 -15
- data/lib/cutaneous/request_template.rb +0 -11
- data/lib/cutaneous/request_token_parser.rb +0 -9
- data/lib/cutaneous/token_parser.rb +0 -125
- data/lib/cutaneous.rb +0 -48
- data/lib/spontaneous/render/context_base.rb +0 -143
- data/lib/spontaneous/render/development_renderer.rb +0 -14
- data/lib/spontaneous/render/engine.rb +0 -19
- data/lib/spontaneous/render/format/html.rb +0 -5
- data/lib/spontaneous/render/format.rb +0 -75
- data/lib/spontaneous/render/helpers/script_helper.rb +0 -17
- data/lib/spontaneous/render/helpers/stylesheet_helper.rb +0 -16
- data/lib/spontaneous/render/helpers.rb +0 -14
- data/lib/spontaneous/render/preview_context.rb +0 -8
- data/lib/spontaneous/render/preview_renderer.rb +0 -24
- data/lib/spontaneous/render/publish_context.rb +0 -22
- data/lib/spontaneous/render/published_renderer.rb +0 -53
- data/lib/spontaneous/render/publishing_renderer.rb +0 -16
- data/lib/spontaneous/render/render_cache.rb +0 -26
- data/lib/spontaneous/render/renderer.rb +0 -50
- data/lib/spontaneous/render/request_context.rb +0 -8
- data/lib/spontaneous/render.rb +0 -214
- data/test/experimental/test_cutaneous.rb +0 -309
- data/test/fixtures/application/css/test.less +0 -5
- data/test/slow/test_publishing.rb +0 -1006
- /data/application/css/{developer.scss → developer.css.scss} +0 -0
- /data/application/js/vendor/{jquery-1.7.1.min.js → jquery.js} +0 -0
- /data/application/static/{location-arrow.png → location-arrow-c1c1d3ca472481c61a0a5f8cb289d743.png} +0 -0
- /data/application/static/{missing.png → missing-911ce6dbd9f4602e0f3fbcd7e78846a2.png} +0 -0
- /data/application/static/{orange-down-arrow.png → orange-down-arrow-395ae1929e8662b2ff0977daf12c35bb.png} +0 -0
- /data/application/static/{page-browser-next.png → page-browser-next-ce781a242c23b980b99b9db7abc20b05.png} +0 -0
- /data/application/static/{plus-box.png → plus-box-dcde74a1e496f68298c9b443caa1c5d5.png} +0 -0
- /data/application/static/{select-arrow.png → select-arrow-6e7dd3745b00e934b0d7a3250c46558b.png} +0 -0
- /data/application/static/{slot-down-arrow.png → slot-down-arrow-59ad5f5ee5b52a7ebd00bca4b3104194.png} +0 -0
- /data/application/static/{splash.png → splash-65b493a714df9b8b3ab170103401b53d.png} +0 -0
- /data/application/static/{spot.png → spot-71fab1d2f065034f5fc15e7bea2ad36c.png} +0 -0
- /data/application/static/{spot.svg → spot-8505041082d8d3bbe8d34c29dddb3b7d.svg} +0 -0
- /data/application/static/{texture.png → texture-03f7627e8264b1d607113ab32c593a58.png} +0 -0
data/test/unit/test_templates.rb
CHANGED
@@ -20,16 +20,18 @@ class TemplatesTest < MiniTest::Spec
|
|
20
20
|
renderer.render(path, context)
|
21
21
|
end
|
22
22
|
|
23
|
-
def make_template_root(base_dir)
|
23
|
+
def make_template_root(base_dir = "")
|
24
24
|
@template_root = File.expand_path(File.join(File.dirname(__FILE__), '../fixtures/templates', base_dir))
|
25
|
-
|
25
|
+
@site.paths.add(:templates, @template_root)
|
26
26
|
@template_root
|
27
27
|
end
|
28
28
|
|
29
29
|
def setup
|
30
|
-
@
|
31
|
-
|
32
|
-
|
30
|
+
@site = setup_site
|
31
|
+
make_template_root
|
32
|
+
@klass = Class.new(Spontaneous::Output.context_class) do
|
33
|
+
include Spontaneous::Output::Context::ContextCore
|
34
|
+
include Spontaneous::Output::Context::PreviewContext
|
33
35
|
|
34
36
|
def escape(val)
|
35
37
|
::CGI.escapeHTML(val)
|
@@ -50,106 +52,121 @@ class TemplatesTest < MiniTest::Spec
|
|
50
52
|
true
|
51
53
|
end
|
52
54
|
end
|
53
|
-
@context = @klass.new(
|
55
|
+
@context = @klass.new(Object.new, :html)
|
56
|
+
end
|
57
|
+
|
58
|
+
def teardown
|
59
|
+
teardown_site
|
54
60
|
end
|
55
61
|
|
56
62
|
context "First render" do
|
57
63
|
setup do
|
58
|
-
@template = Cutaneous::PublishTemplate.new
|
64
|
+
# @template = Cutaneous::PublishTemplate.new
|
65
|
+
@engine = S::Output::Template::PublishEngine.new(@template_root)
|
59
66
|
end
|
60
67
|
|
61
68
|
should "ignore second level statements" do
|
62
69
|
input = '<html><title>{{title}}</title>{{unsafe}}</html>'
|
63
|
-
@
|
64
|
-
output = @template.render(@context)
|
70
|
+
output = @engine.render_string(input, @context)
|
65
71
|
output.should == '<html><title>{{title}}</title>{{unsafe}}</html>'
|
66
72
|
end
|
67
73
|
|
68
74
|
should "evaluate first level expressions" do
|
69
|
-
@
|
70
|
-
output = @template.render(@context)
|
75
|
+
output = @engine.render_string('<html><title>${title}</title>{{unsafe}}</html>', @context)
|
71
76
|
output.should == '<html><title>THE TITLE</title>{{unsafe}}</html>'
|
72
77
|
end
|
73
78
|
|
74
79
|
should "evaluate first level statements" do
|
75
|
-
@
|
76
|
-
output = @template.render(@context)
|
80
|
+
output = @engine.render_string('<html><title>${title}</title>%{ 2.times do }{{unsafe}}%{ end }</html>', @context)
|
77
81
|
output.should == '<html><title>THE TITLE</title>{{unsafe}}{{unsafe}}</html>'
|
78
82
|
end
|
79
83
|
|
80
84
|
should "generate 2nd render templates" do
|
81
|
-
@
|
82
|
-
|
83
|
-
|
84
|
-
second.convert(output)
|
85
|
-
output = second.render(@context)
|
85
|
+
output = @engine.render_string("<html><title>${title}</title>%{ 2.times do }{{bell}}\n%{ end }</html>", @context)
|
86
|
+
second = S::Output::Template::RequestEngine.new(@template_root)
|
87
|
+
output = second.render_string(output, @context)
|
86
88
|
output.should == "<html><title>THE TITLE</title>ding\nding\n</html>"
|
87
89
|
end
|
90
|
+
|
91
|
+
should "handle multiline statements" do
|
92
|
+
output = @engine.render_string((<<-TEMPLATE), @context)
|
93
|
+
%{
|
94
|
+
something = 3
|
95
|
+
nothing = 4; another = 5
|
96
|
+
-}
|
97
|
+
${ something + nothing + another -}
|
98
|
+
TEMPLATE
|
99
|
+
output.should == "12"
|
100
|
+
end
|
101
|
+
|
102
|
+
should "correctly handle braces within statements" do
|
103
|
+
output = @engine.render_string((<<-TEMPLATE), @context)
|
104
|
+
%{
|
105
|
+
a = { :a => "a", :b => "b" }
|
106
|
+
b = { :c => "c", :d => "d" }
|
107
|
+
c = a.map { |k, v| "\#{k}-\#{v}"}.join("/")
|
108
|
+
-}
|
109
|
+
${ a[:a] }${ a[:b] -}
|
110
|
+
TEMPLATE
|
111
|
+
output.should == "ab"
|
112
|
+
end
|
88
113
|
end
|
89
114
|
|
90
115
|
context "Second render" do
|
91
116
|
setup do
|
92
|
-
@
|
117
|
+
@engine = S::Output::Template::RequestEngine.new(@template_root)
|
93
118
|
end
|
94
119
|
|
95
120
|
should "a render unescaped expressions" do
|
96
|
-
@
|
97
|
-
output = @template.render(@context)
|
121
|
+
output = @engine.render_string('<html><title>{{title}}</title>{{unsafe}}</html>', @context)
|
98
122
|
output.should == "<html><title>THE TITLE</title><script>alert('bad')</script></html>"
|
99
123
|
end
|
100
124
|
|
101
125
|
should "render escaped expressions" do
|
102
|
-
@
|
103
|
-
output = @template.render(@context)
|
126
|
+
output = @engine.render_string('<html><title>{$ unsafe $}</title></html>', @context)
|
104
127
|
output.should == "<html><title><script>alert('bad')</script></title></html>"
|
105
128
|
end
|
106
129
|
|
107
130
|
should "evaluate expressions" do
|
108
|
-
@
|
109
|
-
output = @template.render(@context)
|
131
|
+
output = @engine.render_string('<html>{% 2.times do %}<title>{{title}}</title>{% end %}</html>', @context)
|
110
132
|
output.should == "<html><title>THE TITLE</title><title>THE TITLE</title></html>"
|
111
133
|
end
|
112
134
|
end
|
113
135
|
|
114
136
|
context "Content rendering" do
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
# end
|
119
|
-
|
120
|
-
# teardown do
|
121
|
-
# Spontaneous.template_root = @saved_template_root
|
122
|
-
# end
|
137
|
+
setup do
|
138
|
+
@engine = S::Output::Template::PublishEngine.new(@template_root / "content")
|
139
|
+
end
|
123
140
|
|
124
141
|
should "render" do
|
125
|
-
output =
|
142
|
+
output = @engine.render_template('template', @context)
|
126
143
|
output.should == "<html><title>THE TITLE</title></html>\n"
|
127
144
|
end
|
128
145
|
|
129
146
|
should "preprocess" do
|
130
|
-
output =
|
147
|
+
output = @engine.render_template('preprocess', @context)
|
131
148
|
output.should == "<html><title>THE TITLE</title>{{bell}}</html>\n"
|
132
149
|
end
|
133
150
|
|
134
151
|
should "include imports" do
|
135
|
-
output =
|
152
|
+
output = @engine.render_template('include', @context)
|
136
153
|
output.should == "<html>{{bell}}ding\n</html>\n"
|
137
154
|
end
|
138
155
|
|
139
156
|
should "include imports in sub-directories" do
|
140
|
-
output =
|
157
|
+
output = @engine.render_template('include_dir', @context)
|
141
158
|
output.should == "<html>{{ bell }}ding\n</html>\n"
|
142
159
|
end
|
143
160
|
|
144
161
|
should "preserve the format across includes" do
|
145
|
-
context = @klass.new(
|
146
|
-
|
147
|
-
output = first_pass('content', 'template', context)
|
162
|
+
context = @klass.new(Object.new)
|
163
|
+
output = @engine.render_template('template', @context, "epub")
|
148
164
|
output.should == "<epub><epub>{{ bell }}ding</epub>\n</epub>\n"
|
149
165
|
end
|
150
166
|
|
151
167
|
should "render a second pass" do
|
152
|
-
|
168
|
+
engine = S::Output::Template::RequestEngine.new(@template_root / "content")
|
169
|
+
output = engine.render_template('second', @context)
|
153
170
|
output.should == "<html><title>THE TITLE</title>ding</html>\n"
|
154
171
|
end
|
155
172
|
|
@@ -158,15 +175,17 @@ class TemplatesTest < MiniTest::Spec
|
|
158
175
|
context "Template hierarchy" do
|
159
176
|
|
160
177
|
setup do
|
178
|
+
@engine = S::Output::Template::PublishEngine.new(@template_root / "extended")
|
161
179
|
end
|
162
180
|
|
163
181
|
should "work" do
|
164
|
-
output =
|
165
|
-
|
182
|
+
output = @engine.render_template('main', @context)
|
183
|
+
expected = "Main Title {{page.title}}Grandparent Nav\nMain Body\nParent Body\nGrandparent Body\nGrandparent Footer\nParent Footer\n"
|
184
|
+
output.should == expected
|
166
185
|
end
|
167
186
|
|
168
187
|
should "allow the use of includes" do
|
169
|
-
output =
|
188
|
+
output = @engine.render_template('with_includes', @context)
|
170
189
|
output.should == (<<-RENDER)
|
171
190
|
Parent Title
|
172
191
|
INCLUDE
|
@@ -177,7 +196,7 @@ Parent Footer
|
|
177
196
|
end
|
178
197
|
|
179
198
|
should "allow passing of local variables to included templates" do
|
180
|
-
output =
|
199
|
+
output = @engine.render_template('with_includes_and_locals', @context)
|
181
200
|
output.should == (<<-RENDER)
|
182
201
|
Parent Title
|
183
202
|
INCLUDE
|
@@ -186,23 +205,14 @@ Grandparent Footer
|
|
186
205
|
Parent Footer
|
187
206
|
RENDER
|
188
207
|
end
|
189
|
-
should "handle multiline statements" do
|
190
|
-
output = first_pass('engine', 'multiline')
|
191
|
-
output.should == "12\n"
|
192
|
-
end
|
193
|
-
|
194
|
-
should "correctly handle braces within statements" do
|
195
|
-
output = first_pass('engine', 'braces')
|
196
|
-
output.should == "ab\n"
|
197
|
-
end
|
198
208
|
end
|
199
209
|
|
200
|
-
context "Output conversion" do
|
210
|
+
context "Output conversion xxx" do
|
201
211
|
setup do
|
202
212
|
|
203
|
-
@context_class = Class.new(
|
204
|
-
include
|
205
|
-
include Spontaneous::
|
213
|
+
@context_class = Class.new(Spontaneous::Output.context_class) do
|
214
|
+
include Spontaneous::Output::Context::ContextCore
|
215
|
+
include Spontaneous::Output::Context::PreviewContext
|
206
216
|
|
207
217
|
def escape(val)
|
208
218
|
CGI.escapeHTML(val)
|
@@ -223,7 +233,7 @@ Parent Footer
|
|
223
233
|
"'#{_format}'"
|
224
234
|
end
|
225
235
|
end
|
226
|
-
@klass.new.tap { |i| i._format =
|
236
|
+
@klass.new.tap { |i| i._format = __format }
|
227
237
|
end
|
228
238
|
|
229
239
|
def slot
|
@@ -235,27 +245,23 @@ Parent Footer
|
|
235
245
|
@klass.new
|
236
246
|
end
|
237
247
|
end
|
238
|
-
@
|
248
|
+
@engine = S::Output::Template::PublishEngine.new(@template_root)
|
249
|
+
@context = @context_class.new(Object.new)
|
239
250
|
end
|
240
251
|
|
241
252
|
should "call #render(format) if context responds to it" do
|
242
|
-
|
243
|
-
@template.convert('${slot} ${ monkey }')
|
244
|
-
output = @template.render(context)
|
253
|
+
output = @engine.render_string('${slot} ${ monkey }', @context)
|
245
254
|
output.should == "(html) magic"
|
246
255
|
end
|
247
256
|
|
248
257
|
should "call to_format on non-strings" do
|
249
|
-
|
250
|
-
@template.convert('${field} ${ monkey }')
|
251
|
-
output = @template.render(context)
|
258
|
+
output = @engine.render_string('${field} ${ monkey }', @context)
|
252
259
|
output.should == "(html) magic"
|
253
260
|
end
|
254
261
|
|
255
262
|
should "call to_s on non-strings that have no specific handler" do
|
256
|
-
context = @context_class.new(
|
257
|
-
@
|
258
|
-
output = @template.render(context)
|
263
|
+
@context = @context_class.new(Object.new)
|
264
|
+
output = @engine.render_string('${field} ${ monkey }', @context, "weird")
|
259
265
|
output.should == "'weird' magic"
|
260
266
|
end
|
261
267
|
end
|
@@ -39,23 +39,10 @@ class VisibilityTest < MiniTest::Spec
|
|
39
39
|
end
|
40
40
|
e.save
|
41
41
|
end
|
42
|
-
# puts "-->"
|
43
|
-
# puts d.id
|
44
|
-
# p [:things, d.class, d.pages.schema_id.to_s, P.boxes.things.schema_id.to_s]
|
45
|
-
# p c.unordered_children.map { |p| [p.parent_id, p.box_sid.to_s, p.uid] }
|
46
|
-
# p c.children.map { |p| p.box_sid.to_s }
|
47
|
-
# puts "--<"
|
48
|
-
# c.save
|
49
|
-
# d.save
|
50
42
|
end
|
51
43
|
end
|
52
44
|
@root.save
|
53
45
|
@root.reload
|
54
|
-
# puts "-->"
|
55
|
-
# p [:things, @root.pages.first.class, @root.pages.first.things.schema_id.to_s, P.boxes.things.schema_id.to_s]
|
56
|
-
# p @root.pages.first.unordered_children.map { |p| [p.box_sid.to_s, p.uid] }
|
57
|
-
# p @root.pages.first.children.map { |p| p.box_sid.to_s }
|
58
|
-
# puts "--<"
|
59
46
|
@child = Page.uid("0")
|
60
47
|
end
|
61
48
|
|
@@ -199,6 +186,20 @@ class VisibilityTest < MiniTest::Spec
|
|
199
186
|
piece1.reload.visible?.should be_false
|
200
187
|
end
|
201
188
|
|
189
|
+
|
190
|
+
should "add child content with a visibility inherited from their parent" do
|
191
|
+
page = P.first
|
192
|
+
page.hide!
|
193
|
+
page.reload
|
194
|
+
piece = E.new
|
195
|
+
page.things << piece
|
196
|
+
page.save
|
197
|
+
piece.reload
|
198
|
+
piece.hidden?.should be_true
|
199
|
+
page.show!
|
200
|
+
piece.reload.hidden?.should be_false
|
201
|
+
end
|
202
|
+
|
202
203
|
context "root" do
|
203
204
|
should "should not be hidable" do
|
204
205
|
@root.is_root?.should be_true
|
@@ -238,17 +239,17 @@ class VisibilityTest < MiniTest::Spec
|
|
238
239
|
end
|
239
240
|
end
|
240
241
|
|
241
|
-
should "only show
|
242
|
+
should "only show visible pieces" do
|
242
243
|
page = Content.first(:uid => "1")
|
243
|
-
page.
|
244
|
-
page.things.
|
244
|
+
page.contents.length.should == 4
|
245
|
+
page.things.contents.length.should == 4
|
245
246
|
page.things.count.should == 4
|
246
|
-
page.
|
247
|
+
page.contents.first.hide!
|
247
248
|
page.reload
|
248
249
|
Content.with_visible do
|
249
|
-
page.
|
250
|
-
page.
|
251
|
-
page.
|
250
|
+
page.contents.length.should == 3
|
251
|
+
page.contents.first.id.should_not == page.id
|
252
|
+
page.contents.first.first?.should be_true
|
252
253
|
end
|
253
254
|
end
|
254
255
|
|
@@ -264,7 +265,7 @@ class VisibilityTest < MiniTest::Spec
|
|
264
265
|
should "ensure that no hidden content can be returned" do
|
265
266
|
@root.reload
|
266
267
|
@root.children.first.children.length.should == 8
|
267
|
-
@root.children.first.
|
268
|
+
@root.children.first.contents.first.hide!
|
268
269
|
@root.reload
|
269
270
|
Content.with_visible do
|
270
271
|
@root.children.first.children.length.should == 6
|
@@ -275,9 +276,64 @@ class VisibilityTest < MiniTest::Spec
|
|
275
276
|
@root.pages.first.hide!
|
276
277
|
@root.reload
|
277
278
|
Content.with_visible do
|
278
|
-
pieces = @root.pages.
|
279
|
+
pieces = @root.pages.contents.map { |p| p }
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
context "aliases" do
|
285
|
+
setup do
|
286
|
+
class ::MyAlias < Piece; end
|
287
|
+
MyAlias.alias_of ::E
|
288
|
+
end
|
289
|
+
|
290
|
+
teardown do
|
291
|
+
Object.send(:remove_const, :MyAlias)
|
292
|
+
end
|
293
|
+
|
294
|
+
should "be initalized as invisible if their target is invisible" do
|
295
|
+
target = E.find(:uid => "1.1")
|
296
|
+
target.hide!
|
297
|
+
al = MyAlias.create(:target => target)
|
298
|
+
al.visible?.should be_false
|
299
|
+
end
|
300
|
+
|
301
|
+
|
302
|
+
should "be made visible along with their target if added when target is hidden" do
|
303
|
+
target = E.find(:uid => "1.1")
|
304
|
+
target.hide!
|
305
|
+
al = MyAlias.create(:target => target)
|
306
|
+
al.reload.visible?.should be_false
|
307
|
+
target.show!
|
308
|
+
al.reload.visible?.should be_true
|
309
|
+
end
|
310
|
+
|
311
|
+
should "be filtered by visibility when doing reverse lookup" do
|
312
|
+
page = P.first(:uid => "1")
|
313
|
+
target = E.find(:uid => "1.1")
|
314
|
+
al1 = MyAlias.create(:target => target)
|
315
|
+
page.things << al1
|
316
|
+
al2 = MyAlias.create(:target => target).reload
|
317
|
+
page.things << al2
|
318
|
+
al1.hide!
|
319
|
+
al1.reload
|
320
|
+
al2.reload
|
321
|
+
Set.new(target.aliases).should == Set.new([al1, al2])
|
322
|
+
target.reload
|
323
|
+
Content.with_visible do
|
324
|
+
target.aliases.should == [al2]
|
279
325
|
end
|
280
326
|
end
|
327
|
+
|
328
|
+
should "show as 'hidden' if their target is deleted" do
|
329
|
+
parent = E.find(:uid => "1.1")
|
330
|
+
target = P.new
|
331
|
+
parent.pages << target
|
332
|
+
parent.save
|
333
|
+
al1 = MyAlias.create(:target => target)
|
334
|
+
P.filter(:id => target.id).delete
|
335
|
+
al1.reload.visible?.should be_false
|
336
|
+
end
|
281
337
|
end
|
282
338
|
end
|
283
339
|
end
|