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
data/lib/card/mailer.rb
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
class Card
|
5
|
+
class Mailer < ActionMailer::Base
|
6
|
+
|
7
|
+
@@defaults = Wagn.config.email_defaults || {}
|
8
|
+
@@defaults.symbolize_keys!
|
9
|
+
@@defaults[:return_path] ||= @@defaults[:from] if @@defaults[:from]
|
10
|
+
@@defaults[:charset] ||= 'utf-8'
|
11
|
+
default @@defaults
|
12
|
+
|
13
|
+
include Wagn::Location
|
14
|
+
|
15
|
+
|
16
|
+
def confirmation_email account
|
17
|
+
@site = Card.setting :title
|
18
|
+
@link = wagn_url "/update/#{account.left.cardname.url_key}?token=#{account.token}"
|
19
|
+
@expiry = Wagn.config.token_expiry
|
20
|
+
|
21
|
+
confirm_from = token_emails_from(account)
|
22
|
+
mail_from( { :to=>account.email, :subject=>"verification link for #{@site}" }, confirm_from )
|
23
|
+
end
|
24
|
+
|
25
|
+
def password_reset account
|
26
|
+
@site = Card.setting :title
|
27
|
+
@link = wagn_url "/update/#{account.cardname.url_key}?reset_token=#{account.token_card.refresh(true).content}"
|
28
|
+
@expiry = Wagn.config.token_expiry
|
29
|
+
|
30
|
+
reset_from = token_emails_from(account)
|
31
|
+
mail_from( { :to=>account.email, :subject=>"verification link for #{@site}" }, reset_from )
|
32
|
+
end
|
33
|
+
|
34
|
+
def signup_alert invite_request
|
35
|
+
@site = Card.setting :title
|
36
|
+
@card = invite_request
|
37
|
+
@email= invite_request.account.email
|
38
|
+
@name = invite_request.name
|
39
|
+
@content = invite_request.content
|
40
|
+
@request_url = wagn_url invite_request
|
41
|
+
@requests_url = wagn_url Card[:signup]
|
42
|
+
|
43
|
+
args = {
|
44
|
+
:to => Card.setting('*request+*to'),
|
45
|
+
:subject => "#{invite_request.name} signed up for #{@site}",
|
46
|
+
:content_type => 'text/html',
|
47
|
+
}
|
48
|
+
mail_from args, Card.setting('*request+*from') || "#{@name} <#{@email}>"
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def change_notice cd_with_acct, card, action, watched, subedits=[], updated_card=nil
|
53
|
+
cd_with_acct = Card[cd_with_acct] unless Card===cd_with_acct
|
54
|
+
email = cd_with_acct.account.email
|
55
|
+
#warn "change_notice( #{cd_with_acct}, #{email}, #{card.inspect}, #{action.inspect}, #{watched.inspect} Uc:#{updated_card.inspect}...)"
|
56
|
+
|
57
|
+
updated_card ||= card
|
58
|
+
@card = card
|
59
|
+
@updater = updated_card.updater.name
|
60
|
+
@action = action
|
61
|
+
@subedits = subedits
|
62
|
+
@card_url = wagn_url card
|
63
|
+
@change_url = wagn_url "card/changes/#{card.cardname.url_key}"
|
64
|
+
@unwatch_url = wagn_url "card/watch/#{watched.to_name.url_key}?toggle=off"
|
65
|
+
@udpater_url = wagn_url card.updater
|
66
|
+
@watched = (watched == card.cardname ? "#{watched}" : "#{watched} cards")
|
67
|
+
|
68
|
+
args = {
|
69
|
+
:to => email,
|
70
|
+
:subject => "[#{Card.setting :title} notice] #{@updater} #{action} \"#{card.name}\"" ,
|
71
|
+
:content_type => 'text/html',
|
72
|
+
}
|
73
|
+
mail_from args, Card[Card::WagnBotID].account.email
|
74
|
+
end
|
75
|
+
|
76
|
+
def flexmail config
|
77
|
+
@message = config.delete(:message)
|
78
|
+
|
79
|
+
if attachment_list = config.delete(:attach) and !attachment_list.empty?
|
80
|
+
attachment_list.each_with_index do |cardname, i|
|
81
|
+
if c = Card[ cardname ] and c.respond_to?(:attach)
|
82
|
+
attachments["attachment-#{i + 1}.#{c.attach_extension}"] = File.read( c.attach.path )
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
mail_from config, config[:from]
|
88
|
+
end
|
89
|
+
|
90
|
+
private
|
91
|
+
|
92
|
+
def token_emails_from account
|
93
|
+
Card.setting( '*invite+*from' ) || begin
|
94
|
+
from_card_id = Auth.current_id
|
95
|
+
from_card_id = WagnBotID if [ AnonymousID, account.left_id ].member? from_card_id
|
96
|
+
from_card = Card[from_card_id]
|
97
|
+
"#{from_card.name} <#{from_card.account.email}>"
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
def mail_from args, from
|
102
|
+
from_name, from_email = (from =~ /(.*)\<(.*)>/) ? [$1.strip, $2] : [nil, from]
|
103
|
+
|
104
|
+
if default_from=@@defaults[:from]
|
105
|
+
args[:from] = !from_email ? default_from : "#{from_name || from_email} <#{default_from}>"
|
106
|
+
args[:reply_to] ||= from
|
107
|
+
else
|
108
|
+
args[:from] = from
|
109
|
+
end
|
110
|
+
|
111
|
+
args[:template_path] = 'mailer'
|
112
|
+
mail args
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
@@ -25,8 +25,8 @@
|
|
25
25
|
<p>See the card: <%= @card_url %></p>
|
26
26
|
|
27
27
|
<p>
|
28
|
-
You received this email because you're
|
29
|
-
<a href="<%= @unwatch_url %>">
|
28
|
+
You received this email because you're following "<%= @watched %>". <br/>
|
29
|
+
<a href="<%= @unwatch_url %>">Unfollow</a> to stop receiving these emails.
|
30
30
|
</p>
|
31
31
|
</body>
|
32
32
|
</html>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<body style="text-align:center">
|
4
|
+
<h1>Thank you for signing up with <%= @site %></h1>
|
5
|
+
<div>Please <a href="<%= @link %>">follow this link</a> to verify this email address and activate your account.</div>
|
6
|
+
<div>(link will remain valid for <%= @expiry / 1.day %> days)</div>
|
7
|
+
</body>
|
8
|
+
</html>
|
File without changes
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<body style="text-align:center">
|
4
|
+
<h1>Password Reset <%= @site %></h1>
|
5
|
+
<div>Someone (you, we hope) asked to reset your password</div>
|
6
|
+
<div>Please <a href="<%= @link %>">follow this link</a> to verify this email address and reset your account details.</div>
|
7
|
+
<div>(link will remain valid for <%= @expiry / 1.day %> days)</div>
|
8
|
+
</body>
|
9
|
+
</html>
|
File without changes
|
data/lib/card/name.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require 'smart_name'
|
3
3
|
|
4
|
-
|
5
4
|
class Card
|
6
5
|
class Name < SmartName
|
7
6
|
|
8
|
-
self.params =
|
9
|
-
self.session = proc {
|
7
|
+
self.params = Card::Env # yuck!
|
8
|
+
self.session = proc { Auth.current.name }
|
10
9
|
self.banned_array = ['/']
|
11
10
|
|
12
11
|
def star?
|
data/lib/card/query.rb
CHANGED
@@ -6,9 +6,6 @@ class Card::Query
|
|
6
6
|
require_dependency 'card/query/card_spec'
|
7
7
|
require_dependency 'card/query/value_spec'
|
8
8
|
require_dependency 'card/query/ref_spec'
|
9
|
-
|
10
|
-
include ActiveRecord::QuotingAndMatching
|
11
|
-
|
12
9
|
|
13
10
|
MODIFIERS = {}; %w{ conj return sort sort_as group dir limit offset }.each{|key| MODIFIERS[key.to_sym] = nil }
|
14
11
|
|
data/lib/card/query/card_spec.rb
CHANGED
@@ -100,7 +100,7 @@ class Card
|
|
100
100
|
when String; { :key => s.to_name.key }
|
101
101
|
when Integer; { :id => s }
|
102
102
|
when Hash; s
|
103
|
-
else; raise
|
103
|
+
else; raise BadQuery, "Invalid cardspec args #{s.inspect}"
|
104
104
|
end
|
105
105
|
end
|
106
106
|
|
@@ -278,7 +278,7 @@ class Card
|
|
278
278
|
|
279
279
|
cards.each do |c|
|
280
280
|
unless c && [SearchTypeID,SetID].include?(c.type_id)
|
281
|
-
raise BadQuery, %{"found_by" value needs to be valid Search
|
281
|
+
raise BadQuery, %{"found_by" value needs to be valid Search, but #{c.name} is a #{c.type_name}}
|
282
282
|
end
|
283
283
|
found_by_spec = CardSpec.new(c.get_spec).rawspec
|
284
284
|
merge(field(:id) => subspec(found_by_spec))
|
@@ -459,8 +459,8 @@ class Card
|
|
459
459
|
end
|
460
460
|
|
461
461
|
def permission_conditions
|
462
|
-
unless
|
463
|
-
read_rules =
|
462
|
+
unless Auth.always_ok? #or ( Card::Query.root_perms_only && !root? )
|
463
|
+
read_rules = Auth.as_card.read_rules
|
464
464
|
read_rule_list = read_rules.nil? ? 1 : read_rules.join(',')
|
465
465
|
"(#{table_alias}.read_rule_id IN (#{ read_rule_list }))"
|
466
466
|
end
|
data/lib/card/revision.rb
CHANGED
@@ -1,45 +1,47 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
|
-
class Card
|
3
|
-
|
2
|
+
class Card
|
3
|
+
class Revision < ActiveRecord::Base
|
4
|
+
before_save :set_stamper
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
class << self
|
7
|
+
def cache
|
8
|
+
Wagn::Cache[Card::Revision]
|
9
|
+
end
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
def delete_old
|
12
|
+
where( Card.where( :current_revision_id=>arel_table[:id] ).exists.not ).delete_all
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
-
|
15
|
+
def delete_cardless
|
16
|
+
where( Card.where( :id=>arel_table[:card_id] ).exists.not ).delete_all
|
17
|
+
end
|
16
18
|
end
|
17
|
-
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def set_stamper
|
21
|
+
self.creator_id = Auth.current_id
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
24
|
+
def creator
|
25
|
+
Card[ creator_id ]
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
|
28
|
+
def card
|
29
|
+
Card[ card_id ]
|
30
|
+
end
|
30
31
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
32
|
+
def title #ENGLISH
|
33
|
+
current_id = card.current_revision_id
|
34
|
+
if id == current_id
|
35
|
+
'Current Revision'
|
36
|
+
elsif id > current_id
|
37
|
+
'AutoSave'
|
38
|
+
else
|
39
|
+
card.revisions.each_with_index do |rev, index|
|
40
|
+
return "Revision ##{index + 1}" if rev.id == id
|
41
|
+
end
|
42
|
+
'[Revisions Missing]'
|
40
43
|
end
|
41
|
-
'[Revisions Missing]'
|
42
44
|
end
|
45
|
+
|
43
46
|
end
|
44
|
-
|
45
47
|
end
|
data/lib/card/set.rb
CHANGED
@@ -1,240 +1,264 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
module Card::Set
|
4
|
-
|
5
|
-
mattr_accessor :includable_modules, :base_modules, :traits, :current
|
6
|
-
@@includable_modules, @@base_modules = {}, []
|
7
|
-
|
8
|
-
|
9
|
-
# View definitions
|
10
|
-
#
|
11
|
-
# When you declare:
|
12
|
-
# view :view_name, "<set>" do |args|
|
13
|
-
#
|
14
|
-
# Methods are defined on the format
|
15
|
-
#
|
16
|
-
# The external api with checks:
|
17
|
-
# render(:viewname, args)
|
18
|
-
#
|
19
|
-
# Roughly equivalent to:
|
20
|
-
# render_viewname(args)
|
21
|
-
#
|
22
|
-
# The internal call that skips the checks:
|
23
|
-
# _render_viewname(args)
|
24
|
-
#
|
25
|
-
# Each of the above ultimately calls:
|
26
|
-
# _final(_set_key)_viewname(args)
|
27
|
-
|
28
|
-
#
|
29
|
-
# ~~~~~~~~~~ VIEW DEFINITION
|
30
|
-
#
|
31
|
-
|
32
|
-
def view *args, &block
|
33
|
-
format do view *args, &block end
|
34
|
-
end
|
35
3
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
4
|
+
class Card
|
5
|
+
module Set
|
6
|
+
|
7
|
+
mattr_accessor :includable_modules, :base_modules, :traits, :current
|
8
|
+
@@includable_modules, @@base_modules = {}, []
|
9
|
+
|
10
|
+
|
11
|
+
# View definitions
|
12
|
+
#
|
13
|
+
# When you declare:
|
14
|
+
# view :view_name, "<set>" do |args|
|
15
|
+
#
|
16
|
+
# Methods are defined on the format
|
17
|
+
#
|
18
|
+
# The external api with checks:
|
19
|
+
# render(:viewname, args)
|
20
|
+
#
|
21
|
+
# Roughly equivalent to:
|
22
|
+
# render_viewname(args)
|
23
|
+
#
|
24
|
+
# The internal call that skips the checks:
|
25
|
+
# _render_viewname(args)
|
26
|
+
#
|
27
|
+
# Each of the above ultimately calls:
|
28
|
+
# _final(_set_key)_viewname(args)
|
29
|
+
|
30
|
+
#
|
31
|
+
# ~~~~~~~~~~ VIEW DEFINITION
|
32
|
+
#
|
33
|
+
|
34
|
+
def view *args, &block
|
35
|
+
format do view *args, &block end
|
43
36
|
end
|
44
|
-
end
|
45
37
|
|
38
|
+
def format fmt=nil, &block
|
39
|
+
if block_given?
|
40
|
+
f = Card::Format
|
41
|
+
format = fmt.nil? ? f : f.get_format(fmt)
|
42
|
+
format.class_eval &block
|
43
|
+
else
|
44
|
+
fail "block required"
|
45
|
+
end
|
46
|
+
end
|
46
47
|
|
47
|
-
|
48
|
-
|
48
|
+
def event event, opts={}, &final
|
49
|
+
opts[:on] = [:create, :update ] if opts[:on] == :save
|
49
50
|
|
50
|
-
|
51
|
-
|
51
|
+
mod = Card::Set.current[:module]
|
52
|
+
Card.define_callbacks event
|
52
53
|
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
mod.class_eval do
|
55
|
+
final_method = "#{event}_without_callbacks" #should be private?
|
56
|
+
define_method final_method, &final
|
56
57
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
58
|
+
define_method event do
|
59
|
+
# Rails.logger.info "running #{event} for #{name}"
|
60
|
+
run_callbacks event do
|
61
|
+
# Rails.logger.info "calling event: #{event} for #{self}"
|
62
|
+
send final_method
|
63
|
+
end
|
61
64
|
end
|
62
65
|
end
|
63
|
-
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
+
set_event_callbacks event, mod, opts
|
68
|
+
end
|
67
69
|
|
68
70
|
|
69
71
|
|
70
|
-
|
71
|
-
|
72
|
-
|
72
|
+
#
|
73
|
+
# ActiveCard support: accessing plus cards as attributes
|
74
|
+
#
|
73
75
|
|
74
76
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
77
|
+
def card_accessor *args
|
78
|
+
options = args.extract_options!
|
79
|
+
add_traits args, options.merge( :reader=>true, :writer=>true )
|
80
|
+
end
|
79
81
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
82
|
+
def card_reader *args
|
83
|
+
options = args.extract_options!
|
84
|
+
add_traits args, options.merge( :reader=>true )
|
85
|
+
end
|
84
86
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
87
|
+
def card_writer *args
|
88
|
+
options = args.extract_options!
|
89
|
+
add_traits args, options.merge( :writer=>true )
|
90
|
+
end
|
90
91
|
|
92
|
+
|
93
|
+
def const_missing const
|
94
|
+
if const.to_s =~ /^([A-Z]\S*)ID$/ and code=$1.underscore.to_sym
|
95
|
+
if card_id = Codename[code]
|
96
|
+
const_set const, card_id
|
97
|
+
else
|
98
|
+
raise "Missing codename #{code} (#{const})"
|
99
|
+
end
|
100
|
+
else
|
101
|
+
super
|
102
|
+
end
|
103
|
+
end
|
91
104
|
|
92
|
-
|
93
|
-
|
94
|
-
|
105
|
+
#
|
106
|
+
# Singleton methods
|
107
|
+
#
|
95
108
|
|
96
|
-
|
109
|
+
class << self
|
97
110
|
|
98
|
-
|
99
|
-
|
100
|
-
|
111
|
+
def extended mod
|
112
|
+
# document!
|
113
|
+
register_set mod
|
114
|
+
end
|
101
115
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
|
110
|
-
includable_modules[ set_module.name ] = set_module unless set_module == Card
|
111
|
-
end
|
116
|
+
def method_key opts
|
117
|
+
Card.set_patterns.each do |pclass|
|
118
|
+
if !pclass.opt_keys.map(&opts.method(:has_key?)).member? false;
|
119
|
+
return pclass.method_key_from_opts(opts)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
112
123
|
|
113
|
-
|
114
|
-
|
115
|
-
|
124
|
+
def register_set set_module
|
125
|
+
if all_set?( set_module )
|
126
|
+
self.current = { :module=>Card, :opts=>{} }
|
127
|
+
base_modules << set_module unless set_module == Card
|
128
|
+
else
|
129
|
+
self.current = { :module=>set_module, :opts=>opts_from_module( set_module ) }
|
130
|
+
end
|
116
131
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
else
|
123
|
-
{ }
|
132
|
+
includable_modules[ set_module.name ] = set_module unless set_module == Card
|
133
|
+
end
|
134
|
+
|
135
|
+
def all_set? set_module
|
136
|
+
set_module == Card or set_module.name =~ /^Card::Set::All::/
|
124
137
|
end
|
125
|
-
end
|
126
138
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
module_name_parts = args.length == 1 ? args[0].split('::') : args
|
133
|
-
module_name_parts.inject Card::Set do |base, part|
|
134
|
-
return if base.nil?
|
135
|
-
part = part.camelize
|
136
|
-
module_name = "#{base.name}::#{part}"
|
137
|
-
if includable_modules.has_key?(module_name)
|
138
|
-
includable_modules[module_name]
|
139
|
+
def opts_from_module set_module
|
140
|
+
if name_parts = set_module.to_s.split('::')[2..-1]
|
141
|
+
#FIXME - does not handle set patterns with multiple opts (eg type plus right)
|
142
|
+
pattern, anchor = name_parts.map { |part| part.underscore.to_sym }
|
143
|
+
{ pattern => anchor }
|
139
144
|
else
|
140
|
-
|
145
|
+
{ }
|
141
146
|
end
|
142
147
|
end
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
148
|
+
|
149
|
+
def write_tmp_file set_pattern, anchor, from_file, seq
|
150
|
+
# FIXME - this does not properly handle anchorless sets
|
151
|
+
# There are special hacks for *all, but others (like *rstar) will not be found by
|
152
|
+
# include_set_modules, which will look for Card::Set::Rstar, not Card::Set::Rstar::Blah
|
153
|
+
|
154
|
+
to_file = "#{Wagn.paths['tmp/sets'].first}/#{set_pattern}/#{seq}-#{anchor}.rb"
|
155
|
+
file_content = <<EOF
|
156
|
+
# -*- encoding : utf-8 -*-
|
157
|
+
class Card; module Set; module #{set_pattern.camelize}; module #{anchor.camelize}
|
158
|
+
extend Card::Set
|
159
|
+
# ~~~~~~~~~~~ above autogenerated; below pulled from #{from_file} ~~~~~~~~~~~
|
160
|
+
|
161
|
+
#{ File.read from_file }
|
162
|
+
|
163
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from #{from_file} ~~~~~~~~~~~
|
164
|
+
end;end;end;end
|
165
|
+
EOF
|
166
|
+
File.write to_file, file_content
|
167
|
+
to_file
|
168
|
+
end
|
169
|
+
|
170
|
+
|
171
|
+
def process_base_modules
|
172
|
+
base_modules.each do |mod|
|
173
|
+
if mod.instance_methods.any?
|
174
|
+
Card.send :include, mod
|
175
|
+
end
|
176
|
+
if class_methods = mod.const_get_if_defined( :ClassMethods )
|
177
|
+
Card.send :extend, class_methods
|
178
|
+
end
|
179
|
+
includable_modules.delete mod.name
|
155
180
|
end
|
156
|
-
|
181
|
+
@@base_modules = []
|
157
182
|
end
|
158
|
-
@@base_modules = []
|
159
|
-
end
|
160
183
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
184
|
+
def clean_empty_modules
|
185
|
+
includable_modules.each do |mod_name, mod|
|
186
|
+
if mod.instance_methods.empty?
|
187
|
+
includable_modules.delete mod_name
|
188
|
+
end
|
165
189
|
end
|
166
190
|
end
|
167
|
-
end
|
168
191
|
|
169
|
-
|
192
|
+
end
|
170
193
|
|
171
194
|
|
172
|
-
|
195
|
+
private
|
173
196
|
|
174
197
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
198
|
+
def set_event_callbacks event, mod, opts
|
199
|
+
[:before, :after, :around].each do |kind|
|
200
|
+
if object_method = opts.delete(kind)
|
201
|
+
options = { :prepend => true }
|
202
|
+
if mod == Card
|
203
|
+
options[:if] = proc { |c| c.event_applies? opts }
|
204
|
+
else
|
205
|
+
parts = mod.name.split '::'
|
206
|
+
set_class_key, anchor_or_placeholder = parts[-2].underscore.to_sym, parts[-1].underscore
|
207
|
+
set_key = Card::Set.method_key( set_class_key => anchor_or_placeholder )
|
208
|
+
options[:if] = proc { |c| c.method_keys.member? set_key and c.event_applies? opts }
|
209
|
+
end
|
210
|
+
Card.class_eval { set_callback object_method, kind, event, options }
|
211
|
+
end
|
188
212
|
end
|
189
213
|
end
|
190
|
-
end
|
191
214
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
215
|
+
def get_traits mod
|
216
|
+
Card::Set.traits ||= {}
|
217
|
+
Card::Set.traits[mod] or Card::Set.traits[mod] = {}
|
218
|
+
end
|
196
219
|
|
197
|
-
|
198
|
-
|
199
|
-
raise "Can't define card traits on all set" if mod == Card
|
200
|
-
|
220
|
+
def add_traits args, options
|
221
|
+
mod = Card::Set.current[:module]
|
222
|
+
# raise "Can't define card traits on all set" if mod == Card
|
223
|
+
mod_traits = get_traits mod
|
201
224
|
|
202
|
-
|
203
|
-
|
225
|
+
new_opts = options[:type] ? {:type=>options[:type]} : {}
|
226
|
+
new_opts.merge!( {:content => options[:default]} ) if options[:default]
|
204
227
|
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
228
|
+
args.each do |trait|
|
229
|
+
define_trait_card trait, new_opts
|
230
|
+
define_trait_reader trait if options[:reader]
|
231
|
+
define_trait_writer trait if options[:writer]
|
209
232
|
|
210
|
-
|
233
|
+
mod_traits[trait.to_sym] = options
|
234
|
+
end
|
211
235
|
end
|
212
|
-
end
|
213
236
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
237
|
+
def define_trait_card trait, opts
|
238
|
+
define_method "#{trait}_card" do
|
239
|
+
trait_var "@#{trait}_card" do
|
240
|
+
fetch :trait=>trait.to_sym, :new=>opts.clone
|
241
|
+
end
|
218
242
|
end
|
219
243
|
end
|
220
|
-
end
|
221
244
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
245
|
+
def define_trait_reader trait
|
246
|
+
define_method trait do
|
247
|
+
trait_var "@#{trait}" do
|
248
|
+
send( "#{trait}_card" ).content
|
249
|
+
end
|
226
250
|
end
|
227
251
|
end
|
228
|
-
end
|
229
252
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
253
|
+
def define_trait_writer trait
|
254
|
+
define_method "#{trait}=" do |value|
|
255
|
+
card = send "#{trait}_card"
|
256
|
+
self.subcards ||= {}
|
257
|
+
self.subcards[card.name] = {:type_id => card.type_id, :content=>value }
|
258
|
+
instance_variable_set "@#{trait}", value
|
259
|
+
end
|
236
260
|
end
|
237
|
-
end
|
238
261
|
|
262
|
+
end
|
239
263
|
end
|
240
264
|
|