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/application/js/top_bar.js
CHANGED
@@ -44,51 +44,45 @@ Spontaneous.TopBar = (function($, S) {
|
|
44
44
|
}
|
45
45
|
};
|
46
46
|
var CurrentNode = function(page) {
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
if (a == b) return 0;
|
54
|
-
return (a < b ? -1 : 1);
|
55
|
-
});
|
56
|
-
for (var i = 0, ii = this.pages.length; i < ii; i++) {
|
57
|
-
var p = this.pages[i];
|
58
|
-
if (p.id === this.id) {
|
59
|
-
this.selected = i;
|
60
|
-
break;
|
61
|
-
}
|
62
|
-
}
|
47
|
+
var self = this;
|
48
|
+
self.page = page;
|
49
|
+
self.id = page.id;
|
50
|
+
self.path = page.path;
|
51
|
+
self.title = page.slug;
|
52
|
+
self.pages = page.generation;
|
63
53
|
}
|
64
54
|
|
65
55
|
CurrentNode.prototype = {
|
66
56
|
element: function() {
|
67
|
-
var
|
68
|
-
|
57
|
+
var self = this
|
58
|
+
, li = dom.li()
|
59
|
+
, select = dom.select()
|
60
|
+
, comparator = function(a, b) {
|
61
|
+
var at = a.slug, bt = b.slug;
|
62
|
+
if (at > bt) { return 1; }
|
63
|
+
if (at < bt) { return -1; }
|
64
|
+
return 0;
|
65
|
+
};
|
69
66
|
select.change(function() {
|
70
67
|
var page = $(this.options[this.selectedIndex]).data('page');
|
71
68
|
S.Location.load_id(page.id);
|
72
69
|
return false;
|
73
70
|
});
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
71
|
+
|
72
|
+
$.each(this.pages, function(boxname, pages) {
|
73
|
+
pages.sort(comparator);
|
74
|
+
var optgroup = dom.optgroup().attr('label', boxname);
|
75
|
+
for (var i = 0, ii = pages.length; i < ii; i++) {
|
76
|
+
var p = pages[i],
|
77
|
+
option = dom.option({'value': p.id, 'selected':(p.id == self.id) }).text(p.slug).data('page', p);
|
78
|
+
if (p.id === self.id) {
|
79
|
+
self.title_option = option;
|
80
|
+
}
|
81
|
+
optgroup.append(option);
|
82
|
+
};
|
83
|
+
select.append(optgroup);
|
84
|
+
});
|
82
85
|
li.append(select);
|
83
|
-
// select.hide();
|
84
|
-
// var link = $(dom.li).append($('<a/>').data('page', this.page).click(function() {
|
85
|
-
// // var page = $(this).data('page');
|
86
|
-
// // S.Location.load_id(page.id);
|
87
|
-
// select.toggle().trigger('click');
|
88
|
-
// }).text(this.title));
|
89
|
-
//
|
90
|
-
// link.append(select);
|
91
|
-
// return link;
|
92
86
|
return li;
|
93
87
|
},
|
94
88
|
set_title: function(new_title) {
|
@@ -102,11 +96,13 @@ Spontaneous.TopBar = (function($, S) {
|
|
102
96
|
|
103
97
|
ChildrenNode.prototype = {
|
104
98
|
element: function() {
|
105
|
-
var li = dom.li('.children')
|
106
|
-
|
99
|
+
var li = dom.li('.children')
|
100
|
+
, select = dom.select('.unselected')
|
101
|
+
, children = this.children;
|
107
102
|
this.li = li;
|
108
103
|
this.select = select;
|
109
|
-
|
104
|
+
this.status = dom.option().text(this.status_text());
|
105
|
+
select.append(this.status);
|
110
106
|
select.change(function() {
|
111
107
|
var p = $(this.options[this.selectedIndex]).data('page');
|
112
108
|
if (p) {
|
@@ -114,21 +110,44 @@ Spontaneous.TopBar = (function($, S) {
|
|
114
110
|
}
|
115
111
|
return false;
|
116
112
|
});
|
117
|
-
for (var
|
118
|
-
|
119
|
-
|
120
|
-
|
113
|
+
for (var boxname in children) {
|
114
|
+
if (children.hasOwnProperty(boxname)) {
|
115
|
+
var optgroup = this.optgroup(boxname), cc = this.sort_children(children[boxname]);
|
116
|
+
for (var i = 0, ii = cc.length; i < ii; i++) {
|
117
|
+
var p = cc[i];
|
118
|
+
optgroup.append(this.option_for_entry(p));
|
119
|
+
};
|
120
|
+
select.append(optgroup)
|
121
|
+
}
|
122
|
+
}
|
121
123
|
li.append(select);
|
122
124
|
return li;
|
123
125
|
}.cache(),
|
124
126
|
|
127
|
+
sort_children: function(children) {
|
128
|
+
var comparator = function(a, b) {
|
129
|
+
var at = a.slug(), bt = b.slug();
|
130
|
+
if (at > bt) { return 1; }
|
131
|
+
if (at < bt) { return -1; }
|
132
|
+
return 0;
|
133
|
+
};
|
134
|
+
return children.sort(comparator);
|
135
|
+
},
|
136
|
+
|
125
137
|
status_text: function() {
|
126
|
-
|
138
|
+
var children = this.children, count = 0;
|
139
|
+
for (var boxname in children) {
|
140
|
+
if (children.hasOwnProperty(boxname)) { count += children[boxname].length; }
|
141
|
+
}
|
142
|
+
if (count === 0) {
|
127
143
|
this.select.hide();
|
128
144
|
} else {
|
129
145
|
this.select.show();
|
130
146
|
}
|
131
|
-
return '('+(
|
147
|
+
return '('+(count)+' pages)';
|
148
|
+
},
|
149
|
+
optgroup: function(boxname) {
|
150
|
+
return dom.optgroup().attr('label', boxname);
|
132
151
|
},
|
133
152
|
option_for_entry: function(p) {
|
134
153
|
var opt = dom.option({'value': p.id()}).text(p.slug()).data('page', p);
|
@@ -140,35 +159,53 @@ Spontaneous.TopBar = (function($, S) {
|
|
140
159
|
return opt;
|
141
160
|
},
|
142
161
|
update_status: function() {
|
143
|
-
|
144
|
-
|
145
|
-
return first;
|
162
|
+
this.status.text(this.status_text());
|
163
|
+
return this.status;
|
146
164
|
},
|
147
165
|
add_page: function(page, position) {
|
148
|
-
var
|
166
|
+
var self = this
|
167
|
+
, option = self.option_for_entry(page)
|
168
|
+
, container = page.container
|
169
|
+
, name = container.name()
|
170
|
+
, children = self.children
|
171
|
+
, optgroup = self.select.find('optgroup[label="'+name+'"]')
|
172
|
+
if (optgroup.length === 0) {
|
173
|
+
optgroup = this.optgroup(name);
|
174
|
+
this.select.append(optgroup);
|
175
|
+
}
|
176
|
+
optgroup.prepend(option);
|
177
|
+
// since the navigation lists are ordered differently from the entries, it's
|
178
|
+
// difficult to insert into the right position
|
179
|
+
// TODO: re-sort the this.children entries and use this list to find the position in the select
|
180
|
+
|
181
|
+
// happens when we're adding the first item
|
182
|
+
if (!children[name]) { children[name] = []; }
|
183
|
+
|
149
184
|
if (position === -1) {
|
150
|
-
|
151
|
-
this.select.append(option);
|
185
|
+
children[name].push(page)
|
152
186
|
} else {
|
153
|
-
|
154
|
-
var first = this.update_status();
|
155
|
-
first.after(option);
|
187
|
+
children[name].splice(position, 0, page)
|
156
188
|
}
|
189
|
+
self.update_status();
|
157
190
|
},
|
158
191
|
|
159
192
|
remove_page: function(page) {
|
160
|
-
var
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
193
|
+
var self = this
|
194
|
+
, container = page.container.name()
|
195
|
+
, index = (function(children) {
|
196
|
+
for (var boxname in children) {
|
197
|
+
if (children.hasOwnProperty(boxname)) {
|
198
|
+
var cc = children[boxname];
|
199
|
+
for (var i = 0, ii = cc.length; i < ii; i++) {
|
200
|
+
if (cc[i].id() === page.id()) { return i; };
|
201
|
+
}
|
202
|
+
}
|
170
203
|
}
|
171
|
-
})
|
204
|
+
}(self.children))
|
205
|
+
, optgroup = this.select.find('optgroup[label="'+container+'"]');
|
206
|
+
optgroup.find('option[value="'+page.id()+'"]').remove();
|
207
|
+
this.children[container].splice(index, 1);
|
208
|
+
this.update_status();
|
172
209
|
}
|
173
210
|
}
|
174
211
|
|
@@ -177,6 +214,7 @@ Spontaneous.TopBar = (function($, S) {
|
|
177
214
|
normal_check: 10000,
|
178
215
|
initialize: function() {
|
179
216
|
this.status = false;
|
217
|
+
this.disabled = true;
|
180
218
|
this.set_interval(this.normal_check);
|
181
219
|
// this.check_status();
|
182
220
|
var update_status = this.update_status.bind(this);
|
@@ -184,7 +222,13 @@ Spontaneous.TopBar = (function($, S) {
|
|
184
222
|
update_status($.parseJSON(event.data))
|
185
223
|
});
|
186
224
|
},
|
187
|
-
|
225
|
+
user_loaded: function(user) {
|
226
|
+
console.log("user loaded", user)
|
227
|
+
if (user.can_publish()) {
|
228
|
+
this.disabled = false;
|
229
|
+
this.button().removeClass("disabled").fadeIn();
|
230
|
+
}
|
231
|
+
},
|
188
232
|
check_status: function() {
|
189
233
|
S.Ajax.get('/publish/status', this.status_recieved.bind(this));
|
190
234
|
},
|
@@ -214,7 +258,9 @@ Spontaneous.TopBar = (function($, S) {
|
|
214
258
|
}
|
215
259
|
} else {
|
216
260
|
this.publishing_state();
|
217
|
-
|
261
|
+
// don't turn off intermediate and replace it with an empty progress dial
|
262
|
+
// by making sure our progress is > 0 before switching to progress view
|
263
|
+
if ((progress !== "*")) {
|
218
264
|
this.progress().update(progress);
|
219
265
|
} else {
|
220
266
|
this.progress().indeterminate();
|
@@ -243,10 +289,10 @@ Spontaneous.TopBar = (function($, S) {
|
|
243
289
|
if (!this._button) {
|
244
290
|
this._progress_container = dom.span('#publish-progress');
|
245
291
|
this._label = dom.span();
|
246
|
-
this._button = dom.a('#open-publish').append(this._progress_container).append(this._label);
|
292
|
+
this._button = dom.a('#open-publish.disabled').append(this._progress_container).append(this._label).hide();
|
247
293
|
this.set_label("Publish");
|
248
294
|
this._button.click(function() {
|
249
|
-
if (!this.in_progress) {
|
295
|
+
if (!this.disabled && !this.in_progress) {
|
250
296
|
S.Publishing.open_dialogue();
|
251
297
|
}
|
252
298
|
}.bind(this));
|
@@ -274,104 +320,79 @@ Spontaneous.TopBar = (function($, S) {
|
|
274
320
|
id: function() { return this.child.id; },
|
275
321
|
title: function() { return this.child.title; },
|
276
322
|
slug: function() { return this.child.slug; }
|
277
|
-
})
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
this.wrap = dom.div('#top');
|
283
|
-
this.location = dom.ul('#navigation');
|
284
|
-
this.location.append(dom.li().append(dom.a()))
|
285
|
-
this.mode_switch = dom.a('#switch-mode').
|
286
|
-
text(this.opposite_mode(S.ContentArea.mode)).
|
287
|
-
click(function() {
|
288
|
-
S.TopBar.toggle_modes();
|
289
|
-
});
|
290
|
-
this.publish_button = new PublishButton();
|
291
|
-
this.wrap.append(this.location);
|
292
|
-
this.wrap.append(this.publish_button.button());
|
293
|
-
this.wrap.append(this.mode_switch);
|
294
|
-
return this.wrap;
|
323
|
+
});
|
324
|
+
|
325
|
+
var CMSNavigationView = new JS.Class({
|
326
|
+
initialize: function() {
|
327
|
+
|
295
328
|
},
|
296
|
-
|
297
|
-
|
298
|
-
|
329
|
+
panel: function() {
|
330
|
+
var self = this;
|
331
|
+
if (!self.wrap) {
|
332
|
+
self.wrap = dom.div("#cms-navigation-view");
|
333
|
+
self.location = dom.ul('#navigation');
|
334
|
+
self.mode_switch = dom.a('#switch-mode').
|
335
|
+
text(S.TopBar.opposite_mode(S.ContentArea.mode)).
|
336
|
+
click(function() {
|
337
|
+
S.TopBar.toggle_modes();
|
338
|
+
});
|
339
|
+
|
340
|
+
self.publish_button = new PublishButton();
|
341
|
+
self.wrap.append(self.location);
|
342
|
+
self.wrap.append(self.publish_button.button());
|
343
|
+
self.wrap.append(self.mode_switch);
|
344
|
+
S.User.watch("user", function(user) { self.publish_button.user_loaded(user); })
|
299
345
|
}
|
300
|
-
|
301
|
-
S.Location.watch('location', this.location_loaded.bind(this));
|
346
|
+
return self.wrap;
|
302
347
|
},
|
303
348
|
location_loaded: function(location) {
|
304
|
-
|
305
|
-
|
306
|
-
var children
|
307
|
-
|
308
|
-
|
349
|
+
var children = {};
|
350
|
+
|
351
|
+
for (var boxname in location.children) {
|
352
|
+
if (location.children.hasOwnProperty(boxname)) {
|
353
|
+
children[boxname] = [];
|
354
|
+
for (var i = 0, cc = location.children[boxname], ii = cc.length; i < ii; i++) {
|
355
|
+
children[boxname].push(new LocationChildProxy(cc[i]));
|
356
|
+
}
|
357
|
+
}
|
309
358
|
}
|
310
359
|
var children_node = new ChildrenNode(children);
|
311
360
|
this.location.append(children_node.element());
|
312
361
|
this.children_node = children_node;
|
313
362
|
},
|
314
363
|
page_loaded: function(page) {
|
315
|
-
var
|
316
|
-
if (
|
317
|
-
|
318
|
-
|
364
|
+
var self = this;
|
365
|
+
if (self.children_node) {
|
366
|
+
self.children_node.element().remove();
|
367
|
+
}
|
368
|
+
var children_node = new ChildrenNode(page.children());
|
369
|
+
self.location.append(children_node.element());
|
370
|
+
page.bind('entry_added', function(entry, position) {
|
371
|
+
if (entry.is_page()) {
|
372
|
+
children_node.add_page(entry, position);
|
319
373
|
}
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
}
|
327
|
-
});
|
328
|
-
page.bind('removed_entry', function(entry) {
|
329
|
-
if (entry.is_page()) {
|
330
|
-
children_node.remove_page(entry);
|
331
|
-
}
|
332
|
-
});
|
374
|
+
});
|
375
|
+
page.bind('removed_entry', function(entry) {
|
376
|
+
if (entry.is_page()) {
|
377
|
+
children_node.remove_page(entry);
|
378
|
+
}
|
379
|
+
});
|
333
380
|
|
334
|
-
|
335
|
-
|
336
|
-
|
381
|
+
page.watch('slug', function(title) {
|
382
|
+
self.navigation_current.set_title(title);
|
383
|
+
});
|
337
384
|
|
338
|
-
|
339
|
-
|
340
|
-
|
385
|
+
page.title_field().watch('value', function(title) {
|
386
|
+
Spontaneous.set_browser_title(title);
|
387
|
+
});
|
341
388
|
|
342
|
-
|
343
|
-
}
|
389
|
+
self.children_node = children_node;
|
344
390
|
},
|
345
|
-
|
346
|
-
this.set('mode', mode);
|
347
|
-
this.mode_switch.text(this.opposite_mode(mode));
|
348
|
-
},
|
349
|
-
toggle_modes: function() {
|
350
|
-
this.set_mode(this.opposite_mode(this.get('mode')));
|
351
|
-
},
|
352
|
-
opposite_mode: function(to_mode) {
|
353
|
-
if (to_mode === 'preview') {
|
354
|
-
return 'edit';
|
355
|
-
} else if (to_mode === 'edit') {
|
356
|
-
return 'preview';
|
357
|
-
}
|
358
|
-
},
|
359
|
-
publishing_started: function() {
|
360
|
-
this.publish_button.publishing_started();
|
361
|
-
},
|
362
|
-
set_browser_title: function(page_title) {
|
363
|
-
document.title = S.site_domain + " | Editing: '"+page_title+"'";
|
364
|
-
},
|
365
|
-
location_changed: function(new_location) {
|
366
|
-
this.set_browser_title(new_location.title)
|
367
|
-
this.set('location', new_location);
|
368
|
-
this.update_navigation();
|
369
|
-
},
|
370
|
-
update_navigation: function() {
|
391
|
+
update_navigation: function(location) {
|
371
392
|
var nodes = [];
|
372
|
-
var location = this.get('location');
|
393
|
+
// var location = this.get('location');
|
373
394
|
var $location_bar = this.location;
|
374
|
-
var ancestors = location.ancestors;
|
395
|
+
var ancestors = location.ancestors.slice(0);
|
375
396
|
var root, is_root = false, root_node, children_node, current_node;
|
376
397
|
if (ancestors.length === 0) {
|
377
398
|
root = location;
|
@@ -392,7 +413,7 @@ Spontaneous.TopBar = (function($, S) {
|
|
392
413
|
} else {
|
393
414
|
current_node = root_node;
|
394
415
|
}
|
395
|
-
$('li
|
416
|
+
$('li', $location_bar).remove();
|
396
417
|
var children_node;
|
397
418
|
if (location.children.length > 0) {
|
398
419
|
// children_node = new ChildrenNode(location.children);
|
@@ -403,8 +424,110 @@ Spontaneous.TopBar = (function($, S) {
|
|
403
424
|
$location_bar.append(node.element())
|
404
425
|
}
|
405
426
|
this.navigation_current = current_node;
|
427
|
+
},
|
428
|
+
publishing_started: function() {
|
429
|
+
this.publish_button.publishing_started();
|
430
|
+
},
|
431
|
+
mode_set: function(mode) {
|
432
|
+
this.mode_switch.text(S.TopBar.opposite_mode(mode));
|
433
|
+
},
|
434
|
+
hide: function() {
|
435
|
+
this.wrap.hide();
|
436
|
+
},
|
437
|
+
show: function() {
|
438
|
+
this.wrap.show();
|
439
|
+
}
|
440
|
+
});
|
441
|
+
|
442
|
+
var ServiceNavigationView = new JS.Class({
|
443
|
+
initialize: function(service) {
|
444
|
+
this.service = service;
|
445
|
+
},
|
446
|
+
panel: function() {
|
447
|
+
var self = this;
|
448
|
+
this.wrap = dom.div("#service-navigation")
|
449
|
+
var title = dom.h2().text(this.service.title);
|
450
|
+
var close = dom.a(".button").text("Close").click(function() {
|
451
|
+
S.Services.close();
|
452
|
+
})
|
453
|
+
this.wrap.append(title, close)
|
454
|
+
return this.wrap;
|
455
|
+
}
|
456
|
+
});
|
457
|
+
var TopBar = new JS.Singleton({
|
458
|
+
include: Spontaneous.Properties,
|
459
|
+
location: "/",
|
460
|
+
panel: function() {
|
461
|
+
this.wrap = dom.div('#top');
|
462
|
+
// this.icon = dom.div('#spontaneous-root');
|
463
|
+
this.icon = this.rootMenu()
|
464
|
+
this.holder = dom.div('#service-outer')
|
465
|
+
this.navigationView = new CMSNavigationView();
|
466
|
+
this.serviceStation = dom.div("#service-inner");
|
467
|
+
this.holder.append(this.navigationView.panel(), this.serviceStation);
|
468
|
+
this.wrap.append(this.icon, this.holder);
|
469
|
+
return this.wrap;
|
470
|
+
},
|
471
|
+
rootMenu: function() {
|
472
|
+
var li = dom.div('#spontaneous-root').click(function(event) {
|
473
|
+
$(this).addClass("active"); // no easy way to remove this
|
474
|
+
Spontaneous.Popover.open(event, new Spontaneous.RootMenuView(function() {
|
475
|
+
li.removeClass("active");
|
476
|
+
}));
|
477
|
+
});
|
478
|
+
return li.append(dom.span());
|
479
|
+
},
|
480
|
+
init: function() {
|
481
|
+
if (!this.get('mode')) {
|
482
|
+
this.set('mode', S.ContentArea.mode);
|
483
|
+
}
|
484
|
+
S.Editing.watch('page', this.page_loaded.bind(this));
|
485
|
+
S.Location.watch('location', this.location_loaded.bind(this));
|
486
|
+
},
|
487
|
+
location_loaded: function(location) {
|
488
|
+
// clear the loaded page so that it forces a reload of the nav when we switch back to edit mode
|
489
|
+
this.set('page', undefined);
|
490
|
+
this.navigationView.location_loaded(location);
|
491
|
+
},
|
492
|
+
page_loaded: function(page) {
|
493
|
+
var loaded_page = this.get('page'), loaded_id = (loaded_page ? loaded_page.id() : undefined);
|
494
|
+
if (page && (page.id() !== loaded_id)) {
|
495
|
+
this.set('page', page);
|
496
|
+
this.navigationView.page_loaded(page);
|
497
|
+
}
|
498
|
+
},
|
499
|
+
publishing_started: function() {
|
500
|
+
this.navigationView.publishing_started();
|
501
|
+
},
|
502
|
+
location_changed: function(new_location) {
|
503
|
+
Spontaneous.set_browser_title(new_location.title)
|
504
|
+
this.set('location', new_location);
|
505
|
+
this.navigationView.update_navigation(new_location);
|
406
506
|
this.page_loaded = function(page) {
|
407
507
|
};
|
508
|
+
},
|
509
|
+
toggle_modes: function() {
|
510
|
+
this.set_mode(this.opposite_mode(this.get('mode')));
|
511
|
+
},
|
512
|
+
opposite_mode: function(to_mode) {
|
513
|
+
if (to_mode === 'preview') {
|
514
|
+
return 'edit';
|
515
|
+
} else if (to_mode === 'edit') {
|
516
|
+
return 'preview';
|
517
|
+
}
|
518
|
+
},
|
519
|
+
set_mode: function(mode) {
|
520
|
+
this.set('mode', mode);
|
521
|
+
this.navigationView.mode_set(mode)
|
522
|
+
},
|
523
|
+
showService: function(service) {
|
524
|
+
this.navigationView.hide();
|
525
|
+
this.serviceView = new ServiceNavigationView(service);
|
526
|
+
this.serviceStation.empty().append(this.serviceView.panel())
|
527
|
+
},
|
528
|
+
showNavigationView: function() {
|
529
|
+
this.serviceStation.empty();
|
530
|
+
this.navigationView.show();
|
408
531
|
}
|
409
532
|
});
|
410
533
|
return TopBar;
|
data/application/js/types.js
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
// console.log('Loading Types...');
|
2
2
|
|
3
3
|
Spontaneous.Types = (function($, S) {
|
4
|
-
var ajax = S.Ajax
|
4
|
+
var ajax = S.Ajax
|
5
|
+
, user = S.User
|
6
|
+
, type_map = {};
|
7
|
+
|
5
8
|
var BoxPrototype = new JS.Class({
|
6
9
|
initialize: function(type_data) {
|
7
10
|
this.data = type_data;
|
@@ -25,6 +28,7 @@ Spontaneous.Types = (function($, S) {
|
|
25
28
|
return types;
|
26
29
|
}
|
27
30
|
});
|
31
|
+
|
28
32
|
var Type = new JS.Class({
|
29
33
|
initialize: function(type_data) {
|
30
34
|
this.data = type_data;
|
@@ -68,24 +72,25 @@ Spontaneous.Types = (function($, S) {
|
|
68
72
|
},
|
69
73
|
edit_url: function() {
|
70
74
|
return S.editor_protocol + "://open?url=file://"+this.data.source;
|
75
|
+
},
|
76
|
+
display_title: function(content) {
|
77
|
+
var t = this.title;
|
78
|
+
if (user.is_developer()) {
|
79
|
+
t += "/" + content.id();
|
80
|
+
}
|
81
|
+
return t;
|
71
82
|
}
|
72
83
|
});
|
73
84
|
var Types = new JS.Singleton({
|
74
85
|
include: Spontaneous.Properties,
|
75
|
-
|
76
|
-
var
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
}
|
84
|
-
Spontaneous.Types.set('types', types);
|
85
|
-
if (callback) { callback.call(type_map); };
|
86
|
-
};
|
87
|
-
})(callback)
|
88
|
-
ajax.get('/types', done);
|
86
|
+
loaded: function(typeData) {
|
87
|
+
var types = {};
|
88
|
+
for (id in typeData) {
|
89
|
+
if (typeData.hasOwnProperty(id)) {
|
90
|
+
types[id] = new Type(typeData[id]);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
Spontaneous.Types.set('types', types);
|
89
94
|
},
|
90
95
|
type: function(id) {
|
91
96
|
return this.get('types')[id];
|
data/application/js/upload.js
CHANGED
@@ -17,8 +17,7 @@ Spontaneous.Upload = (function($, S) {
|
|
17
17
|
this.failure_count = 0;
|
18
18
|
this.file = file;
|
19
19
|
this.insert_position = insert_position;
|
20
|
-
|
21
|
-
this.name = this.file.fileName;
|
20
|
+
this.name = File.filename(this.file);
|
22
21
|
this._total = this.file.size;
|
23
22
|
this.upload_id = upload_id++;
|
24
23
|
},
|
data/application/js/user.js
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
// console.log('Loading User...')
|
2
2
|
|
3
3
|
Spontaneous.User = (function($, S) {
|
4
|
+
var ajax = S.Ajax;
|
5
|
+
|
4
6
|
var User = new JS.Class({
|
5
7
|
initialize: function(user_data) {
|
6
8
|
this.attrs = user_data;
|
@@ -16,22 +18,34 @@ Spontaneous.User = (function($, S) {
|
|
16
18
|
},
|
17
19
|
is_developer: function() {
|
18
20
|
return this.attrs.developer;
|
21
|
+
},
|
22
|
+
is_admin: function() {
|
23
|
+
return this.attrs.admin;
|
24
|
+
},
|
25
|
+
can_publish: function() {
|
26
|
+
return this.attrs.can_publish;
|
19
27
|
}
|
20
28
|
});
|
21
29
|
|
22
30
|
var instance = new JS.Singleton({
|
23
31
|
include: Spontaneous.Properties,
|
24
|
-
|
25
|
-
S.Ajax.get('/user', this.loaded.bind(this));
|
26
|
-
},
|
32
|
+
|
27
33
|
loaded: function(user_data) {
|
28
34
|
this.user = new User(user_data);
|
29
35
|
this.set('user', this.user);
|
30
36
|
},
|
37
|
+
logout: function() {
|
38
|
+
ajax.post("/logout", {}, function() {
|
39
|
+
// S.Ajax.unauthorized();
|
40
|
+
});
|
41
|
+
S.Auth.Key.remove(S.site_id);
|
42
|
+
},
|
31
43
|
name: function() { return this.user.name(); },
|
32
44
|
email: function() { return this.user.email(); },
|
33
45
|
login: function() { return this.user.login(); },
|
34
|
-
is_developer: function() { return this.user.is_developer(); }
|
46
|
+
is_developer: function() { return this.user.is_developer(); },
|
47
|
+
is_admin: function() { return this.user.is_admin(); },
|
48
|
+
can_publish: function() { return this.user.can_publish(); }
|
35
49
|
});
|
36
50
|
return instance;
|
37
51
|
}(jQuery, Spontaneous));
|