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
@@ -0,0 +1,648 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require File.expand_path('../../test_helper', __FILE__)
|
4
|
+
|
5
|
+
|
6
|
+
class ModificationsTest < MiniTest::Spec
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@now = Time.now
|
10
|
+
@site = setup_site
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
teardown_site
|
15
|
+
end
|
16
|
+
|
17
|
+
context "modifications" do
|
18
|
+
setup do
|
19
|
+
stub_time(@now)
|
20
|
+
|
21
|
+
# DB.logger = Logger.new($stdout)
|
22
|
+
Content.delete
|
23
|
+
|
24
|
+
class Page < Spontaneous::Page
|
25
|
+
field :title, :string, :default => "New Page"
|
26
|
+
box :things
|
27
|
+
end
|
28
|
+
class Piece < Spontaneous::Piece
|
29
|
+
box :things
|
30
|
+
end
|
31
|
+
|
32
|
+
@root = Page.create(:uid => "root")
|
33
|
+
count = 0
|
34
|
+
2.times do |i|
|
35
|
+
c = Page.new(:uid => i)
|
36
|
+
@root.things << c
|
37
|
+
count += 1
|
38
|
+
2.times do |j|
|
39
|
+
d = Piece.new(:uid => "#{i}.#{j}")
|
40
|
+
c.things << d
|
41
|
+
count += 1
|
42
|
+
2.times do |k|
|
43
|
+
d.things << Page.new(:uid => "#{i}.#{j}.#{k}")
|
44
|
+
d.save
|
45
|
+
count += 1
|
46
|
+
end
|
47
|
+
end
|
48
|
+
c.save
|
49
|
+
end
|
50
|
+
@root.save
|
51
|
+
end
|
52
|
+
|
53
|
+
teardown do
|
54
|
+
ModificationsTest.send(:remove_const, :Page) rescue nil
|
55
|
+
ModificationsTest.send(:remove_const, :Piece) rescue nil
|
56
|
+
Content.delete
|
57
|
+
DB.logger = nil
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
should "register creation date of all content" do
|
63
|
+
c = Content.create
|
64
|
+
c.created_at.to_i.should == @now.to_i
|
65
|
+
page = Page.create
|
66
|
+
page.created_at.to_i.should == @now.to_i
|
67
|
+
end
|
68
|
+
|
69
|
+
should "update modification date of page when page fields are updated" do
|
70
|
+
now = @now + 100
|
71
|
+
stub_time(now)
|
72
|
+
c = Content.first
|
73
|
+
(c.modified_at.to_i - @now.to_i).abs.should <= 1
|
74
|
+
c.label = "changed"
|
75
|
+
c.save
|
76
|
+
(c.modified_at - now).abs.should <= 1
|
77
|
+
end
|
78
|
+
|
79
|
+
should "update modification date of path when page visibility is changed" do
|
80
|
+
now = @now + 100
|
81
|
+
stub_time(now)
|
82
|
+
c = Page.first
|
83
|
+
(c.modified_at.to_i - @now.to_i).abs.should <= 1
|
84
|
+
c.toggle_visibility!
|
85
|
+
(c.modified_at - now).abs.should <= 1
|
86
|
+
end
|
87
|
+
|
88
|
+
should "update page timestamps on modification of its box fields" do
|
89
|
+
Page.box :with_fields do
|
90
|
+
field :title
|
91
|
+
end
|
92
|
+
|
93
|
+
stub_time(@now+3600)
|
94
|
+
page = Page.first :uid => "0"
|
95
|
+
(page.modified_at.to_i - @now.to_i).abs.should <= 1
|
96
|
+
page.with_fields.title.value = "updated"
|
97
|
+
page.save.reload
|
98
|
+
page.modified_at.to_i.should == @now.to_i + 3600
|
99
|
+
end
|
100
|
+
|
101
|
+
should "update page timestamps on modification of a piece" do
|
102
|
+
stub_time(@now+3600)
|
103
|
+
page = Page.first :uid => "0"
|
104
|
+
(page.modified_at.to_i - @now.to_i).abs.should <= 1
|
105
|
+
content = page.contents.first
|
106
|
+
content.page.should == page
|
107
|
+
content.label = "changed"
|
108
|
+
content.save
|
109
|
+
page.reload
|
110
|
+
page.modified_at.to_i.should == @now.to_i + 3600
|
111
|
+
end
|
112
|
+
|
113
|
+
should "update page timestamps on modification of a piece's box fields" do
|
114
|
+
Piece.box :with_fields do
|
115
|
+
field :title
|
116
|
+
end
|
117
|
+
stub_time(@now+3600)
|
118
|
+
page = Page.first :uid => "0"
|
119
|
+
(page.modified_at.to_i - @now.to_i).abs.should <= 1
|
120
|
+
content = page.contents.first
|
121
|
+
|
122
|
+
content.with_fields.title.value = "updated"
|
123
|
+
content.save
|
124
|
+
page.reload
|
125
|
+
page.modified_at.to_i.should == @now.to_i + 3600
|
126
|
+
end
|
127
|
+
|
128
|
+
should "update page timestamp on addition of piece" do
|
129
|
+
stub_time(@now+3600)
|
130
|
+
page = Page.first :uid => "0"
|
131
|
+
content = Content[page.contents.first.id]
|
132
|
+
content.things << Piece.new
|
133
|
+
content.save
|
134
|
+
content.modified_at.to_i.should == @now.to_i + 3600
|
135
|
+
page.reload
|
136
|
+
page.modified_at.to_i.should == @now.to_i + 3600
|
137
|
+
end
|
138
|
+
|
139
|
+
should "not update the parent page's timestamp on addition of a child page" do
|
140
|
+
stub_time(@now+1000)
|
141
|
+
page = Page.first :uid => "0"
|
142
|
+
page.things << Page.new
|
143
|
+
page.save.reload
|
144
|
+
page.modified_at.to_i.should == @now.to_i
|
145
|
+
end
|
146
|
+
|
147
|
+
should "update the parent page's modification time if child pages are re-ordered" do
|
148
|
+
page = Page.first :uid => "0.0.0"
|
149
|
+
page.things << Page.new(:uid => "0.0.0.0")
|
150
|
+
page.things << Page.new(:uid => "0.0.0.1")
|
151
|
+
page.save
|
152
|
+
page = Page.first :uid => "0.0.0"
|
153
|
+
stub_time(@now+1000)
|
154
|
+
child = page.things.first
|
155
|
+
child.update_position(1)
|
156
|
+
page.reload.modified_at.to_i.should == @now.to_i + 1000
|
157
|
+
end
|
158
|
+
|
159
|
+
should "update a page's timestamp on modification of its slug" do
|
160
|
+
stub_time(@now+1000)
|
161
|
+
page = Page.first :uid => "0"
|
162
|
+
page.slug = "changed"
|
163
|
+
page.save.reload
|
164
|
+
page.modified_at.to_i.should == @now.to_i + 1000
|
165
|
+
end
|
166
|
+
|
167
|
+
should "not update child pages timestamps after changing their parent's slug" do
|
168
|
+
page = Page.first :uid => "0.0.0"
|
169
|
+
modified = page.modified_at.to_i
|
170
|
+
stub_time(@now+1000)
|
171
|
+
page = Page.first :uid => "0"
|
172
|
+
page.slug = "changed"
|
173
|
+
page.save.reload
|
174
|
+
page.modified_at.to_i.should == @now.to_i + 1000
|
175
|
+
page = Page.first :uid => "0.0.0"
|
176
|
+
page.modified_at.to_i.should == modified
|
177
|
+
end
|
178
|
+
|
179
|
+
should "update the pages timestamp if a boxes order is changed" do
|
180
|
+
stub_time(@now+3600)
|
181
|
+
page = Page.first :uid => "0"
|
182
|
+
content = Content[page.contents.first.id]
|
183
|
+
content.update_position(1)
|
184
|
+
page.reload.modified_at.to_i.should == @now.to_i + 3600
|
185
|
+
end
|
186
|
+
|
187
|
+
should "update the parent page's modification time if the contents of a piece's box are re-ordered" do
|
188
|
+
stub_time(@now+3600)
|
189
|
+
page = Page.first :uid => "0"
|
190
|
+
content = page.things.first.things.first
|
191
|
+
content.update_position(1)
|
192
|
+
page.reload.modified_at.to_i.should == @now.to_i + 3600
|
193
|
+
end
|
194
|
+
|
195
|
+
should "update the parent page's modification date if a piece is deleted" do
|
196
|
+
stub_time(@now+3600)
|
197
|
+
page = Page.first :uid => "0"
|
198
|
+
content = Content[page.contents.first.id]
|
199
|
+
content.destroy
|
200
|
+
page.reload.modified_at.to_i.should == @now.to_i + 3600
|
201
|
+
end
|
202
|
+
|
203
|
+
should "update the parent page's modification date if a page is deleted" do
|
204
|
+
stub_time(@now+3600)
|
205
|
+
page = Page.first :uid => "0"
|
206
|
+
content = Content[page.things.first.things.first.id]
|
207
|
+
content.destroy
|
208
|
+
page.reload.modified_at.to_i.should == @now.to_i + 3600
|
209
|
+
end
|
210
|
+
|
211
|
+
should "add entry to the list of side effects for a visibility change" do
|
212
|
+
stub_time(@now+3600)
|
213
|
+
page = Page.first :uid => "1"
|
214
|
+
old_slug = page.slug
|
215
|
+
page.slug = "changed"
|
216
|
+
page.save
|
217
|
+
page.reload
|
218
|
+
page.pending_modifications.length.should == 1
|
219
|
+
mods = page.pending_modifications(:slug)
|
220
|
+
mods.length.should == 1
|
221
|
+
mod = mods.first
|
222
|
+
mod.must_be_instance_of Spontaneous::Plugins::Modifications::SlugModification
|
223
|
+
mod.old_value.should == old_slug
|
224
|
+
mod.new_value.should == "changed"
|
225
|
+
mod.created_at.to_i.should == @now.to_i + 3600
|
226
|
+
end
|
227
|
+
|
228
|
+
should "serialize page modifications" do
|
229
|
+
stub_time(@now+3600)
|
230
|
+
page = Page.first :uid => "1"
|
231
|
+
page.slug = "changed"
|
232
|
+
page.save
|
233
|
+
page.pending_modifications.length.should == 1
|
234
|
+
mod = page.pending_modifications(:slug).first
|
235
|
+
page = Page.first :id => page.id
|
236
|
+
page.pending_modifications.length.should == 1
|
237
|
+
page.pending_modifications(:slug).first.should == mod
|
238
|
+
page.pending_modifications(:slug).first.created_at.to_i.should == @now.to_i + 3600
|
239
|
+
end
|
240
|
+
|
241
|
+
should "concatenate multiple slug modifications together" do
|
242
|
+
stub_time(@now+3600)
|
243
|
+
page = Page.first :uid => "1"
|
244
|
+
old_slug = page.slug
|
245
|
+
page.slug = "changed"
|
246
|
+
page.save
|
247
|
+
page.pending_modifications.length.should == 1
|
248
|
+
page.slug = "changed-again"
|
249
|
+
page.save
|
250
|
+
mod = page.pending_modifications(:slug).first
|
251
|
+
mod.old_value.should == old_slug
|
252
|
+
mod.new_value.should == "changed-again"
|
253
|
+
end
|
254
|
+
|
255
|
+
should "know the number of pages affected by slug modification" do
|
256
|
+
stub_time(@now+3600)
|
257
|
+
page = Page.first :uid => "1"
|
258
|
+
page.slug = "changed"
|
259
|
+
page.save
|
260
|
+
mod = page.pending_modifications(:slug).first
|
261
|
+
mod.count.should == 4
|
262
|
+
end
|
263
|
+
|
264
|
+
should "show the number of pages whose visibility is affected in the case of a visibility change" do
|
265
|
+
stub_time(@now+3600)
|
266
|
+
page = Page.first :uid => "1"
|
267
|
+
page.hide!
|
268
|
+
page.reload
|
269
|
+
mods = page.pending_modifications(:visibility)
|
270
|
+
mods.length.should == 1
|
271
|
+
mod = mods.first
|
272
|
+
mod.count.should == 4
|
273
|
+
mod.owner.should == page
|
274
|
+
end
|
275
|
+
|
276
|
+
should "record visibility changes that originate from a content piece" do
|
277
|
+
stub_time(@now+3600)
|
278
|
+
page = Page.first :uid => "1"
|
279
|
+
page.things.first.hide!
|
280
|
+
page.reload
|
281
|
+
mods = page.pending_modifications(:visibility)
|
282
|
+
mods.length.should == 1
|
283
|
+
mod = mods.first
|
284
|
+
mod.count.should == 2
|
285
|
+
mod.owner.should == page.things.first
|
286
|
+
end
|
287
|
+
|
288
|
+
should "show number of pages that are to be deleted in the case of a deletion" do
|
289
|
+
stub_time(@now+3600)
|
290
|
+
page = Page.first(:uid => "1")
|
291
|
+
owner = page.owner
|
292
|
+
page.destroy
|
293
|
+
page = Page.first(:uid => "root")
|
294
|
+
mods = page.pending_modifications(:deletion)
|
295
|
+
mod = mods.first
|
296
|
+
# count is number of children of deleted page + 1 (for deleted page)
|
297
|
+
mod.count.should == 5
|
298
|
+
mod.owner.should == owner.reload
|
299
|
+
end
|
300
|
+
|
301
|
+
should "show number of pages deleted if piece with pages is deleted" do
|
302
|
+
stub_time(@now+3600)
|
303
|
+
page = Page.first(:uid => "1")
|
304
|
+
piece = page.things.first
|
305
|
+
owner = piece.owner
|
306
|
+
piece.destroy
|
307
|
+
page = Page.first(:uid => "1")
|
308
|
+
mods = page.pending_modifications(:deletion)
|
309
|
+
mod = mods.first
|
310
|
+
mod.count.should == 2
|
311
|
+
mod.owner.should == owner.reload
|
312
|
+
end
|
313
|
+
|
314
|
+
should "show number of pages deleted if page belonging to piece is deleted" do
|
315
|
+
stub_time(@now+3600)
|
316
|
+
page = Page.first(:uid => "1")
|
317
|
+
child = page.things.first.things.first
|
318
|
+
owner = child.owner
|
319
|
+
child.destroy
|
320
|
+
page = Page.first(:uid => "1")
|
321
|
+
mods = page.pending_modifications(:deletion)
|
322
|
+
mod = mods.first
|
323
|
+
mod.count.should == 1
|
324
|
+
mod.owner.should == owner.reload
|
325
|
+
end
|
326
|
+
|
327
|
+
should "have an empty modification if the slug has been reverted to original value" do
|
328
|
+
stub_time(@now+3600)
|
329
|
+
page = Page.first :uid => "1"
|
330
|
+
old_slug = page.slug
|
331
|
+
page.slug = "changed"
|
332
|
+
page.save
|
333
|
+
page.pending_modifications.length.should == 1
|
334
|
+
page.slug = "changed-again"
|
335
|
+
page.save
|
336
|
+
page.slug = old_slug
|
337
|
+
page.save
|
338
|
+
mods = page.reload.pending_modifications(:slug)
|
339
|
+
mods.length.should == 0
|
340
|
+
end
|
341
|
+
|
342
|
+
should "have an empty modification if the visibility has been reverted to original value" do
|
343
|
+
stub_time(@now+3600)
|
344
|
+
page = Page.first :uid => "1"
|
345
|
+
page.things.first.hide!
|
346
|
+
page.reload
|
347
|
+
page.things.first.show!
|
348
|
+
page.reload
|
349
|
+
mods = page.pending_modifications(:visibility)
|
350
|
+
mods.length.should == 0
|
351
|
+
end
|
352
|
+
|
353
|
+
context "during publish" do
|
354
|
+
setup do
|
355
|
+
@initial_revision = 1
|
356
|
+
@final_revision = 2
|
357
|
+
Content.delete_revision(@initial_revision) rescue nil
|
358
|
+
Content.delete_revision(@final_revision) rescue nil
|
359
|
+
S::Content.publish(@initial_revision)
|
360
|
+
end
|
361
|
+
|
362
|
+
teardown do
|
363
|
+
Content.delete_revision(@initial_revision) rescue nil
|
364
|
+
Content.delete_revision(@final_revision) rescue nil
|
365
|
+
Content.delete_revision(@final_revision+1) rescue nil
|
366
|
+
end
|
367
|
+
|
368
|
+
should "act on path change modifications" do
|
369
|
+
page = Page.first :uid => "1"
|
370
|
+
old_slug = page.slug
|
371
|
+
page.slug = "changed"
|
372
|
+
page.save
|
373
|
+
S::Content.publish(@final_revision, [page.id])
|
374
|
+
S::Content.with_revision(@final_revision) do
|
375
|
+
%w(1 1.1.1).each do |uid|
|
376
|
+
published_page = Page.first :uid => uid
|
377
|
+
S::Content.with_editable do
|
378
|
+
editable_page = Page.first :uid => uid
|
379
|
+
published_page.path.should == editable_page.path
|
380
|
+
end
|
381
|
+
end
|
382
|
+
end
|
383
|
+
end
|
384
|
+
|
385
|
+
should "not publish slug changes on pages other than the one being published" do
|
386
|
+
#/bands/beatles -> /bands/beatles-changed
|
387
|
+
#/bands -> /bands-changed
|
388
|
+
# publish(bands)
|
389
|
+
# with_published { beatles.path.should == /bands-changed/beatles }
|
390
|
+
page = Page.first :uid => "1"
|
391
|
+
page.slug = "changed"
|
392
|
+
page.save
|
393
|
+
|
394
|
+
child_page = Page.first :uid => "1.0.0"
|
395
|
+
old_slug = child_page.slug
|
396
|
+
child_page.slug = "changed-too"
|
397
|
+
child_page.save
|
398
|
+
|
399
|
+
S::Content.publish(@final_revision, [page.id])
|
400
|
+
S::Content.with_revision(@final_revision) do
|
401
|
+
published = Page.first :uid => "1.0.0"
|
402
|
+
published.path.should == "/changed/#{old_slug}"
|
403
|
+
end
|
404
|
+
end
|
405
|
+
|
406
|
+
should "publish the correct path for new child pages with an un-published parent slug change" do
|
407
|
+
# add /bands/beatles
|
408
|
+
# /bands -> /bands-changed
|
409
|
+
# publish(beatles)
|
410
|
+
# with_published { beatles.path.should == /bands/beatles }
|
411
|
+
page = Page.first :uid => "1"
|
412
|
+
old_slug = page.slug
|
413
|
+
page.slug = "changed"
|
414
|
+
page.save
|
415
|
+
|
416
|
+
child_page = Page.first :uid => "1.0.0"
|
417
|
+
child_page.slug = "changed-too"
|
418
|
+
child_page.save
|
419
|
+
|
420
|
+
S::Content.publish(@final_revision, [child_page.id])
|
421
|
+
S::Content.with_revision(@final_revision) do
|
422
|
+
published = Page.first :uid => "1.0.0"
|
423
|
+
published.path.should == "/#{old_slug}/changed-too"
|
424
|
+
end
|
425
|
+
end
|
426
|
+
|
427
|
+
|
428
|
+
should "act on visibility modifications" do
|
429
|
+
page = Page.first :uid => "1"
|
430
|
+
page.hide!
|
431
|
+
S::Content.publish(@final_revision, [page.id])
|
432
|
+
S::Content.with_revision(@final_revision) do
|
433
|
+
%w(1 1.1.1).each do |uid|
|
434
|
+
published_page = Page.first :uid => uid
|
435
|
+
S::Content.with_editable do
|
436
|
+
editable_page = Page.first :uid => uid
|
437
|
+
published_page.hidden?.should == editable_page.hidden?
|
438
|
+
end
|
439
|
+
end
|
440
|
+
end
|
441
|
+
end
|
442
|
+
|
443
|
+
should "publish the correct visibility for new child pages with un-published up-tree visibility changes" do
|
444
|
+
page = Page.first :uid => "1"
|
445
|
+
page.hide!
|
446
|
+
|
447
|
+
child_page = Page.new :uid => "child"
|
448
|
+
page.things << child_page
|
449
|
+
page.save
|
450
|
+
|
451
|
+
S::Content.publish(@final_revision, [child_page.id])
|
452
|
+
|
453
|
+
S::Content.with_revision(@final_revision) do
|
454
|
+
published = Page.first :uid => "1.0.0"
|
455
|
+
published.visible?.should be_true
|
456
|
+
published = Page.first :uid => "child"
|
457
|
+
published.visible?.should be_true
|
458
|
+
end
|
459
|
+
end
|
460
|
+
|
461
|
+
should "publish the correct visibility for new child pages with published up-tree visibility changes" do
|
462
|
+
page = Page.first :uid => "1"
|
463
|
+
page.hide!
|
464
|
+
|
465
|
+
child_page = Page.new :uid => "child"
|
466
|
+
page.things << child_page
|
467
|
+
page.save
|
468
|
+
|
469
|
+
S::Content.publish(@final_revision, [page.id, child_page.id])
|
470
|
+
|
471
|
+
S::Content.with_revision(@final_revision) do
|
472
|
+
published = Page.first :uid => "child"
|
473
|
+
published.visible?.should be_false
|
474
|
+
end
|
475
|
+
end
|
476
|
+
|
477
|
+
should "publish the correct visibility for child pages with un-published parent visibility changes" do
|
478
|
+
# if we publish changes to a child page whose parent page is hidden but that visibility change
|
479
|
+
# hasn't been published then the child page should be visible until the parent is published
|
480
|
+
page = Page.first :uid => "1"
|
481
|
+
page.hide!
|
482
|
+
|
483
|
+
child_page = Page.first :uid => "1.0.0"
|
484
|
+
child_page.slug = "changed-too"
|
485
|
+
child_page.save
|
486
|
+
|
487
|
+
S::Content.publish(@final_revision, [child_page.id])
|
488
|
+
|
489
|
+
S::Content.with_revision(@final_revision) do
|
490
|
+
published = Page.first :uid => "1.0.0"
|
491
|
+
published.visible?.should be_true
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
should "publish the correct visibility for immediate child pages with published parent visibility changes" do
|
496
|
+
page = Page.first :uid => "1"
|
497
|
+
|
498
|
+
child_page = Page.new :uid => "newpage"
|
499
|
+
page.things << child_page
|
500
|
+
page.save
|
501
|
+
|
502
|
+
S::Content.publish(@final_revision, [page.id, child_page.id])
|
503
|
+
|
504
|
+
child_page.hidden?.should be_false
|
505
|
+
|
506
|
+
page.hide!
|
507
|
+
|
508
|
+
child_page.reload.hidden?.should be_true
|
509
|
+
|
510
|
+
S::Content.publish(@final_revision + 1, [page.id])
|
511
|
+
|
512
|
+
S::Content.with_revision(@final_revision + 1) do
|
513
|
+
published = Page.first :uid => "newpage"
|
514
|
+
published.visible?.should be_false
|
515
|
+
end
|
516
|
+
end
|
517
|
+
|
518
|
+
should "publish the correct visibility for child pages with published parent visibility changes" do
|
519
|
+
page = Page.first :uid => "1"
|
520
|
+
child_page = Page.first :uid => "1.0.0"
|
521
|
+
child_page.hidden?.should be_false
|
522
|
+
|
523
|
+
page.hide!
|
524
|
+
|
525
|
+
child_page.reload.hidden?.should be_true
|
526
|
+
|
527
|
+
S::Content.publish(@final_revision, [page.id])
|
528
|
+
|
529
|
+
S::Content.with_revision(@final_revision) do
|
530
|
+
published = Page.first :uid => "1.0.0"
|
531
|
+
published.visible?.should be_false
|
532
|
+
end
|
533
|
+
end
|
534
|
+
|
535
|
+
should "maintain correct published visibility for pieces xxx" do
|
536
|
+
page = Page.first :uid => "1"
|
537
|
+
piece = page.things.first
|
538
|
+
piece.hide!
|
539
|
+
S::Content.publish(@final_revision, [page.id])
|
540
|
+
S::Content.with_revision(@final_revision) do
|
541
|
+
piece = Page.first(:uid => "1").things.first
|
542
|
+
piece.visible?.should be_false
|
543
|
+
end
|
544
|
+
|
545
|
+
S::Content.publish(@final_revision+1, [page.id])
|
546
|
+
|
547
|
+
S::Content.with_revision(@final_revision+1) do
|
548
|
+
piece = Page.first(:uid => "1").things.first
|
549
|
+
piece.visible?.should be_false
|
550
|
+
end
|
551
|
+
end
|
552
|
+
|
553
|
+
should "maintain correct published visibility for pages xxx" do
|
554
|
+
page = Page.first :uid => "1.1.1"
|
555
|
+
page.hide!
|
556
|
+
S::Content.publish(@final_revision, [page.id])
|
557
|
+
S::Content.with_revision(@final_revision) do
|
558
|
+
page = Page.first(:uid => "1.1.1")
|
559
|
+
page.visible?.should be_false
|
560
|
+
end
|
561
|
+
|
562
|
+
S::Content.publish(@final_revision+1, [page.id])
|
563
|
+
|
564
|
+
S::Content.with_revision(@final_revision+1) do
|
565
|
+
page = Page.first(:uid => "1.1.1")
|
566
|
+
page.visible?.should be_false
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
|
571
|
+
should "act on multiple modifications" do
|
572
|
+
page = Page.first :uid => "1"
|
573
|
+
page.slug = "changed"
|
574
|
+
page.slug = "changed-again"
|
575
|
+
page.hide!
|
576
|
+
|
577
|
+
S::Content.publish(@final_revision, [page.id])
|
578
|
+
S::Content.with_revision(@final_revision) do
|
579
|
+
%w(1 1.1.1).each do |uid|
|
580
|
+
published_page = Page.first :uid => uid
|
581
|
+
S::Content.with_editable do
|
582
|
+
editable_page = Page.first :uid => uid
|
583
|
+
published_page.hidden?.should == editable_page.hidden?
|
584
|
+
published_page.slug.should == editable_page.slug
|
585
|
+
published_page.path.should == editable_page.path
|
586
|
+
end
|
587
|
+
end
|
588
|
+
end
|
589
|
+
end
|
590
|
+
|
591
|
+
should "ignore deletion modifications" do
|
592
|
+
page = Page.first(:uid => "1")
|
593
|
+
page.destroy
|
594
|
+
page = Page.first(:uid => "root")
|
595
|
+
S::Content.publish(@final_revision, [page.id])
|
596
|
+
S::Content.with_revision(@final_revision) do
|
597
|
+
%w(1 1.1.1).each do |uid|
|
598
|
+
published_page = Page.first :uid => uid
|
599
|
+
published_page.should be_nil
|
600
|
+
end
|
601
|
+
published_page = Page.first :uid => "0"
|
602
|
+
published_page.should_not be_nil
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
606
|
+
should "clear modifications after publish" do
|
607
|
+
page = Page.first :uid => "1"
|
608
|
+
page.slug = "changed"
|
609
|
+
page.hide!
|
610
|
+
S::Content.publish(@final_revision, [page.id])
|
611
|
+
page = Page.first :id => page.id
|
612
|
+
page.pending_modifications.length.should == 0
|
613
|
+
end
|
614
|
+
end
|
615
|
+
|
616
|
+
context "with assigned editor" do
|
617
|
+
setup do
|
618
|
+
Spontaneous::Permissions::User.delete
|
619
|
+
@user = Spontaneous::Permissions::User.create(:email => "root@example.com", :login => "root", :name => "root", :password => "rootpass")
|
620
|
+
end
|
621
|
+
|
622
|
+
teardown do
|
623
|
+
@user.destroy
|
624
|
+
end
|
625
|
+
|
626
|
+
should "add the editor to any modifications" do
|
627
|
+
stub_time(@now+3600)
|
628
|
+
page = Page.first :uid => "1"
|
629
|
+
page.current_editor = @user
|
630
|
+
page.slug = "changed"
|
631
|
+
page.save
|
632
|
+
mod = page.pending_modifications(:slug).first
|
633
|
+
mod.user.should == @user
|
634
|
+
end
|
635
|
+
|
636
|
+
should "persist the user" do
|
637
|
+
stub_time(@now+3600)
|
638
|
+
page = Page.first :uid => "1"
|
639
|
+
page.current_editor = @user
|
640
|
+
page.slug = "changed"
|
641
|
+
page.save
|
642
|
+
page = Page.first :uid => "1"
|
643
|
+
mod = page.pending_modifications(:slug).first
|
644
|
+
mod.user.should == @user
|
645
|
+
end
|
646
|
+
end
|
647
|
+
end
|
648
|
+
end
|
data/test/unit/test_page.rb
CHANGED
@@ -134,6 +134,10 @@ class PageTest < MiniTest::Spec
|
|
134
134
|
@t = Page[@t.id]
|
135
135
|
end
|
136
136
|
|
137
|
+
should "be able to find a reference to their inline entry" do
|
138
|
+
@q.entry.class.should == Spontaneous::PagePiece
|
139
|
+
end
|
140
|
+
|
137
141
|
should "have a reference to their parent" do
|
138
142
|
@p.parent.should be_nil
|
139
143
|
@q.parent.should === @p
|
@@ -347,8 +351,8 @@ class PageTest < MiniTest::Spec
|
|
347
351
|
|
348
352
|
should "report their depth according to their position in the piece tree" do
|
349
353
|
@parent.depth.should == 0
|
350
|
-
@parent.
|
351
|
-
@parent.
|
354
|
+
@parent.contents.first.depth.should == 1
|
355
|
+
@parent.contents.first.contents.first.depth.should == 2
|
352
356
|
end
|
353
357
|
|
354
358
|
should "know their page" do
|