wagn 1.12.13 → 1.13.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.gitignore +7 -8
- data/.rspec +1 -1
- data/.simplecov +23 -0
- data/.tm_properties +1 -0
- data/Gemfile +15 -13
- data/Guardfile +34 -0
- data/README.rdoc +4 -10
- data/VERSION +1 -1
- data/app/assets/images/smoothness/animated-overlay.gif +0 -0
- data/app/assets/images/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/images/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/images/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/app/assets/images/smoothness/ui-icons_222222_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_454545_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_888888_256x240.png +0 -0
- data/app/assets/images/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/javascripts/application.js +9 -8
- data/app/assets/javascripts/jquery.ui.autocomplete.html.js +1 -1
- data/app/controllers/card_controller.rb +190 -23
- data/config/environments/development.rb +17 -12
- data/config/initializers/01_init_ruby_extensions.rb +1 -70
- data/config/routes.rb +21 -8
- data/config/version_cards.txt +1 -1
- data/db/bootstrap/card_references.yml +520 -352
- data/db/bootstrap/card_revisions.yml +1818 -1887
- data/db/bootstrap/cards.yml +2279 -1310
- data/db/migrate_cards/20130411191151_renaming_for_menu.rb +0 -5
- data/db/migrate_cards/20130411211600_delete_old_related_tab_cards.rb +0 -6
- data/db/migrate_cards/20130419215612_import_help_text.rb +0 -7
- data/db/migrate_cards/20130823192433_add_style_cards.rb +2 -6
- data/db/migrate_cards/20130910183318_move_styles_to_content.rb +0 -5
- data/db/migrate_cards/20130920214038_jsonize_tinymce.rb +0 -6
- data/db/migrate_cards/20130920291703_update_stylesheets.rb +0 -5
- data/db/migrate_cards/20130927191728_account_events.rb +1 -6
- data/db/migrate_cards/20131016172445_common_css_patch.rb +0 -6
- data/db/migrate_cards/20140110193325_reset_account_request_type.rb +1 -6
- data/db/migrate_cards/20140307231621_user_data_to_cards.rb +78 -0
- data/db/migrate_cards/20140317035504_account_requests_to_signups.rb +45 -0
- data/db/migrate_cards/20140512155840_add_script_cards.rb +85 -0
- data/db/migrate_cards/data/1.12_stylesheets/common.scss +1 -1
- data/features/autonaming.feature +3 -3
- data/features/flexmail.feature +2 -2
- data/features/layouts.feature +1 -1
- data/features/navbox.feature +17 -0
- data/features/notifications.feature +4 -4
- data/features/pointer_inputs.feature +2 -2
- data/features/presetting_content.feature +1 -1
- data/features/reset_password.feature +34 -0
- data/features/{pattern_settings.feature → rules.feature} +7 -7
- data/features/setup.feature +32 -0
- data/features/signup.feature +47 -0
- data/features/step_definitions/email_steps.rb +24 -1
- data/features/step_definitions/wagn_steps.rb +66 -31
- data/features/step_definitions/web_steps.rb +1 -0
- data/features/{content_settings.feature → structure.feature} +3 -6
- data/features/support/env.rb +3 -0
- data/features/support/paths.rb +2 -2
- data/features/support/{wag_env.rb → wagn_env.rb} +1 -1
- data/features/table_of_contents.feature +1 -1
- data/features/update_includers.feature +3 -3
- data/features/watch.feature +2 -2
- data/lib/card.rb +12 -10
- data/lib/{active_record/quoting_and_matching.rb → card/active_record_ext.rb} +25 -20
- data/lib/card/auth.rb +205 -0
- data/lib/card/chunk.rb +70 -69
- data/lib/card/content.rb +1 -1
- data/lib/card/core_ext.rb +74 -0
- data/lib/card/env.rb +66 -0
- data/lib/card/flexmail.rb +43 -37
- data/lib/card/format.rb +42 -29
- data/lib/{generators → card/generators}/card_migration/USAGE +0 -0
- data/lib/{generators → card/generators}/card_migration/card_migration_generator.rb +0 -0
- data/lib/{generators → card/generators}/card_migration/templates/card_migration.erb +0 -6
- data/lib/{generators → card/generators}/format/USAGE +0 -0
- data/lib/{generators → card/generators}/format/format_generator.rb +0 -0
- data/lib/{generators → card/generators}/format/templates/format_spec_template.erb +1 -2
- data/lib/{generators → card/generators}/format/templates/format_template.erb +0 -0
- data/lib/{generators → card/generators}/set/USAGE +0 -0
- data/lib/{generators → card/generators}/set/set_generator.rb +0 -0
- data/lib/{generators → card/generators}/set/templates/set_spec_template.erb +1 -2
- data/lib/card/generators/set/templates/set_template.erb +1 -0
- data/lib/card/loader.rb +145 -0
- data/lib/card/mailer.rb +117 -0
- data/{app/views → lib/card}/mailer/change_notice.html.erb +2 -2
- data/lib/card/mailer/confirmation_email.html.erb +8 -0
- data/{app/views → lib/card}/mailer/flexmail.html.erb +0 -0
- data/lib/card/mailer/password_reset.html.erb +9 -0
- data/{app/views → lib/card}/mailer/signup_alert.html.erb +0 -0
- data/lib/card/name.rb +2 -3
- data/lib/card/query.rb +0 -3
- data/lib/card/query/card_spec.rb +4 -4
- data/lib/card/revision.rb +34 -32
- data/lib/card/set.rb +204 -180
- data/lib/card/set_pattern.rb +126 -101
- data/lib/wagn/all.rb +1 -8
- data/lib/wagn/application.rb +14 -7
- data/lib/wagn/commands/application.rb +1 -1
- data/lib/{generators → wagn/generators}/wagn/USAGE +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/Gemfile +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/Rakefile +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config.ru +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/application.rb +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/boot.rb +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/database.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/frontbase.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/ibm_db.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/jdbc.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/jdbcmysql.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/jdbcpostgresql.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/jdbcsqlite3.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/mysql.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/oracle.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/postgresql.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/databases/sqlite3.yml +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/config/environment.rb +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/gitignore +0 -0
- data/lib/wagn/generators/wagn/templates/public/files/htaccess +9 -0
- data/{public → lib/wagn/generators/wagn/templates/public}/robots.txt +0 -0
- data/lib/{generators → wagn/generators}/wagn/templates/script/wagn +0 -0
- data/lib/{generators → wagn/generators}/wagn/wagn_generator.rb +12 -0
- data/lib/wagn/location.rb +7 -11
- data/lib/wagn/migration_helper.rb +4 -1
- data/{app/mailers → lib/wagn/tasks}/.gitkeep +0 -0
- data/lib/{tasks → wagn/tasks}/cucumber.rake +0 -0
- data/lib/{tasks → wagn/tasks}/db.rake +0 -0
- data/lib/{tasks → wagn/tasks}/test.rake +5 -2
- data/lib/{tasks → wagn/tasks}/wagn.rake +29 -12
- data/mods/{standard → core}/chunks/include.rb +2 -0
- data/mods/{standard → core}/chunks/link.rb +3 -0
- data/mods/core/formats/html_format.rb +27 -35
- data/mods/core/sets/all/active_card.rb +15 -3
- data/mods/core/sets/all/attribute_tracking.rb +1 -1
- data/mods/core/sets/all/collection.rb +4 -5
- data/mods/core/sets/all/fetch.rb +98 -80
- data/mods/core/sets/all/initialize.rb +2 -0
- data/mods/core/sets/all/name.rb +13 -12
- data/mods/core/sets/all/pattern.rb +0 -9
- data/mods/core/sets/all/permissions.rb +56 -31
- data/mods/core/sets/all/phases.rb +63 -84
- data/mods/core/sets/all/references.rb +0 -1
- data/mods/core/sets/all/rules.rb +3 -4
- data/mods/core/sets/all/templating.rb +2 -3
- data/mods/core/sets/all/tracked_attributes.rb +26 -9
- data/mods/core/sets/all/trash.rb +1 -2
- data/mods/core/sets/all/type.rb +6 -1
- data/mods/core/sets/all/utils.rb +2 -3
- data/mods/standard/files/103/icon-6566.ico +0 -0
- data/mods/standard/files/103/large-6566.ico +0 -0
- data/mods/standard/files/103/medium-6566.ico +0 -0
- data/{public/favicon.ico → mods/standard/files/103/original-6566.ico} +0 -0
- data/mods/standard/files/103/small-6566.ico +0 -0
- data/mods/standard/files/79/icon-6556.png +0 -0
- data/mods/standard/files/79/large-6556.png +0 -0
- data/mods/standard/files/79/medium-6556.png +0 -0
- data/mods/standard/files/79/original-6556.png +0 -0
- data/mods/standard/files/79/small-6556.png +0 -0
- data/mods/standard/files/790/icon-6419.png +0 -0
- data/mods/standard/files/790/large-6419.png +0 -0
- data/mods/standard/files/790/medium-6419.png +0 -0
- data/mods/standard/files/790/original-6419.png +0 -0
- data/mods/standard/files/790/small-6419.png +0 -0
- data/mods/standard/lib/card/machine.rb +152 -0
- data/mods/standard/lib/card/machine_input.rb +40 -0
- data/{public/assets → mods/standard/lib/javascript}/html5shiv-printshiv.js +0 -0
- data/mods/standard/lib/javascript/jquery-ui.js +14913 -0
- data/mods/standard/lib/javascript/jquery.autosize.js +255 -0
- data/mods/standard/lib/javascript/jquery.fileupload.js +1112 -0
- data/mods/standard/lib/javascript/jquery.iframe-transport.js +157 -0
- data/mods/standard/lib/javascript/jquery.js +9473 -0
- data/mods/standard/lib/javascript/jquery.ui.autocomplete.html.js +41 -0
- data/mods/standard/lib/javascript/jquery_ujs.js +429 -0
- data/mods/standard/lib/javascript/jquerymobile.js +8800 -0
- data/mods/standard/lib/javascript/tinymce.js +13 -0
- data/{app/assets/javascripts → mods/standard/lib/javascript}/wagn.js.coffee +10 -0
- data/{app/assets/javascripts → mods/standard/lib/javascript}/wagn_menu.js +3 -12
- data/{app/assets/javascripts → mods/standard/lib/javascript}/wagn_mod.js.coffee +18 -11
- data/mods/standard/lib/stylesheets/functional.scss +13 -9
- data/mods/standard/lib/stylesheets/jquery-ui-smoothness.css +922 -218
- data/mods/standard/lib/stylesheets/standard.scss +2 -2
- data/mods/standard/sets/all/account.rb +18 -205
- data/mods/standard/sets/all/all_css.rb +2 -3
- data/mods/standard/sets/all/all_csv.rb +0 -1
- data/mods/standard/sets/all/attach.rb +0 -1
- data/mods/standard/sets/all/base.rb +9 -7
- data/mods/standard/sets/all/comment.rb +5 -5
- data/mods/standard/sets/all/email_html.rb +0 -2
- data/mods/standard/sets/all/event_viz.rb +62 -0
- data/mods/standard/sets/all/file.rb +0 -1
- data/mods/standard/sets/all/follow.rb +13 -11
- data/mods/standard/sets/all/history.rb +2 -7
- data/mods/standard/sets/all/json.rb +6 -11
- data/mods/standard/sets/all/rich_html.rb +68 -52
- data/mods/standard/sets/all/rss.rb +4 -5
- data/mods/standard/sets/all/text.rb +0 -1
- data/mods/standard/sets/right/account.rb +100 -1
- data/mods/standard/sets/right/create.rb +8 -2
- data/mods/standard/sets/right/delete.rb +2 -0
- data/mods/standard/sets/right/email.rb +50 -2
- data/mods/standard/sets/right/machine_output.rb +12 -0
- data/mods/standard/sets/right/password.rb +39 -0
- data/mods/standard/sets/right/read.rb +2 -0
- data/mods/standard/sets/right/salt.rb +2 -1
- data/mods/standard/sets/right/script.rb +10 -0
- data/mods/standard/sets/right/stats.rb +35 -0
- data/mods/standard/sets/right/status.rb +9 -0
- data/mods/standard/sets/right/style.rb +7 -53
- data/mods/standard/sets/right/{crypted_password.rb → token.rb} +2 -1
- data/mods/standard/sets/right/update.rb +2 -0
- data/mods/standard/sets/rstar/rules.rb +7 -3
- data/mods/standard/sets/self/account_links.rb +16 -23
- data/mods/standard/sets/self/alerts.rb +0 -1
- data/mods/standard/sets/self/all.rb +21 -0
- data/mods/standard/sets/self/foot.rb +0 -1
- data/mods/standard/sets/self/head.rb +21 -24
- data/mods/standard/sets/self/navbox.rb +0 -1
- data/mods/standard/sets/self/now.rb +0 -1
- data/mods/standard/sets/self/recent.rb +38 -35
- data/mods/standard/sets/self/script_card_menu.rb +8 -0
- data/mods/standard/sets/self/script_html5shiv_printshiv.rb +7 -0
- data/mods/standard/sets/self/script_jquery.rb +8 -0
- data/mods/standard/sets/self/script_jquery_helper.rb +13 -0
- data/mods/standard/sets/self/script_slot.rb +9 -0
- data/mods/standard/sets/self/script_tinymce.rb +8 -0
- data/mods/standard/sets/self/search.rb +0 -1
- data/mods/standard/sets/self/signin.rb +111 -0
- data/mods/standard/sets/self/stats.rb +91 -0
- data/mods/standard/sets/self/style_functional.rb +1 -1
- data/mods/standard/sets/self/style_jquery_ui_smoothness.rb +1 -1
- data/mods/standard/sets/self/style_standard.rb +1 -1
- data/mods/standard/sets/type/basic.rb +15 -14
- data/mods/standard/sets/type/cardtype.rb +2 -3
- data/mods/standard/sets/type/coffee_script.rb +46 -0
- data/mods/standard/sets/type/css.rb +16 -5
- data/mods/standard/sets/type/date.rb +0 -1
- data/mods/standard/sets/type/file.rb +0 -2
- data/mods/standard/sets/type/html.rb +0 -1
- data/mods/standard/sets/type/image.rb +1 -2
- data/mods/standard/sets/type/java_script.rb +32 -0
- data/mods/standard/sets/type/layout_type.rb +1 -1
- data/mods/standard/sets/type/number.rb +0 -1
- data/mods/standard/sets/type/pointer.rb +13 -8
- data/mods/standard/sets/type/scss.rb +17 -3
- data/mods/standard/sets/type/search_type.rb +36 -34
- data/mods/standard/sets/type/set.rb +1 -5
- data/mods/standard/sets/type/setting.rb +1 -2
- data/mods/standard/sets/type/signup.rb +92 -0
- data/mods/standard/sets/type/skin.rb +4 -5
- data/mods/standard/sets/type/toggle.rb +1 -1
- data/mods/standard/sets/type/user.rb +51 -4
- data/public/{404.html → assets/jasmine/404.html} +0 -0
- data/public/{500.html → assets/jasmine/500.html} +0 -0
- data/public/{jasmine → assets/jasmine}/card_form.html +0 -0
- data/public/assets/jquery-ui/animated-overlay-602eee4c79a4796b02bb6442948c9e28.gif +0 -0
- data/public/assets/jquery-ui/animated-overlay.gif +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_flat_0_aaaaaa_40x100-7d1197a52442bc56fcad60d0390f4b32.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_flat_75_ffffff_40x100-3c4b974defa5e8bdaf8a603034c4435e.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_55_fbf9ee_1x400-38c2dea4d046fd3f56cc3996e2e6018b.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_65_ffffff_1x400-ddb7ee7527bff283054406c50e597e1e.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_75_dadada_1x400-d618461418b1ebc6b7996979f4c3dc92.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_75_e6e6e6_1x400-48d8d545f708e5870a965ce9df8b0e38.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_glass_95_fef1ec_1x400-f3526b8f82249928f0a6baf044204b15.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-bg_highlight-soft_75_cccccc_1x100-cec5c56503b8480f834c3fce35dae8df.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/{app/assets/images/images/ui-icons_2e83ff_256x240.png → public/assets/jquery-ui/ui-icons_222222_256x240-b1eb177a51ea7925448318a26d988842.png} +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-icons_222222_256x240.png +0 -0
- data/{app/assets/images/images/ui-icons_454545_256x240.png → public/assets/jquery-ui/ui-icons_2e83ff_256x240-49c2da9cac2dc565265586f716491298.png} +0 -0
- data/public/assets/{images → jquery-ui}/ui-icons_2e83ff_256x240.png +0 -0
- data/{app/assets/images/images/ui-icons_888888_256x240.png → public/assets/jquery-ui/ui-icons_454545_256x240-68b2fe3268f7604fb0767a0372e2db85.png} +0 -0
- data/public/assets/{images → jquery-ui}/ui-icons_454545_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_888888_256x240-8040cfcc88792375b7788feb59189eef.png +0 -0
- data/public/assets/{images → jquery-ui}/ui-icons_888888_256x240.png +0 -0
- data/public/assets/jquery-ui/ui-icons_cd0a0a_256x240-d4a62216bf6f0cd0071149890763a5ff.png +0 -0
- data/{app/assets/images/images → public/assets/jquery-ui}/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/assets/jquery.min-388372ef65cc311f6a3df4a6ceac8d22.map +1 -0
- data/public/assets/jquery.min.map +1 -1
- data/public/assets/manifest.yml +61 -31
- data/public/assets/smoothness/animated-overlay-602eee4c79a4796b02bb6442948c9e28.gif +0 -0
- data/public/assets/smoothness/animated-overlay.gif +0 -0
- data/public/assets/smoothness/ui-bg_flat_0_aaaaaa_40x100-31613497e63975a54520b7065b125dea.png +0 -0
- data/public/assets/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/assets/smoothness/ui-bg_flat_75_ffffff_40x100-f4b0e20e6f4c83b9f52cf062ed0f5284.png +0 -0
- data/public/assets/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_55_fbf9ee_1x400-e3606d6e7ad67486ffdc83edca64d4c5.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_65_ffffff_1x400-dcec96932b90ff4cd4fea91284a6e9a3.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_75_dadada_1x400-a2310f533684ede4f1216d7299b5cd58.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_75_e6e6e6_1x400-d872f3a0a02dea609e4b0321520236d9.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_95_fef1ec_1x400-9ccaed8a65a3c285c16a73bdf03a69b3.png +0 -0
- data/public/assets/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/assets/smoothness/ui-bg_highlight-soft_75_cccccc_1x100-2ef1d227b5c0f33ce3c5e45afa953991.png +0 -0
- data/public/assets/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/assets/smoothness/ui-icons_222222_256x240-0675a996f0bdc78890f7b312c543b06a.png +0 -0
- data/public/assets/smoothness/ui-icons_222222_256x240.png +0 -0
- data/public/assets/smoothness/ui-icons_2e83ff_256x240-6aea736f81a417977efd77f183519a54.png +0 -0
- data/public/assets/smoothness/ui-icons_2e83ff_256x240.png +0 -0
- data/public/assets/smoothness/ui-icons_454545_256x240-6f4361f45745fb0cd7b0cc2851dc1cc3.png +0 -0
- data/public/assets/smoothness/ui-icons_454545_256x240.png +0 -0
- data/public/assets/smoothness/ui-icons_888888_256x240-8f6818bd8631ba3489de718e26c7e6cf.png +0 -0
- data/public/assets/smoothness/ui-icons_888888_256x240.png +0 -0
- data/public/assets/smoothness/ui-icons_cd0a0a_256x240-2969ddba6d0a9c62603a4aa85a363cda.png +0 -0
- data/public/assets/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
- data/spec/controllers/card_controller_spec.rb +77 -61
- data/spec/controllers/location_spec.rb +3 -2
- data/spec/lib/card/auth_spec.rb +17 -0
- data/spec/lib/card/chunk_spec.rb +0 -1
- data/spec/lib/card/codename_spec.rb +12 -18
- data/spec/lib/card/content_spec.rb +0 -1
- data/spec/lib/card/diff_spec.rb +0 -1
- data/spec/lib/card/flexmail_spec.rb +19 -20
- data/spec/lib/card/format_spec.rb +0 -169
- data/spec/lib/{wagn → card}/loader_spec.rb +1 -2
- data/spec/lib/card/name_spec.rb +3 -5
- data/spec/lib/card/query_spec.rb +5 -8
- data/spec/{models → lib}/card/reference_spec.rb +6 -7
- data/spec/lib/card/revision_spec.rb +30 -0
- data/spec/lib/card/set_pattern_spec.rb +0 -1
- data/spec/lib/card/set_spec.rb +9 -9
- data/spec/lib/wagn/cache_spec.rb +0 -1
- data/spec/mailers/mailer_spec.rb +4 -9
- data/spec/models/card/cardtype_spec.rb +12 -14
- data/spec/models/card/create_spec.rb +3 -4
- data/spec/models/card/trash_spec.rb +24 -23
- data/spec/models/card/type_transition_spec.rb +3 -4
- data/spec/models/card/validation_spec.rb +0 -1
- data/spec/models/card_spec.rb +10 -11
- data/spec/mods/core/chunks/literal_spec.rb +0 -1
- data/spec/mods/core/chunks/uri_spec.rb +0 -1
- data/spec/mods/core/formats/data_format_spec.rb +0 -1
- data/spec/mods/core/formats/html_format_spec.rb +17 -18
- data/spec/mods/core/formats/text_format_spec.rb +0 -1
- data/spec/mods/core/sets/all/active_card_spec.rb +1 -2
- data/spec/mods/core/sets/all/attribute_tracking_spec.rb +1 -2
- data/spec/mods/core/sets/all/collection_spec.rb +1 -5
- data/spec/mods/core/sets/all/content_spec.rb +0 -1
- data/spec/mods/core/sets/all/fetch_spec.rb +7 -10
- data/spec/mods/core/sets/all/initialize_spec.rb +0 -1
- data/spec/mods/core/sets/all/name_spec.rb +34 -3
- data/spec/mods/core/sets/all/pattern_spec.rb +6 -9
- data/spec/mods/core/sets/all/permissions_spec.rb +61 -62
- data/spec/mods/core/sets/all/phases_spec.rb +1 -2
- data/spec/mods/core/sets/all/references_spec.rb +0 -1
- data/spec/mods/core/sets/all/rules2_spec.rb +31 -31
- data/spec/mods/core/sets/all/rules_spec.rb +3 -4
- data/spec/mods/core/sets/all/states_spec.rb +1 -2
- data/spec/mods/core/sets/all/templating_spec.rb +11 -12
- data/spec/mods/core/sets/all/tracked_attributes_spec.rb +18 -8
- data/spec/mods/core/sets/all/trash_spec.rb +1 -2
- data/spec/mods/core/sets/all/type_spec.rb +6 -5
- data/spec/mods/core/sets/all/utils_spec.rb +1 -2
- data/spec/mods/standard/chunks/include_spec.rb +14 -15
- data/spec/mods/standard/chunks/link_spec.rb +0 -1
- data/spec/mods/standard/formats/css_format_spec.rb +1 -2
- data/spec/mods/standard/formats/csv_format_spec.rb +0 -1
- data/spec/mods/standard/formats/email_html_format_spec.rb +1 -2
- data/spec/mods/standard/formats/file_format_spec.rb +0 -1
- data/spec/mods/standard/formats/js_format_spec.rb +3 -0
- data/spec/mods/standard/formats/json_format_spec.rb +0 -1
- data/spec/mods/standard/formats/rss_format_spec.rb +1 -2
- data/spec/mods/standard/formats/xml_format_spec.rb +0 -1
- data/spec/mods/standard/lib/machine_input_spec.rb +48 -0
- data/spec/mods/standard/lib/machine_spec.rb +110 -0
- data/spec/mods/standard/sets/all/account_spec.rb +50 -30
- data/spec/mods/standard/sets/all/all_css_spec.rb +0 -1
- data/spec/mods/standard/sets/all/all_csv_spec.rb +0 -1
- data/spec/mods/standard/sets/all/attach_spec.rb +0 -1
- data/spec/mods/standard/sets/all/base_spec.rb +5 -6
- data/spec/mods/standard/sets/all/comment_spec.rb +5 -0
- data/spec/mods/standard/sets/all/email_html_spec.rb +2 -3
- data/spec/mods/standard/sets/all/event_viz_spec.rb +7 -0
- data/spec/mods/standard/sets/all/file_spec.rb +0 -1
- data/spec/mods/standard/sets/all/flexmail_spec.rb +0 -1
- data/spec/mods/standard/sets/all/follow_spec.rb +10 -11
- data/spec/mods/standard/sets/all/history_spec.rb +10 -0
- data/spec/mods/standard/sets/all/json_spec.rb +5 -6
- data/spec/mods/standard/sets/all/rich_html_spec.rb +16 -13
- data/spec/mods/standard/sets/all/rss_spec.rb +4 -2
- data/spec/mods/standard/sets/all/text_spec.rb +1 -2
- data/spec/mods/standard/sets/right/account_spec.rb +86 -2
- data/spec/mods/standard/sets/right/add_help_spec.rb +0 -1
- data/spec/mods/standard/sets/right/comment_spec.rb +37 -2
- data/spec/mods/standard/sets/right/create_spec.rb +6 -2
- data/spec/mods/standard/sets/right/default_spec.rb +0 -1
- data/spec/mods/standard/sets/right/delete_spec.rb +0 -1
- data/spec/mods/standard/sets/right/email_spec.rb +43 -15
- data/spec/mods/standard/sets/right/help_spec.rb +0 -1
- data/spec/mods/standard/sets/right/machine_output_spec.rb +20 -0
- data/spec/mods/standard/sets/right/password_spec.rb +45 -0
- data/spec/mods/standard/sets/right/read_spec.rb +0 -1
- data/spec/mods/standard/sets/right/salt_spec.rb +0 -1
- data/spec/mods/standard/sets/right/script_spec.rb +20 -0
- data/spec/mods/standard/sets/right/stats_spec.rb +13 -0
- data/spec/mods/standard/sets/right/status_spec.rb +5 -0
- data/spec/mods/standard/sets/right/structure_spec.rb +2 -3
- data/spec/mods/standard/sets/right/style_spec.rb +19 -2
- data/spec/mods/standard/sets/right/token_spec.rb +5 -0
- data/spec/mods/standard/sets/right/update_spec.rb +0 -1
- data/spec/mods/standard/sets/right/when_created_spec.rb +0 -1
- data/spec/mods/standard/sets/right/when_last_edited_spec.rb +0 -1
- data/spec/mods/standard/sets/rstar/rules_spec.rb +3 -4
- data/spec/mods/standard/sets/self/account_links_spec.rb +0 -1
- data/spec/mods/standard/sets/self/alerts_spec.rb +0 -1
- data/spec/mods/standard/sets/self/all_spec.rb +47 -0
- data/spec/mods/standard/sets/self/foot_spec.rb +0 -1
- data/spec/mods/standard/sets/self/head_spec.rb +0 -1
- data/spec/mods/standard/sets/self/navbox_spec.rb +0 -1
- data/spec/mods/standard/sets/self/now_spec.rb +0 -1
- data/spec/mods/standard/sets/self/recent_spec.rb +1 -2
- data/spec/mods/standard/sets/self/search_spec.rb +1 -2
- data/spec/mods/standard/sets/self/signin_spec.rb +73 -0
- data/spec/mods/standard/sets/self/stats_spec.rb +12 -0
- data/spec/mods/standard/sets/self/style_functional_spec.rb +1 -2
- data/spec/mods/standard/sets/self/style_jquery_ui_smoothness_spec.rb +1 -2
- data/spec/mods/standard/sets/self/style_standard_spec.rb +1 -2
- data/spec/mods/standard/sets/self/version_spec.rb +0 -1
- data/spec/mods/standard/sets/type/basic_spec.rb +1 -2
- data/spec/mods/standard/sets/type/cardtype_spec.rb +1 -2
- data/spec/mods/standard/sets/type/coffeescript_spec.rb +28 -0
- data/spec/mods/standard/sets/type/css_spec.rb +31 -4
- data/spec/mods/standard/sets/type/date_spec.rb +0 -1
- data/spec/mods/standard/sets/type/file_spec.rb +1 -2
- data/spec/mods/standard/sets/type/html_spec.rb +3 -4
- data/spec/mods/standard/sets/type/image_spec.rb +1 -2
- data/spec/mods/standard/sets/type/javascript_spec.rb +28 -0
- data/spec/mods/standard/sets/type/layout_type_spec.rb +0 -1
- data/spec/mods/standard/sets/type/number_spec.rb +0 -1
- data/spec/mods/standard/sets/type/phrase_spec.rb +0 -1
- data/spec/mods/standard/sets/type/plain_text_spec.rb +0 -1
- data/spec/mods/standard/sets/type/pointer_spec.rb +1 -2
- data/spec/mods/standard/sets/type/scss_spec.rb +47 -2
- data/spec/mods/standard/sets/type/search_type_spec.rb +14 -3
- data/spec/mods/standard/sets/type/set_spec.rb +0 -1
- data/spec/mods/standard/sets/type/setting_spec.rb +6 -2
- data/spec/mods/standard/sets/type/signup_spec.rb +93 -0
- data/spec/mods/standard/sets/type/skin_spec.rb +23 -2
- data/spec/mods/standard/sets/type/toggle_spec.rb +0 -1
- data/spec/mods/standard/sets/type/user_spec.rb +1 -2
- data/{lib/wagn → spec}/spec_helper.rb +59 -14
- data/test/1.10.0-data-dump.sql +327 -0
- data/test/fixtures/card_references.yml +777 -581
- data/test/fixtures/card_revisions.yml +2737 -2488
- data/test/fixtures/cards.yml +4037 -2184
- data/test/performance/card_create_test.rb +1 -1
- data/test/performance/render_test.rb +1 -1
- data/test/seed.rb +36 -63
- data/test/test_helper.rb +1 -1
- data/wagn.gemspec +9 -9
- metadata +257 -237
- data/app/assets/javascripts/html5shiv-printshiv.js +0 -499
- data/app/controllers/account_controller.rb +0 -61
- data/app/controllers/admin_controller.rb +0 -124
- data/app/controllers/stub_card_controller.rb +0 -9
- data/app/controllers/wagn_controller.rb +0 -165
- data/app/mailers/mailer.rb +0 -109
- data/app/models/.gitkeep +0 -0
- data/app/models/account.rb +0 -198
- data/app/models/user.rb +0 -123
- data/app/views/mailer/account_info.text.erb +0 -17
- data/config/initializers/backtrace_silencers.rb +0 -8
- data/config/initializers/schema_views.rb +0 -59
- data/config/initializers/wrap_parameters.rb +0 -15
- data/config/samples/database.yml.erb +0 -34
- data/db/bootstrap/users.yml +0 -29
- data/features/account_requests.feature +0 -22
- data/features/google_maps.feature +0 -31
- data/features/hello_wagn.feature +0 -31
- data/features/step_definitions/notification_steps.rb +0 -23
- data/features/templates.feature +0 -30
- data/features/virtual_cards.feature +0 -11
- data/lib/active_record/foreign_keys.rb +0 -80
- data/lib/card/constant.rb +0 -20
- data/lib/generators/set/templates/set_template.erb +0 -1
- data/lib/tasks/.gitkeep +0 -0
- data/lib/wagn/authenticated_system.rb +0 -38
- data/lib/wagn/env.rb +0 -42
- data/lib/wagn/loader.rb +0 -135
- data/mods/standard/formats/kml_format.rb +0 -6
- data/mods/standard/lib/google_maps_addon.rb +0 -30
- data/mods/standard/sets/all/admin.rb +0 -53
- data/mods/standard/sets/all/geocode.rb +0 -16
- data/mods/standard/sets/all/kml.rb +0 -49
- data/mods/standard/sets/type/account_request.rb +0 -74
- data/mods/standard/sets/type/ruby_and_script.rb +0 -31
- data/public/assets/application-058913c45d4f3262667bad443a03eb45.js +0 -144
- data/public/assets/application-058913c45d4f3262667bad443a03eb45.js.gz +0 -0
- data/public/assets/application.js +0 -144
- data/public/assets/application.js.gz +0 -0
- data/public/assets/html5shiv-printshiv-ad36fc7219f4aeaa275f9a7fe2383413.js +0 -1
- data/public/assets/html5shiv-printshiv-ad36fc7219f4aeaa275f9a7fe2383413.js.gz +0 -0
- data/public/assets/html5shiv-printshiv.js.gz +0 -0
- data/public/assets/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/public/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/public/assets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/public/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/public/assets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/public/assets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/public/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/public/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/public/assets/images/ui-icons_222222_256x240-66e635a2f90b9f90675d402617630b24.png +0 -0
- data/public/assets/images/ui-icons_222222_256x240.png +0 -0
- data/public/assets/images/ui-icons_2e83ff_256x240-2ea4c160a75c1992daa2eeac86255b99.png +0 -0
- data/public/assets/images/ui-icons_454545_256x240-5c7f12676bcead9cb2d4cb8f23f16e95.png +0 -0
- data/public/assets/images/ui-icons_888888_256x240-95fd3047e1f7325d995a21c729b04125.png +0 -0
- data/public/assets/images/ui-icons_cd0a0a_256x240-c0c1ec6a8bcf48fec40303e975a4dfa6.png +0 -0
- data/public/assets/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/public/assets/jquery.min-8b58c0fbf303b938d8e749262f7e50dd.map +0 -1
- data/public/assets/tinymce-22b5a139d9ff7df7643afae9ce205508.js +0 -13
- data/public/assets/tinymce-22b5a139d9ff7df7643afae9ce205508.js.gz +0 -0
- data/public/assets/tinymce.js +0 -13
- data/public/assets/tinymce.js.gz +0 -0
- data/spec/controllers/account_controller_spec.rb +0 -42
- data/spec/controllers/admin_controller_spec.rb +0 -23
- data/spec/controllers/captcha_spec.rb +0 -103
- data/spec/controllers/sets_spec.rb +0 -97
- data/spec/controllers/wagn_controller_spec.rb +0 -5
- data/spec/mailers/account_spec.rb +0 -66
- data/spec/models/account_spec.rb +0 -19
- data/spec/models/card/comment_spec.rb +0 -38
- data/spec/models/card/revision_spec.rb +0 -58
- data/spec/models/user_spec.rb +0 -95
- data/spec/mods/standard/formats/kml_format_spec.rb +0 -6
- data/spec/mods/standard/sets/all/admin_spec.rb +0 -6
- data/spec/mods/standard/sets/all/geocode_spec.rb +0 -37
- data/spec/mods/standard/sets/all/kml_spec.rb +0 -6
- data/spec/mods/standard/sets/right/crypted_password_spec.rb +0 -6
- data/spec/mods/standard/sets/type/account_request_spec.rb +0 -160
- data/spec/mods/standard/sets/type/ruby_and_script_spec.rb +0 -6
- data/spec/spec.opts +0 -6
- data/test/fixtures/users.yml +0 -169
@@ -0,0 +1,41 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery UI Autocomplete HTML Extension
|
3
|
+
*
|
4
|
+
* Copyright 2010, Scott González (http://scottgonzalez.com)
|
5
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6
|
+
*
|
7
|
+
* http://github.com/scottgonzalez/jquery-ui-extensions
|
8
|
+
*/
|
9
|
+
|
10
|
+
(function( $ ) {
|
11
|
+
|
12
|
+
var proto = $.ui.autocomplete.prototype,
|
13
|
+
initSource = proto._initSource;
|
14
|
+
|
15
|
+
function filter( array, term ) {
|
16
|
+
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), "i" );
|
17
|
+
return $.grep( array, function(value) {
|
18
|
+
return matcher.test( $( "<div>" ).html( value.label || value.value || value ).text() );
|
19
|
+
});
|
20
|
+
}
|
21
|
+
|
22
|
+
$.extend( proto, {
|
23
|
+
_initSource: function() {
|
24
|
+
if ( this.options.html && $.isArray(this.options.source) ) {
|
25
|
+
this.source = function( request, response ) {
|
26
|
+
response( filter( this.options.source, request.term ) );
|
27
|
+
};
|
28
|
+
} else {
|
29
|
+
initSource.call( this );
|
30
|
+
}
|
31
|
+
},
|
32
|
+
|
33
|
+
_renderItem: function( ul, item) {
|
34
|
+
return $( "<li></li>" )
|
35
|
+
.data( "item.autocomplete", item )
|
36
|
+
.append( $( "<a></a>" )[ this.options.html ? "html" : "text" ]( item.label ) )
|
37
|
+
.appendTo( ul );
|
38
|
+
}
|
39
|
+
});
|
40
|
+
|
41
|
+
})( jQuery );
|
@@ -0,0 +1,429 @@
|
|
1
|
+
(function($, undefined) {
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Unobtrusive scripting adapter for jQuery
|
5
|
+
*
|
6
|
+
* Requires jQuery 1.6.0 or later.
|
7
|
+
* https://github.com/rails/jquery-ujs
|
8
|
+
|
9
|
+
* Uploading file using rails.js
|
10
|
+
* =============================
|
11
|
+
*
|
12
|
+
* By default, browsers do not allow files to be uploaded via AJAX. As a result, if there are any non-blank file fields
|
13
|
+
* in the remote form, this adapter aborts the AJAX submission and allows the form to submit through standard means.
|
14
|
+
*
|
15
|
+
* The `ajax:aborted:file` event allows you to bind your own handler to process the form submission however you wish.
|
16
|
+
*
|
17
|
+
* Ex:
|
18
|
+
* $('form').live('ajax:aborted:file', function(event, elements){
|
19
|
+
* // Implement own remote file-transfer handler here for non-blank file inputs passed in `elements`.
|
20
|
+
* // Returning false in this handler tells rails.js to disallow standard form submission
|
21
|
+
* return false;
|
22
|
+
* });
|
23
|
+
*
|
24
|
+
* The `ajax:aborted:file` event is fired when a file-type input is detected with a non-blank value.
|
25
|
+
*
|
26
|
+
* Third-party tools can use this hook to detect when an AJAX file upload is attempted, and then use
|
27
|
+
* techniques like the iframe method to upload the file instead.
|
28
|
+
*
|
29
|
+
* Required fields in rails.js
|
30
|
+
* ===========================
|
31
|
+
*
|
32
|
+
* If any blank required inputs (required="required") are detected in the remote form, the whole form submission
|
33
|
+
* is canceled. Note that this is unlike file inputs, which still allow standard (non-AJAX) form submission.
|
34
|
+
*
|
35
|
+
* The `ajax:aborted:required` event allows you to bind your own handler to inform the user of blank required inputs.
|
36
|
+
*
|
37
|
+
* !! Note that Opera does not fire the form's submit event if there are blank required inputs, so this event may never
|
38
|
+
* get fired in Opera. This event is what causes other browsers to exhibit the same submit-aborting behavior.
|
39
|
+
*
|
40
|
+
* Ex:
|
41
|
+
* $('form').live('ajax:aborted:required', function(event, elements){
|
42
|
+
* // Returning false in this handler tells rails.js to submit the form anyway.
|
43
|
+
* // The blank required inputs are passed to this function in `elements`.
|
44
|
+
* return ! confirm("Would you like to submit the form with missing info?");
|
45
|
+
* });
|
46
|
+
*/
|
47
|
+
|
48
|
+
// Cut down on the number if issues from people inadvertently including jquery_ujs twice
|
49
|
+
// by detecting and raising an error when it happens.
|
50
|
+
var alreadyInitialized = function() {
|
51
|
+
var events = $._data(document, 'events');
|
52
|
+
return events && events.click && $.grep(events.click, function(e) { return e.namespace === 'rails'; }).length;
|
53
|
+
}
|
54
|
+
|
55
|
+
if ( alreadyInitialized() ) {
|
56
|
+
$.error('jquery-ujs has already been loaded!');
|
57
|
+
}
|
58
|
+
|
59
|
+
// Shorthand to make it a little easier to call public rails functions from within rails.js
|
60
|
+
var rails;
|
61
|
+
|
62
|
+
$.rails = rails = {
|
63
|
+
// Link elements bound by jquery-ujs
|
64
|
+
linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote], a[data-disable-with]',
|
65
|
+
|
66
|
+
// Select elements bound by jquery-ujs
|
67
|
+
inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]',
|
68
|
+
|
69
|
+
// Form elements bound by jquery-ujs
|
70
|
+
formSubmitSelector: 'form',
|
71
|
+
|
72
|
+
// Form input elements bound by jquery-ujs
|
73
|
+
formInputClickSelector: 'form input[type=submit], form input[type=image], form button[type=submit], form button:not([type])',
|
74
|
+
|
75
|
+
// Form input elements disabled during form submission
|
76
|
+
disableSelector: 'input[data-disable-with], button[data-disable-with], textarea[data-disable-with]',
|
77
|
+
|
78
|
+
// Form input elements re-enabled after form submission
|
79
|
+
enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled',
|
80
|
+
|
81
|
+
// Form required input elements
|
82
|
+
requiredInputSelector: 'input[name][required]:not([disabled]),textarea[name][required]:not([disabled])',
|
83
|
+
|
84
|
+
// Form file input elements
|
85
|
+
fileInputSelector: 'input:file',
|
86
|
+
|
87
|
+
// Link onClick disable selector with possible reenable after remote submission
|
88
|
+
linkDisableSelector: 'a[data-disable-with]',
|
89
|
+
|
90
|
+
// Make sure that every Ajax request sends the CSRF token
|
91
|
+
CSRFProtection: function(xhr) {
|
92
|
+
var token = $('meta[name="csrf-token"]').attr('content');
|
93
|
+
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
|
94
|
+
},
|
95
|
+
|
96
|
+
// Triggers an event on an element and returns false if the event result is false
|
97
|
+
fire: function(obj, name, data) {
|
98
|
+
var event = $.Event(name);
|
99
|
+
obj.trigger(event, data);
|
100
|
+
return event.result !== false;
|
101
|
+
},
|
102
|
+
|
103
|
+
// Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm
|
104
|
+
confirm: function(message) {
|
105
|
+
return confirm(message);
|
106
|
+
},
|
107
|
+
|
108
|
+
// Default ajax function, may be overridden with custom function in $.rails.ajax
|
109
|
+
ajax: function(options) {
|
110
|
+
return $.ajax(options);
|
111
|
+
},
|
112
|
+
|
113
|
+
// Default way to get an element's href. May be overridden at $.rails.href.
|
114
|
+
href: function(element) {
|
115
|
+
return element.attr('href');
|
116
|
+
},
|
117
|
+
|
118
|
+
// Submits "remote" forms and links with ajax
|
119
|
+
handleRemote: function(element) {
|
120
|
+
var method, url, data, elCrossDomain, crossDomain, withCredentials, dataType, options;
|
121
|
+
|
122
|
+
if (rails.fire(element, 'ajax:before')) {
|
123
|
+
elCrossDomain = element.data('cross-domain');
|
124
|
+
crossDomain = elCrossDomain === undefined ? null : elCrossDomain;
|
125
|
+
withCredentials = element.data('with-credentials') || null;
|
126
|
+
dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType);
|
127
|
+
|
128
|
+
if (element.is('form')) {
|
129
|
+
method = element.attr('method');
|
130
|
+
url = element.attr('action');
|
131
|
+
data = element.serializeArray();
|
132
|
+
// memoized value from clicked submit button
|
133
|
+
var button = element.data('ujs:submit-button');
|
134
|
+
if (button) {
|
135
|
+
data.push(button);
|
136
|
+
element.data('ujs:submit-button', null);
|
137
|
+
}
|
138
|
+
} else if (element.is(rails.inputChangeSelector)) {
|
139
|
+
method = element.data('method');
|
140
|
+
url = element.data('url');
|
141
|
+
data = element.serialize();
|
142
|
+
if (element.data('params')) data = data + "&" + element.data('params');
|
143
|
+
} else {
|
144
|
+
method = element.data('method');
|
145
|
+
url = rails.href(element);
|
146
|
+
data = element.data('params') || null;
|
147
|
+
}
|
148
|
+
|
149
|
+
options = {
|
150
|
+
type: method || 'GET', data: data, dataType: dataType,
|
151
|
+
// stopping the "ajax:beforeSend" event will cancel the ajax request
|
152
|
+
beforeSend: function(xhr, settings) {
|
153
|
+
if (settings.dataType === undefined) {
|
154
|
+
xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script);
|
155
|
+
}
|
156
|
+
return rails.fire(element, 'ajax:beforeSend', [xhr, settings]);
|
157
|
+
},
|
158
|
+
success: function(data, status, xhr) {
|
159
|
+
element.trigger('ajax:success', [data, status, xhr]);
|
160
|
+
},
|
161
|
+
complete: function(xhr, status) {
|
162
|
+
element.trigger('ajax:complete', [xhr, status]);
|
163
|
+
},
|
164
|
+
error: function(xhr, status, error) {
|
165
|
+
element.trigger('ajax:error', [xhr, status, error]);
|
166
|
+
},
|
167
|
+
xhrFields: {
|
168
|
+
withCredentials: withCredentials
|
169
|
+
},
|
170
|
+
crossDomain: crossDomain
|
171
|
+
};
|
172
|
+
// Only pass url to `ajax` options if not blank
|
173
|
+
if (url) { options.url = url; }
|
174
|
+
|
175
|
+
var jqxhr = rails.ajax(options);
|
176
|
+
element.trigger('ajax:send', jqxhr);
|
177
|
+
return jqxhr;
|
178
|
+
} else {
|
179
|
+
return false;
|
180
|
+
}
|
181
|
+
},
|
182
|
+
|
183
|
+
// Handles "data-method" on links such as:
|
184
|
+
// <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a>
|
185
|
+
handleMethod: function(link) {
|
186
|
+
var href = rails.href(link),
|
187
|
+
method = link.data('method'),
|
188
|
+
target = link.attr('target'),
|
189
|
+
csrf_token = $('meta[name=csrf-token]').attr('content'),
|
190
|
+
csrf_param = $('meta[name=csrf-param]').attr('content'),
|
191
|
+
form = $('<form method="post" action="' + href + '"></form>'),
|
192
|
+
metadata_input = '<input name="_method" value="' + method + '" type="hidden" />';
|
193
|
+
|
194
|
+
if (csrf_param !== undefined && csrf_token !== undefined) {
|
195
|
+
metadata_input += '<input name="' + csrf_param + '" value="' + csrf_token + '" type="hidden" />';
|
196
|
+
}
|
197
|
+
|
198
|
+
if (target) { form.attr('target', target); }
|
199
|
+
|
200
|
+
form.hide().append(metadata_input).appendTo('body');
|
201
|
+
form.submit();
|
202
|
+
},
|
203
|
+
|
204
|
+
/* Disables form elements:
|
205
|
+
- Caches element value in 'ujs:enable-with' data store
|
206
|
+
- Replaces element text with value of 'data-disable-with' attribute
|
207
|
+
- Sets disabled property to true
|
208
|
+
*/
|
209
|
+
disableFormElements: function(form) {
|
210
|
+
form.find(rails.disableSelector).each(function() {
|
211
|
+
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
212
|
+
element.data('ujs:enable-with', element[method]());
|
213
|
+
element[method](element.data('disable-with'));
|
214
|
+
element.prop('disabled', true);
|
215
|
+
});
|
216
|
+
},
|
217
|
+
|
218
|
+
/* Re-enables disabled form elements:
|
219
|
+
- Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`)
|
220
|
+
- Sets disabled property to false
|
221
|
+
*/
|
222
|
+
enableFormElements: function(form) {
|
223
|
+
form.find(rails.enableSelector).each(function() {
|
224
|
+
var element = $(this), method = element.is('button') ? 'html' : 'val';
|
225
|
+
if (element.data('ujs:enable-with')) element[method](element.data('ujs:enable-with'));
|
226
|
+
element.prop('disabled', false);
|
227
|
+
});
|
228
|
+
},
|
229
|
+
|
230
|
+
/* For 'data-confirm' attribute:
|
231
|
+
- Fires `confirm` event
|
232
|
+
- Shows the confirmation dialog
|
233
|
+
- Fires the `confirm:complete` event
|
234
|
+
|
235
|
+
Returns `true` if no function stops the chain and user chose yes; `false` otherwise.
|
236
|
+
Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog.
|
237
|
+
Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
|
238
|
+
return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog.
|
239
|
+
*/
|
240
|
+
allowAction: function(element) {
|
241
|
+
var message = element.data('confirm'),
|
242
|
+
answer = false, callback;
|
243
|
+
if (!message) { return true; }
|
244
|
+
|
245
|
+
if (rails.fire(element, 'confirm')) {
|
246
|
+
answer = rails.confirm(message);
|
247
|
+
callback = rails.fire(element, 'confirm:complete', [answer]);
|
248
|
+
}
|
249
|
+
return answer && callback;
|
250
|
+
},
|
251
|
+
|
252
|
+
// Helper function which checks for blank inputs in a form that match the specified CSS selector
|
253
|
+
blankInputs: function(form, specifiedSelector, nonBlank) {
|
254
|
+
var inputs = $(), input, valueToCheck,
|
255
|
+
selector = specifiedSelector || 'input,textarea',
|
256
|
+
allInputs = form.find(selector);
|
257
|
+
|
258
|
+
allInputs.each(function() {
|
259
|
+
input = $(this);
|
260
|
+
valueToCheck = input.is(':checkbox,:radio') ? input.is(':checked') : input.val();
|
261
|
+
// If nonBlank and valueToCheck are both truthy, or nonBlank and valueToCheck are both falsey
|
262
|
+
if (!valueToCheck === !nonBlank) {
|
263
|
+
|
264
|
+
// Don't count unchecked required radio if other radio with same name is checked
|
265
|
+
if (input.is(':radio') && allInputs.filter('input:radio:checked[name="' + input.attr('name') + '"]').length) {
|
266
|
+
return true; // Skip to next input
|
267
|
+
}
|
268
|
+
|
269
|
+
inputs = inputs.add(input);
|
270
|
+
}
|
271
|
+
});
|
272
|
+
return inputs.length ? inputs : false;
|
273
|
+
},
|
274
|
+
|
275
|
+
// Helper function which checks for non-blank inputs in a form that match the specified CSS selector
|
276
|
+
nonBlankInputs: function(form, specifiedSelector) {
|
277
|
+
return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank
|
278
|
+
},
|
279
|
+
|
280
|
+
// Helper function, needed to provide consistent behavior in IE
|
281
|
+
stopEverything: function(e) {
|
282
|
+
$(e.target).trigger('ujs:everythingStopped');
|
283
|
+
e.stopImmediatePropagation();
|
284
|
+
return false;
|
285
|
+
},
|
286
|
+
|
287
|
+
// find all the submit events directly bound to the form and
|
288
|
+
// manually invoke them. If anyone returns false then stop the loop
|
289
|
+
callFormSubmitBindings: function(form, event) {
|
290
|
+
var events = form.data('events'), continuePropagation = true;
|
291
|
+
if (events !== undefined && events['submit'] !== undefined) {
|
292
|
+
$.each(events['submit'], function(i, obj){
|
293
|
+
if (typeof obj.handler === 'function') return continuePropagation = obj.handler(event);
|
294
|
+
});
|
295
|
+
}
|
296
|
+
return continuePropagation;
|
297
|
+
},
|
298
|
+
|
299
|
+
// replace element's html with the 'data-disable-with' after storing original html
|
300
|
+
// and prevent clicking on it
|
301
|
+
disableElement: function(element) {
|
302
|
+
element.data('ujs:enable-with', element.html()); // store enabled state
|
303
|
+
element.html(element.data('disable-with')); // set to disabled state
|
304
|
+
element.bind('click.railsDisable', function(e) { // prevent further clicking
|
305
|
+
return rails.stopEverything(e);
|
306
|
+
});
|
307
|
+
},
|
308
|
+
|
309
|
+
// restore element to its original state which was disabled by 'disableElement' above
|
310
|
+
enableElement: function(element) {
|
311
|
+
if (element.data('ujs:enable-with') !== undefined) {
|
312
|
+
element.html(element.data('ujs:enable-with')); // set to old enabled state
|
313
|
+
// this should be element.removeData('ujs:enable-with')
|
314
|
+
// but, there is currently a bug in jquery which makes hyphenated data attributes not get removed
|
315
|
+
element.data('ujs:enable-with', false); // clean up cache
|
316
|
+
}
|
317
|
+
element.unbind('click.railsDisable'); // enable element
|
318
|
+
}
|
319
|
+
|
320
|
+
};
|
321
|
+
|
322
|
+
if (rails.fire($(document), 'rails:attachBindings')) {
|
323
|
+
|
324
|
+
$.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }});
|
325
|
+
|
326
|
+
$(document).delegate(rails.linkDisableSelector, 'ajax:complete', function() {
|
327
|
+
rails.enableElement($(this));
|
328
|
+
});
|
329
|
+
|
330
|
+
$(document).delegate(rails.linkClickSelector, 'click.rails', function(e) {
|
331
|
+
var link = $(this), method = link.data('method'), data = link.data('params');
|
332
|
+
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
333
|
+
|
334
|
+
if (link.is(rails.linkDisableSelector)) rails.disableElement(link);
|
335
|
+
|
336
|
+
if (link.data('remote') !== undefined) {
|
337
|
+
if ( (e.metaKey || e.ctrlKey) && (!method || method === 'GET') && !data ) { return true; }
|
338
|
+
|
339
|
+
var handleRemote = rails.handleRemote(link);
|
340
|
+
// response from rails.handleRemote() will either be false or a deferred object promise.
|
341
|
+
if (handleRemote === false) {
|
342
|
+
rails.enableElement(link);
|
343
|
+
} else {
|
344
|
+
handleRemote.error( function() { rails.enableElement(link); } );
|
345
|
+
}
|
346
|
+
return false;
|
347
|
+
|
348
|
+
} else if (link.data('method')) {
|
349
|
+
rails.handleMethod(link);
|
350
|
+
return false;
|
351
|
+
}
|
352
|
+
});
|
353
|
+
|
354
|
+
$(document).delegate(rails.inputChangeSelector, 'change.rails', function(e) {
|
355
|
+
var link = $(this);
|
356
|
+
if (!rails.allowAction(link)) return rails.stopEverything(e);
|
357
|
+
|
358
|
+
rails.handleRemote(link);
|
359
|
+
return false;
|
360
|
+
});
|
361
|
+
|
362
|
+
$(document).delegate(rails.formSubmitSelector, 'submit.rails', function(e) {
|
363
|
+
var form = $(this),
|
364
|
+
remote = form.data('remote') !== undefined,
|
365
|
+
blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector),
|
366
|
+
nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector);
|
367
|
+
|
368
|
+
if (!rails.allowAction(form)) return rails.stopEverything(e);
|
369
|
+
|
370
|
+
// skip other logic when required values are missing or file upload is present
|
371
|
+
if (blankRequiredInputs && form.attr("novalidate") == undefined && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) {
|
372
|
+
return rails.stopEverything(e);
|
373
|
+
}
|
374
|
+
|
375
|
+
if (remote) {
|
376
|
+
if (nonBlankFileInputs) {
|
377
|
+
// slight timeout so that the submit button gets properly serialized
|
378
|
+
// (make it easy for event handler to serialize form without disabled values)
|
379
|
+
setTimeout(function(){ rails.disableFormElements(form); }, 13);
|
380
|
+
var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]);
|
381
|
+
|
382
|
+
// re-enable form elements if event bindings return false (canceling normal form submission)
|
383
|
+
if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); }
|
384
|
+
|
385
|
+
return aborted;
|
386
|
+
}
|
387
|
+
|
388
|
+
// If browser does not support submit bubbling, then this live-binding will be called before direct
|
389
|
+
// bindings. Therefore, we should directly call any direct bindings before remotely submitting form.
|
390
|
+
if (!$.support.submitBubbles && $().jquery < '1.7' && rails.callFormSubmitBindings(form, e) === false) return rails.stopEverything(e);
|
391
|
+
|
392
|
+
rails.handleRemote(form);
|
393
|
+
return false;
|
394
|
+
|
395
|
+
} else {
|
396
|
+
// slight timeout so that the submit button gets properly serialized
|
397
|
+
setTimeout(function(){ rails.disableFormElements(form); }, 13);
|
398
|
+
}
|
399
|
+
});
|
400
|
+
|
401
|
+
$(document).delegate(rails.formInputClickSelector, 'click.rails', function(event) {
|
402
|
+
var button = $(this);
|
403
|
+
|
404
|
+
if (!rails.allowAction(button)) return rails.stopEverything(event);
|
405
|
+
|
406
|
+
// register the pressed submit button
|
407
|
+
var name = button.attr('name'),
|
408
|
+
data = name ? {name:name, value:button.val()} : null;
|
409
|
+
|
410
|
+
button.closest('form').data('ujs:submit-button', data);
|
411
|
+
});
|
412
|
+
|
413
|
+
$(document).delegate(rails.formSubmitSelector, 'ajax:beforeSend.rails', function(event) {
|
414
|
+
if (this == event.target) rails.disableFormElements($(this));
|
415
|
+
});
|
416
|
+
|
417
|
+
$(document).delegate(rails.formSubmitSelector, 'ajax:complete.rails', function(event) {
|
418
|
+
if (this == event.target) rails.enableFormElements($(this));
|
419
|
+
});
|
420
|
+
|
421
|
+
$(function(){
|
422
|
+
// making sure that all forms have actual up-to-date token(cached forms contain old one)
|
423
|
+
csrf_token = $('meta[name=csrf-token]').attr('content');
|
424
|
+
csrf_param = $('meta[name=csrf-param]').attr('content');
|
425
|
+
$('form input[name="' + csrf_param + '"]').val(csrf_token);
|
426
|
+
});
|
427
|
+
}
|
428
|
+
|
429
|
+
})( jQuery );
|