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,331 @@
|
|
1
|
+
@import "definitions.css.scss";
|
2
|
+
|
3
|
+
#content-outer #content-meta {
|
4
|
+
a {
|
5
|
+
color: $highlight;
|
6
|
+
}
|
7
|
+
.container {
|
8
|
+
}
|
9
|
+
position: absolute;
|
10
|
+
left: 0;
|
11
|
+
right: 0;
|
12
|
+
top: 0;
|
13
|
+
bottom: 0;
|
14
|
+
}
|
15
|
+
|
16
|
+
#user-admin-container {
|
17
|
+
$container-margin: $container-padding;
|
18
|
+
$user-admin-dialogue-width: 680px;
|
19
|
+
@include calc(max-height, "100% - #{ 2 * $container-margin }");
|
20
|
+
@include display-box;
|
21
|
+
@include box-orient(vertical);
|
22
|
+
|
23
|
+
@include rounded;
|
24
|
+
min-height: 450px;
|
25
|
+
background-color: rgba(0, 0, 0, 0.2);
|
26
|
+
position: relative;
|
27
|
+
width: $user-admin-dialogue-width;
|
28
|
+
margin: $container-margin auto 0 auto;
|
29
|
+
overflow: hidden;
|
30
|
+
|
31
|
+
.title {
|
32
|
+
@include rounded-top;
|
33
|
+
height: $container-padding;
|
34
|
+
background-color: rgba(0, 0, 0, 0.2);
|
35
|
+
// background: #ccc;
|
36
|
+
position: relative;
|
37
|
+
span {
|
38
|
+
position: absolute;
|
39
|
+
color: $editing-focus;
|
40
|
+
left: $container-padding/4;
|
41
|
+
top: 15px;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
.title.main {
|
45
|
+
.done {
|
46
|
+
@include button-color($highlight, $action);
|
47
|
+
position: absolute;
|
48
|
+
right: $container-padding / 2;
|
49
|
+
width: 20%;
|
50
|
+
top: ($container-padding / 4) + 4;
|
51
|
+
}
|
52
|
+
span {
|
53
|
+
color: rgba(255, 255, 255, 0.3);
|
54
|
+
padding-left: $container-padding - 10;
|
55
|
+
left: $container-padding / 4;
|
56
|
+
&:before {
|
57
|
+
@include awesome-icon("\f0c0");
|
58
|
+
position: absolute;
|
59
|
+
left: -2px;
|
60
|
+
top: -5px;
|
61
|
+
font-size: 2em;
|
62
|
+
margin-right: $unit;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
.gap {
|
68
|
+
@include box-flex;
|
69
|
+
}
|
70
|
+
.edit {
|
71
|
+
// @extend .meta-background;
|
72
|
+
@include rounded;
|
73
|
+
@extend .editing-background;
|
74
|
+
@include box-sizing;
|
75
|
+
color: #000;
|
76
|
+
position: absolute;
|
77
|
+
left: 0;
|
78
|
+
top: 0;
|
79
|
+
bottom: 0;
|
80
|
+
width: $user-admin-dialogue-width - $container-padding;
|
81
|
+
margin-right: $container-padding;
|
82
|
+
|
83
|
+
.back {
|
84
|
+
position: absolute;
|
85
|
+
left: -$container-padding;
|
86
|
+
top: 0;
|
87
|
+
bottom: 0;
|
88
|
+
width: $container-padding;
|
89
|
+
}
|
90
|
+
form {
|
91
|
+
padding: ( $container-padding / 2 ) ($container-padding / 4);
|
92
|
+
margin: 0;
|
93
|
+
p {
|
94
|
+
margin: 0 0 $unit 0;
|
95
|
+
}
|
96
|
+
label {
|
97
|
+
@include field-name;
|
98
|
+
}
|
99
|
+
.value {
|
100
|
+
@include field-value;
|
101
|
+
position: relative;
|
102
|
+
.error {
|
103
|
+
@include rounded;
|
104
|
+
@include box-sizing;
|
105
|
+
@include button-color(rgba(255, 0, 0, 0.8), rgba(255, 0, 0, 0.8));
|
106
|
+
@include input-font;
|
107
|
+
margin: 0;
|
108
|
+
border: 0;
|
109
|
+
padding: 0;
|
110
|
+
display: table;
|
111
|
+
font-weight: bold;
|
112
|
+
position: absolute;
|
113
|
+
right: -3px;
|
114
|
+
top: 0;
|
115
|
+
height: 31px;
|
116
|
+
width: 25%;
|
117
|
+
color:#fff;
|
118
|
+
span {
|
119
|
+
display: table-cell;
|
120
|
+
padding-left: $unit;
|
121
|
+
vertical-align: middle;
|
122
|
+
}
|
123
|
+
}
|
124
|
+
}
|
125
|
+
|
126
|
+
input[type="text"], input[type="email"] {
|
127
|
+
@include text-input;
|
128
|
+
}
|
129
|
+
.focus {
|
130
|
+
label {
|
131
|
+
background-color: $editing-focus;
|
132
|
+
color: white;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
.admin {
|
136
|
+
@include display-box;
|
137
|
+
@include box-orient(horizontal);
|
138
|
+
@include box-align(stretch);
|
139
|
+
margin-bottom: $container-padding / 2;
|
140
|
+
p {
|
141
|
+
width: 30%;
|
142
|
+
margin: 0;
|
143
|
+
}
|
144
|
+
.log-out {
|
145
|
+
display: block;
|
146
|
+
background: $editing-focus;
|
147
|
+
box-shadow: none;
|
148
|
+
|
149
|
+
&:active {
|
150
|
+
@include button-color($editing-focus, $editing-focus);
|
151
|
+
}
|
152
|
+
|
153
|
+
&.complete,
|
154
|
+
&.complete:hover {
|
155
|
+
@include button-color($editing-blur, $editing-blur);
|
156
|
+
}
|
157
|
+
|
158
|
+
&:before {
|
159
|
+
@include awesome-icon("\f08b ");
|
160
|
+
margin-right: $unit/2;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
.enabled {
|
164
|
+
label {
|
165
|
+
@include rounded;
|
166
|
+
background-color: $editing-focus;
|
167
|
+
height: 17px;
|
168
|
+
position: relative;
|
169
|
+
input {
|
170
|
+
margin: 0;
|
171
|
+
padding: 0;
|
172
|
+
position: absolute;
|
173
|
+
right: $unit;
|
174
|
+
top: 3px;
|
175
|
+
}
|
176
|
+
}
|
177
|
+
}
|
178
|
+
}
|
179
|
+
.save {
|
180
|
+
@include display-box;
|
181
|
+
@include box-orient(horizontal);
|
182
|
+
@include box-align(stretch);
|
183
|
+
margin-top: ($container-padding / 2);
|
184
|
+
.button {
|
185
|
+
@include button-color($highlight, $action);
|
186
|
+
display: block;
|
187
|
+
width: 30%;
|
188
|
+
}
|
189
|
+
.cancel {
|
190
|
+
@include button-color($editing-blur, $action);
|
191
|
+
}
|
192
|
+
}
|
193
|
+
.level-select {
|
194
|
+
@include input-font;
|
195
|
+
@include no-select;
|
196
|
+
position: relative;
|
197
|
+
height: 20px;
|
198
|
+
cursor: pointer;
|
199
|
+
font-weight: bold;
|
200
|
+
z-index: 100;
|
201
|
+
.select {
|
202
|
+
@include rounded;
|
203
|
+
cursor: pointer;
|
204
|
+
position: absolute;
|
205
|
+
background-color: opacify($editing-focus, 0.5);
|
206
|
+
width: 300px;
|
207
|
+
padding: $unit/2 0;
|
208
|
+
color: #fff;
|
209
|
+
margin-left: -$unit;
|
210
|
+
margin-top: -$unit/2;
|
211
|
+
z-index: 100;
|
212
|
+
.level {
|
213
|
+
@include display-box;
|
214
|
+
@include box-align(stretch);
|
215
|
+
@include box-orient(horizontal);
|
216
|
+
padding: $unit/2 $unit;
|
217
|
+
// position: relative;
|
218
|
+
span {
|
219
|
+
display: block;
|
220
|
+
width: 25%;
|
221
|
+
}
|
222
|
+
.level-name {
|
223
|
+
@include box-flex;
|
224
|
+
width: auto;
|
225
|
+
}
|
226
|
+
span.true, span.false {
|
227
|
+
margin-left: $unit;
|
228
|
+
font-weight: normal;
|
229
|
+
}
|
230
|
+
|
231
|
+
span.true {
|
232
|
+
color: $editing;
|
233
|
+
}
|
234
|
+
span.true:before {
|
235
|
+
@include awesome-icon("\f00c");
|
236
|
+
width: $unit * 1.5;
|
237
|
+
}
|
238
|
+
span.false {
|
239
|
+
color: rgba(255, 255, 255, 0.4);
|
240
|
+
}
|
241
|
+
span.false:before {
|
242
|
+
@include awesome-icon("\f00d");
|
243
|
+
width: $unit * 1.5;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
.level:hover {
|
247
|
+
background-color: $highlight;
|
248
|
+
color: #000;
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
}
|
253
|
+
}
|
254
|
+
.contents {
|
255
|
+
@include box-flex;
|
256
|
+
overflow: auto;
|
257
|
+
padding: ($container-padding / 4) ($container-padding / 4);
|
258
|
+
.user {
|
259
|
+
@include box-sizing;
|
260
|
+
@include display-box;
|
261
|
+
@include box-align(stretch);
|
262
|
+
@include box-orient(horizontal);
|
263
|
+
@include box-pack(top);
|
264
|
+
@include rounded;
|
265
|
+
|
266
|
+
cursor: pointer;
|
267
|
+
height: $container-padding * 1;
|
268
|
+
padding: ($container-padding / 4);
|
269
|
+
|
270
|
+
& > div {
|
271
|
+
position: relative;
|
272
|
+
top: 2px;
|
273
|
+
}
|
274
|
+
.name {
|
275
|
+
color: $highlight;
|
276
|
+
width: 40%;
|
277
|
+
// font-weight: bold;
|
278
|
+
}
|
279
|
+
.level {
|
280
|
+
@include box-flex;
|
281
|
+
color: rgba(255, 255, 255, 0.5);
|
282
|
+
}
|
283
|
+
.delete {
|
284
|
+
width: 50px;
|
285
|
+
text-align: right;
|
286
|
+
&:after {
|
287
|
+
@include awesome-icon("\f014");
|
288
|
+
font-size: 1.5em;
|
289
|
+
position: relative;
|
290
|
+
top: 1px;
|
291
|
+
text-align: right;
|
292
|
+
color: rgba(255, 255, 255, 0.3);
|
293
|
+
}
|
294
|
+
&:hover:after {
|
295
|
+
color: $highlight;
|
296
|
+
}
|
297
|
+
}
|
298
|
+
}
|
299
|
+
.user.disabled {
|
300
|
+
.name {
|
301
|
+
// text-decoration: line-through;
|
302
|
+
}
|
303
|
+
.name:after {
|
304
|
+
content: "(disabled)";
|
305
|
+
color: rgba(255, 255, 255, 0.5);
|
306
|
+
margin-left: $unit;
|
307
|
+
// text-decoration: line-through;
|
308
|
+
}
|
309
|
+
}
|
310
|
+
.user:hover {
|
311
|
+
background-color: rgba(0, 0, 0, 0.5);
|
312
|
+
.name {
|
313
|
+
|
314
|
+
}
|
315
|
+
}
|
316
|
+
}
|
317
|
+
.add-user {
|
318
|
+
@include rounded-bottom;
|
319
|
+
height: $container-padding;
|
320
|
+
background-color: rgba(0, 0, 0, 0.2);
|
321
|
+
position: relative;
|
322
|
+
|
323
|
+
.add {
|
324
|
+
@include button-color($highlight, $action);
|
325
|
+
position: absolute;
|
326
|
+
right: $container-padding / 2;
|
327
|
+
width: 20%;
|
328
|
+
top: ($container-padding / 4) + 4;
|
329
|
+
}
|
330
|
+
}
|
331
|
+
}
|
@@ -1,3 +1,4 @@
|
|
1
|
+
@import "definitions.css.scss";
|
1
2
|
.pop-over {
|
2
3
|
$popover-border-radius: 4px;
|
3
4
|
display: inline-block;
|
@@ -25,8 +26,8 @@
|
|
25
26
|
// height: 22px;
|
26
27
|
}
|
27
28
|
& > header > h3 {
|
28
|
-
@
|
29
|
-
@
|
29
|
+
@include interface;
|
30
|
+
@include box-flex(1);
|
30
31
|
text-transform: none;
|
31
32
|
margin: 0px;
|
32
33
|
margin-bottom: 0;
|
@@ -109,7 +110,7 @@
|
|
109
110
|
}
|
110
111
|
.menuHandle {
|
111
112
|
position: absolute;
|
112
|
-
top: -
|
113
|
+
top: -8px;
|
113
114
|
left: 8px;
|
114
115
|
height: 30px !important;
|
115
116
|
width: 30px;
|
@@ -186,7 +187,7 @@
|
|
186
187
|
|
187
188
|
}
|
188
189
|
label {
|
189
|
-
@
|
190
|
+
@include interface;
|
190
191
|
@include rounded;
|
191
192
|
display: block;
|
192
193
|
background-color: $chrome-accent;
|
@@ -229,7 +230,7 @@
|
|
229
230
|
.page {
|
230
231
|
cursor: pointer;
|
231
232
|
color: #333;
|
232
|
-
@
|
233
|
+
@include interface;
|
233
234
|
text-transform: none;
|
234
235
|
padding: $unit/2 $unit/2;
|
235
236
|
padding-right: $deeper-width;
|
@@ -266,7 +267,7 @@
|
|
266
267
|
font-weight: normal;
|
267
268
|
width: $deeper-width;
|
268
269
|
margin: 2px;
|
269
|
-
background: url("/@spontaneous/static/page-browser-next.png") right 1px no-repeat;
|
270
|
+
background: url("/@spontaneous/static/page-browser-next-ce781a242c23b980b99b9db7abc20b05.png") right 1px no-repeat;
|
270
271
|
&:hover {
|
271
272
|
background-position: right -39px;
|
272
273
|
background-color: #8d8d8d;
|
@@ -290,7 +291,7 @@
|
|
290
291
|
|
291
292
|
padding: $unit/2;
|
292
293
|
li {
|
293
|
-
@
|
294
|
+
@include interface;
|
294
295
|
font-size: 10px;
|
295
296
|
text-transform: none;
|
296
297
|
cursor: pointer;
|
@@ -328,7 +329,7 @@
|
|
328
329
|
display: block;
|
329
330
|
}
|
330
331
|
a {
|
331
|
-
@
|
332
|
+
@include box-flex(1);
|
332
333
|
max-width: 100px
|
333
334
|
}
|
334
335
|
}
|
@@ -1,12 +1,12 @@
|
|
1
|
-
@import "definitions";
|
1
|
+
@import "definitions.css.scss";
|
2
2
|
|
3
|
-
body {
|
4
|
-
|
3
|
+
body#schema-error {
|
4
|
+
@extend .meta-background;
|
5
5
|
color: #fff;
|
6
6
|
font-size: 16px;
|
7
7
|
}
|
8
8
|
|
9
|
-
#container {
|
9
|
+
#schema-error #container {
|
10
10
|
@include rounded;
|
11
11
|
background-color: rgba(0, 0, 0, 0.2);
|
12
12
|
width: 700px;
|
@@ -0,0 +1,42 @@
|
|
1
|
+
@import "definitions.css.scss";
|
2
|
+
|
3
|
+
#outer {
|
4
|
+
width: 600px;
|
5
|
+
margin: 0 auto;
|
6
|
+
font-family: $content-font-family;
|
7
|
+
font-size: 14px;
|
8
|
+
color: #666;
|
9
|
+
padding-top: 5 * $unit;
|
10
|
+
|
11
|
+
a {
|
12
|
+
color: $action;
|
13
|
+
&:hover {
|
14
|
+
color: $highlight;
|
15
|
+
}
|
16
|
+
}
|
17
|
+
img {
|
18
|
+
border: 0;
|
19
|
+
}
|
20
|
+
.error {
|
21
|
+
margin: 2*$unit 0;
|
22
|
+
padding: 0;
|
23
|
+
color: $highlight;
|
24
|
+
.feature {
|
25
|
+
font-weight: bold;
|
26
|
+
}
|
27
|
+
.user-agent {
|
28
|
+
font-size: 0.9em;
|
29
|
+
}
|
30
|
+
}
|
31
|
+
h1 {
|
32
|
+
@include header;
|
33
|
+
color: #666;
|
34
|
+
}
|
35
|
+
h2 {
|
36
|
+
@include header;
|
37
|
+
}
|
38
|
+
.chrome {
|
39
|
+
margin-top: 4*$unit;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
|
@@ -39,29 +39,91 @@ Spontaneous.AddAliasDialogue = (function($, S) {
|
|
39
39
|
return this.box_view.box;
|
40
40
|
},
|
41
41
|
body: function() {
|
42
|
-
var
|
43
|
-
|
42
|
+
var self = this
|
43
|
+
, editing = dom.div('#add-alias-dialogue')
|
44
|
+
, outer = dom.div('.typelist')
|
45
|
+
, paging = dom.div(".paging")
|
46
|
+
, search = dom.div(".search")
|
47
|
+
, progress = dom.div(".progress")
|
44
48
|
, instructions = dom.p('.instructions')
|
45
|
-
, __dialogue = this
|
49
|
+
, __dialogue = this
|
50
|
+
, timeout = null
|
51
|
+
, searchDelay = 200
|
52
|
+
, clearTimeout = function() {
|
53
|
+
if (timeout) { window.clearTimeout(timeout); timeout = null; }
|
54
|
+
}
|
55
|
+
, load_targets = function(query) {
|
56
|
+
clearTimeout();
|
57
|
+
var params = {};
|
58
|
+
if (query !== "") {
|
59
|
+
params["query"] = query;
|
60
|
+
}
|
61
|
+
|
62
|
+
self.spinner.start();
|
63
|
+
Spontaneous.Ajax.get(['/targets', self.type.schema_id, self.box().id()].join('/'), params, self.targets_loaded.bind(self));
|
64
|
+
}
|
65
|
+
, input = dom.input({"type":"search", "placeholder":"Search..."}).keydown(function(event) {
|
66
|
+
if (event.keyCode === 13) {
|
67
|
+
load_targets(input.val());
|
68
|
+
}
|
69
|
+
if (event.keyCode === 27) {
|
70
|
+
if (input.val() === "") {
|
71
|
+
return true;
|
72
|
+
}
|
73
|
+
input.val("");
|
74
|
+
load_targets();
|
75
|
+
return false;
|
76
|
+
}
|
77
|
+
}).keyup(function() {
|
78
|
+
clearTimeout();
|
79
|
+
var val = input.val();
|
80
|
+
if (val === "" || val.length > 1) {
|
81
|
+
timeout = window.setTimeout(function() {
|
82
|
+
load_targets(val);
|
83
|
+
}, searchDelay);
|
84
|
+
}
|
85
|
+
})
|
46
86
|
instructions.html("Choose a target:");
|
47
|
-
|
48
|
-
|
87
|
+
|
88
|
+
search.append(input)
|
89
|
+
paging.append(progress, search)
|
90
|
+
this.spinner = S.Progress(progress[0], 16);
|
91
|
+
editing.append(paging, outer);
|
92
|
+
load_targets();
|
93
|
+
this.paging = paging;
|
49
94
|
this._outer = outer;
|
50
95
|
return editing;
|
51
96
|
},
|
52
97
|
|
53
|
-
targets_loaded: function(
|
54
|
-
var outer = this._outer, __dialogue = this;
|
55
|
-
|
98
|
+
targets_loaded: function(results) {
|
99
|
+
var outer = this._outer, wrap, self = __dialogue = this, targets = results.targets;
|
100
|
+
window.setTimeout(function() { self.spinner.stop() }, 300);
|
101
|
+
this.targets = this.sort_targets(targets);
|
102
|
+
outer.empty();
|
103
|
+
wrap = dom.div();
|
56
104
|
$.each(targets, function(i, target) {
|
57
105
|
var d = dom.div('.type').html(target.title).click(function() {
|
58
106
|
$('.type', outer).removeClass('selected');
|
59
107
|
__dialogue.select_target(target);
|
60
108
|
$(this).addClass('selected');;
|
61
109
|
});
|
62
|
-
|
110
|
+
wrap.append(d)
|
63
111
|
});
|
64
|
-
|
112
|
+
outer.append(wrap)
|
113
|
+
this._contents = wrap;
|
114
|
+
this.manager.updateLayout();
|
115
|
+
},
|
116
|
+
contentsHeight: function() {
|
117
|
+
return this.paging.outerHeight() + this._contents.outerHeight();
|
118
|
+
},
|
119
|
+
sort_targets: function(targets) {
|
120
|
+
var comparator = function(a, b) {
|
121
|
+
var at = a.title, bt = b.title;
|
122
|
+
if (at > bt) { return 1; }
|
123
|
+
if (at < bt) { return -1; }
|
124
|
+
return 0;
|
125
|
+
}
|
126
|
+
return targets.sort(comparator);
|
65
127
|
}
|
66
128
|
});
|
67
129
|
return AddAliasDialogue;
|
data/application/js/ajax.js
CHANGED
@@ -7,43 +7,77 @@ Spontaneous.Ajax = (function($, S) {
|
|
7
7
|
'dataType': 'json',
|
8
8
|
'ifModified': true
|
9
9
|
});
|
10
|
+
// wraps jQuery.ajax with a auth aware error catcher
|
11
|
+
var __request = function(params) {
|
12
|
+
var requestErrorHandler = params["error"]
|
13
|
+
, errorHandler = function(xhr, textStatus, error_thrown) {
|
14
|
+
console.log('caught http error', xhr, textStatus, error_thrown)
|
15
|
+
if (xhr.status === 401) {
|
16
|
+
S.Ajax.unauthorized();
|
17
|
+
} else if (requestErrorHandler) {
|
18
|
+
requestErrorHandler(xhr, textStatus, error_thrown);
|
19
|
+
}
|
20
|
+
};
|
21
|
+
params["error"] = errorHandler;
|
22
|
+
$.ajax(params);
|
23
|
+
};
|
10
24
|
return {
|
11
25
|
namespace: "/@spontaneous",
|
12
|
-
|
26
|
+
|
27
|
+
get: function(url, data, callback) {
|
28
|
+
if (typeof data === "function") {
|
29
|
+
callback = data;
|
30
|
+
data = {};
|
31
|
+
}
|
13
32
|
var handle_response = function(data, textStatus, xhr) {
|
14
|
-
if (textStatus !== 'success') {
|
15
|
-
xhr = data;
|
16
|
-
data = {};
|
17
|
-
}
|
18
33
|
callback(data, textStatus, xhr);
|
19
34
|
};
|
20
|
-
|
35
|
+
__request({
|
21
36
|
'url': this.request_url(url),
|
22
37
|
'success': handle_response,
|
23
|
-
'
|
38
|
+
'ifModified': true,
|
39
|
+
'data': $.extend(data, this.api_access_key()),
|
24
40
|
'error': handle_response // pass the error to the handler too
|
25
41
|
});
|
26
42
|
},
|
27
|
-
|
43
|
+
put: function(url, data, callback) {
|
44
|
+
this.makeRequest("PUT", url, data, callback);
|
45
|
+
},
|
46
|
+
del: function(url, data, callback) {
|
47
|
+
this.makeRequest("DELETE", url, data, callback);
|
48
|
+
},
|
49
|
+
post: function(url, data, callback) {
|
50
|
+
this.makeRequest("POST", url, data, callback);
|
51
|
+
},
|
52
|
+
makeRequest: function(method, url, data, callback) {
|
28
53
|
var success = function(data, textStatus, XMLHttpRequest) {
|
29
|
-
|
54
|
+
if (typeof callback === "function") {
|
55
|
+
callback(data, textStatus, XMLHttpRequest);
|
56
|
+
}
|
30
57
|
};
|
31
58
|
var error = function(XMLHttpRequest, textStatus, error_thrown) {
|
32
|
-
var
|
59
|
+
var result = false;
|
33
60
|
try {
|
34
|
-
|
61
|
+
result = $.parseJSON(XMLHttpRequest.responseText);
|
35
62
|
} catch (e) { }
|
36
|
-
|
63
|
+
if (typeof callback === "function") {
|
64
|
+
callback(result, textStatus, XMLHttpRequest);
|
65
|
+
}
|
37
66
|
};
|
38
|
-
|
39
|
-
$.
|
67
|
+
data = data || {};
|
68
|
+
data = $.extend(data, this.api_access_key());
|
69
|
+
__request({
|
40
70
|
'url': this.request_url(url, true),
|
41
|
-
'type':
|
42
|
-
'data':
|
71
|
+
'type': method,
|
72
|
+
'data': data,
|
43
73
|
'success': success,
|
44
74
|
'error': error
|
45
75
|
});
|
46
76
|
},
|
77
|
+
unauthorized: function() {
|
78
|
+
console.log("UNAUTH!")
|
79
|
+
window.location.href = "/";
|
80
|
+
},
|
47
81
|
test_field_versions: function(target, fields, success, failure) {
|
48
82
|
var version_data = {}, modified = 0;
|
49
83
|
for (var i = 0, ii = fields.length; i < ii; i++) {
|