card 0.0.1 → 1.15.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +4 -0
- data/GPL +331 -0
- data/LICENSE +16 -0
- data/VERSION +1 -0
- data/card.gemspec +48 -19
- data/config/initializers/01_init_ruby_extensions.rb +7 -0
- data/config/initializers/inflections.rb +13 -0
- data/config/initializers/mime_types.rb +13 -0
- data/config/initializers/notification.rb +4 -0
- data/config/initializers/recaptcha.rb +6 -0
- data/config/initializers/uuid_state_file.rb +3 -0
- data/db/bootstrap/card_actions.yml +3872 -0
- data/db/bootstrap/card_acts.yml +7 -0
- data/db/bootstrap/card_changes.yml +11909 -0
- data/db/bootstrap/card_references.yml +3970 -0
- data/db/bootstrap/cards.yml +10805 -0
- data/db/migrate/20110511221913_require_earlier_migrations.rb +19 -0
- data/db/migrate/20120105203350_require_1_8_migrations.rb +15 -0
- data/db/migrate/20121111025347_require_1_10_migrations.rb +15 -0
- data/db/migrate/20121118114000_split_link_type.rb +16 -0
- data/db/migrate/20121118115000_update_link_type.rb +19 -0
- data/db/migrate/20130106052640_table_cleanup.rb +25 -0
- data/db/migrate/20130109015336_trunk_left.rb +14 -0
- data/db/migrate/20130411210957_update_codenames.rb +14 -0
- data/db/migrate/20140822073704_create_new_revision_tables.rb +43 -0
- data/db/migrate/20141001105348_move_revisions_to_actions.rb +62 -0
- data/db/migrate/20141121172918_rename_card_migration_table.rb +15 -0
- data/db/migrate/20141208132159_remove_present_from_reference_table.rb +9 -0
- data/db/migrate/20141216053032_better_index_names.rb +24 -0
- data/db/migrate_core_cards/20130411191151_renaming_for_menu.rb +49 -0
- data/db/migrate_core_cards/20130411211600_delete_old_related_tab_cards.rb +18 -0
- data/db/migrate_core_cards/20130419215612_import_help_text.rb +13 -0
- data/db/migrate_core_cards/20130823192433_add_style_cards.rb +87 -0
- data/db/migrate_core_cards/20130910183318_move_styles_to_content.rb +11 -0
- data/db/migrate_core_cards/20130920214038_jsonize_tinymce.rb +15 -0
- data/db/migrate_core_cards/20130920291703_update_stylesheets.rb +18 -0
- data/db/migrate_core_cards/20130927191728_account_events.rb +21 -0
- data/db/migrate_core_cards/20131016172445_common_css_patch.rb +12 -0
- data/db/migrate_core_cards/20140110193325_reset_account_request_type.rb +11 -0
- data/db/migrate_core_cards/20140307231621_user_data_to_cards.rb +73 -0
- data/db/migrate_core_cards/20140317035504_account_requests_to_signups.rb +51 -0
- data/db/migrate_core_cards/20140512155840_add_script_cards.rb +83 -0
- data/db/migrate_core_cards/20140629222005_add_email_cards.rb +134 -0
- data/db/migrate_core_cards/20140725180118_config_card_updates.rb +9 -0
- data/db/migrate_core_cards/20141111083921_delete_machine_output.rb +9 -0
- data/db/migrate_core_cards/20141115034214_config_descriptions_etc.rb +14 -0
- data/db/migrate_core_cards/20141119001955_make_symlinks_relative.rb +15 -0
- data/db/migrate_core_cards/20141120120605_fix_notification_html_message.rb +10 -0
- data/db/migrate_core_cards/20141204061304_watchers_to_following.rb +38 -0
- data/db/migrate_core_cards/20141208132416_partial_reference_type.rb +7 -0
- data/db/migrate_core_cards/20141208162106_add_ace_script.rb +12 -0
- data/db/migrate_core_cards/20141216155251_add_more_following_cards.rb +24 -0
- data/db/migrate_core_cards/20141230204340_uri_codename.rb +13 -0
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +17 -0
- data/db/migrate_core_cards/20150220134731_following_to_follow_rule.rb +18 -0
- data/db/migrate_core_cards/data/1.11_help_text.json +410 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/classic_cards.scss +100 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +226 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/right_sidebar.scss +27 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/traditional.scss +152 -0
- data/db/migrate_core_cards/data/1.13_config_text.json +32 -0
- data/db/migrate_core_cards/data/1.14_config_descriptions_etc.json +77 -0
- data/db/migrate_core_cards/data/bootstrap_layout.json +81 -0
- data/db/migrate_core_cards/data/mailer/follower_notification_email.html +9 -0
- data/db/migrate_core_cards/data/mailer/follower_notification_email.txt +11 -0
- data/db/migrate_core_cards/data/mailer/mail_config.json +22 -0
- data/db/migrate_core_cards/data/mailer/password_reset_email.html +10 -0
- data/db/migrate_core_cards/data/mailer/password_reset_email.txt +11 -0
- data/db/migrate_core_cards/data/mailer/signup_alert_email.html +7 -0
- data/db/migrate_core_cards/data/mailer/signup_alert_email.txt +5 -0
- data/db/migrate_core_cards/data/mailer/verification_email.html +9 -0
- data/db/migrate_core_cards/data/mailer/verification_email.txt +8 -0
- data/db/schema.rb +128 -0
- data/db/seeds.rb +8 -0
- data/db/version.txt +1 -0
- data/db/version_core_cards.txt +1 -0
- data/lib/card.rb +46 -3
- data/lib/card/active_record_ext.rb +77 -0
- data/lib/card/auth.rb +181 -0
- data/lib/card/cache.rb +199 -0
- data/lib/card/chunk.rb +104 -0
- data/lib/card/codename.rb +72 -0
- data/lib/card/content.rb +211 -0
- data/lib/card/core_ext.rb +105 -0
- data/lib/card/core_migration.rb +6 -0
- data/lib/card/diff.rb +430 -0
- data/lib/card/env.rb +52 -0
- data/lib/card/exceptions.rb +44 -0
- data/lib/card/format.rb +563 -0
- data/lib/card/loader.rb +165 -0
- data/lib/card/log.rb +450 -0
- data/lib/card/mailer.rb +37 -0
- data/lib/card/migration.rb +145 -0
- data/lib/card/name.rb +45 -0
- data/lib/card/query.rb +81 -0
- data/lib/card/query/card_clause.rb +527 -0
- data/lib/card/query/clause.rb +21 -0
- data/lib/card/query/ref_clause.rb +47 -0
- data/lib/card/query/value_clause.rb +65 -0
- data/lib/card/reference.rb +63 -0
- data/lib/card/set.rb +369 -0
- data/lib/card/set_pattern.rb +168 -0
- data/lib/card/simplecov_helper.rb +61 -0
- data/lib/card/spec_helper.rb +68 -0
- data/lib/card/version.rb +9 -2
- data/lib/cardio.rb +145 -0
- data/lib/generators/card.rb +32 -0
- data/lib/generators/card/format/USAGE +9 -0
- data/lib/generators/card/format/format_generator.rb +27 -0
- data/lib/generators/card/format/templates/format_spec_template.erb +5 -0
- data/lib/generators/card/format/templates/format_template.erb +3 -0
- data/lib/generators/card/migration/USAGE +24 -0
- data/lib/generators/card/migration/migration_generator.rb +38 -0
- data/lib/generators/card/migration/templates/card_migration.erb +10 -0
- data/lib/generators/card/set/USAGE +15 -0
- data/lib/generators/card/set/set_generator.rb +29 -0
- data/lib/generators/card/set/templates/set_spec_template.erb +5 -0
- data/lib/generators/card/set/templates/set_template.erb +1 -0
- data/mod/01_core/chunk/include.rb +85 -0
- data/mod/01_core/chunk/link.rb +87 -0
- data/mod/01_core/chunk/literal.rb +24 -0
- data/mod/01_core/chunk/reference.rb +53 -0
- data/mod/01_core/chunk/uri.rb +135 -0
- data/mod/01_core/format/data_format.rb +2 -0
- data/mod/01_core/format/html_format.rb +129 -0
- data/mod/01_core/format/text_format.rb +10 -0
- data/mod/01_core/layout/blank.html +5 -0
- data/mod/01_core/layout/default.html +20 -0
- data/mod/01_core/layout/noside.html +16 -0
- data/mod/01_core/layout/pre.html +2 -0
- data/mod/01_core/layout/simple.html +5 -0
- data/mod/01_core/set/all/active_card.rb +35 -0
- data/mod/01_core/set/all/collection.rb +142 -0
- data/mod/01_core/set/all/content.rb +64 -0
- data/mod/01_core/set/all/erb.rb +11 -0
- data/mod/01_core/set/all/fetch.rb +228 -0
- data/mod/01_core/set/all/haml.rb +7 -0
- data/mod/01_core/set/all/initialize.rb +49 -0
- data/mod/01_core/set/all/name.rb +275 -0
- data/mod/01_core/set/all/pattern.rb +56 -0
- data/mod/01_core/set/all/permissions.rb +284 -0
- data/mod/01_core/set/all/phases.rb +185 -0
- data/mod/01_core/set/all/references.rb +118 -0
- data/mod/01_core/set/all/rules.rb +315 -0
- data/mod/01_core/set/all/states.rb +16 -0
- data/mod/01_core/set/all/templating.rb +120 -0
- data/mod/01_core/set/all/tracked_attributes.rb +114 -0
- data/mod/01_core/set/all/trash.rb +50 -0
- data/mod/01_core/set/all/type.rb +85 -0
- data/mod/01_core/set/all/utils.rb +85 -0
- data/mod/01_core/set_pattern/01_all.rb +11 -0
- data/mod/01_core/set_pattern/02_all_plus.rb +13 -0
- data/mod/01_core/set_pattern/03_type.rb +23 -0
- data/mod/01_core/set_pattern/04_star.rb +15 -0
- data/mod/01_core/set_pattern/05_rstar.rb +17 -0
- data/mod/01_core/set_pattern/06_right.rb +20 -0
- data/mod/01_core/set_pattern/07_type_plus_right.rb +23 -0
- data/mod/01_core/set_pattern/08_self.rb +19 -0
- data/mod/01_core/spec/chunk/literal_spec.rb +14 -0
- data/mod/01_core/spec/chunk/uri_spec.rb +292 -0
- data/mod/01_core/spec/format/data_format_spec.rb +5 -0
- data/mod/01_core/spec/format/html_format_spec.rb +140 -0
- data/mod/01_core/spec/format/text_format_spec.rb +5 -0
- data/mod/01_core/spec/set/all/active_card_spec.rb +5 -0
- data/mod/01_core/spec/set/all/attribute_tracking_spec.rb +21 -0
- data/mod/01_core/spec/set/all/collection_spec.rb +65 -0
- data/mod/01_core/spec/set/all/content_spec.rb +15 -0
- data/mod/01_core/spec/set/all/fetch_spec.rb +204 -0
- data/mod/01_core/spec/set/all/initialize_spec.rb +58 -0
- data/mod/01_core/spec/set/all/name_spec.rb +61 -0
- data/mod/01_core/spec/set/all/pattern_spec.rb +81 -0
- data/mod/01_core/spec/set/all/permissions_spec.rb +505 -0
- data/mod/01_core/spec/set/all/phases_spec.rb +6 -0
- data/mod/01_core/spec/set/all/references_spec.rb +8 -0
- data/mod/01_core/spec/set/all/rules2_spec.rb +250 -0
- data/mod/01_core/spec/set/all/rules_spec.rb +130 -0
- data/mod/01_core/spec/set/all/states_spec.rb +5 -0
- data/mod/01_core/spec/set/all/templating_spec.rb +111 -0
- data/mod/01_core/spec/set/all/tracked_attributes_spec.rb +328 -0
- data/mod/01_core/spec/set/all/trash_spec.rb +34 -0
- data/mod/01_core/spec/set/all/type_spec.rb +71 -0
- data/mod/01_core/spec/set/all/utils_spec.rb +5 -0
- data/mod/01_history/lib/card/act.rb +60 -0
- data/mod/01_history/lib/card/action.rb +176 -0
- data/mod/01_history/lib/card/change.rb +29 -0
- data/mod/01_history/set/all/actions.rb +47 -0
- data/mod/01_history/set/all/content_history.rb +131 -0
- data/mod/01_history/set/all/history.rb +296 -0
- data/mod/02_basic_types/format/css_format.rb +6 -0
- data/mod/02_basic_types/format/csv_format.rb +6 -0
- data/mod/02_basic_types/format/file_format.rb +3 -0
- data/mod/02_basic_types/format/js_format.rb +6 -0
- data/mod/02_basic_types/format/json_format.rb +6 -0
- data/mod/02_basic_types/format/rss_format.rb +11 -0
- data/mod/02_basic_types/format/xml_format.rb +6 -0
- data/mod/02_basic_types/set/all/all_css.rb +42 -0
- data/mod/02_basic_types/set/all/all_csv.rb +52 -0
- data/mod/02_basic_types/set/all/all_js.rb +7 -0
- data/mod/02_basic_types/set/all/base.rb +122 -0
- data/mod/02_basic_types/set/all/file.rb +13 -0
- data/mod/02_basic_types/set/all/json.rb +66 -0
- data/mod/02_basic_types/set/all/rss.rb +72 -0
- data/mod/02_basic_types/set/all/text.rb +8 -0
- data/mod/02_basic_types/set/type/plain_text.rb +10 -0
- data/mod/02_basic_types/set/type/pointer.rb +323 -0
- data/mod/02_basic_types/spec/set/all/all_css_spec.rb +10 -0
- data/mod/02_basic_types/spec/set/all/all_csv_spec.rb +9 -0
- data/mod/02_basic_types/spec/set/all/base_spec.rb +57 -0
- data/mod/02_basic_types/spec/set/all/file_spec.rb +5 -0
- data/mod/02_basic_types/spec/set/all/json_spec.rb +26 -0
- data/mod/02_basic_types/spec/set/all/rss_spec.rb +8 -0
- data/mod/02_basic_types/spec/set/all/text_spec.rb +5 -0
- data/mod/02_basic_types/spec/set/type/plain_text_spec.rb +11 -0
- data/mod/02_basic_types/spec/set/type/pointer_spec.rb +103 -0
- data/mod/03_machines/lib/card/machine.rb +185 -0
- data/mod/03_machines/lib/card/machine_input.rb +40 -0
- data/mod/03_machines/lib/javascript/ace.js +18204 -0
- data/mod/03_machines/lib/javascript/html5shiv-printshiv.js +1 -0
- data/mod/03_machines/lib/javascript/jquery-ui.js +14913 -0
- data/mod/03_machines/lib/javascript/jquery.autosize.js +274 -0
- data/mod/03_machines/lib/javascript/jquery.fileupload.js +1114 -0
- data/mod/03_machines/lib/javascript/jquery.iframe-transport.js +185 -0
- data/mod/03_machines/lib/javascript/jquery.js +4 -0
- data/mod/03_machines/lib/javascript/jquery.ui.autocomplete.html.js +41 -0
- data/mod/03_machines/lib/javascript/jquery_ujs.js +469 -0
- data/mod/03_machines/lib/javascript/jquerymobile.js +15454 -0
- data/mod/03_machines/lib/javascript/theme-textmate.js +130 -0
- data/mod/03_machines/lib/javascript/tinymce.js +13 -0
- data/mod/03_machines/lib/javascript/wagn.js.coffee +336 -0
- data/mod/03_machines/lib/javascript/wagn_menu.js +72 -0
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +446 -0
- data/mod/03_machines/lib/stylesheets/functional.scss +184 -0
- data/mod/03_machines/lib/stylesheets/jquery-ui-smoothness.css +1178 -0
- data/mod/03_machines/lib/stylesheets/standard.scss +760 -0
- data/mod/03_machines/set/right/machine_output.rb +20 -0
- data/mod/03_machines/set/self/script_ace.rb +8 -0
- data/mod/03_machines/set/self/script_card_menu.rb +8 -0
- data/mod/03_machines/set/self/script_html5shiv_printshiv.rb +7 -0
- data/mod/03_machines/set/self/script_jquery.rb +8 -0
- data/mod/03_machines/set/self/script_jquery_helper.rb +14 -0
- data/mod/03_machines/set/self/script_slot.rb +9 -0
- data/mod/03_machines/set/self/script_tinymce.rb +8 -0
- data/mod/03_machines/set/self/style_functional.rb +8 -0
- data/mod/03_machines/set/self/style_jquery_ui_smoothness.rb +8 -0
- data/mod/03_machines/set/self/style_standard.rb +8 -0
- data/mod/03_machines/set/type/coffee_script.rb +61 -0
- data/mod/03_machines/set/type/css.rb +45 -0
- data/mod/03_machines/set/type/java_script.rb +38 -0
- data/mod/03_machines/set/type/scss.rb +23 -0
- data/mod/03_machines/set/type/skin.rb +12 -0
- data/mod/03_machines/spec/lib/shared_machine_examples.rb +175 -0
- data/mod/03_machines/spec/lib/shared_machine_input_examples.rb +65 -0
- data/mod/03_machines/spec/set/right/machine_output_spec.rb +5 -0
- data/mod/03_machines/spec/set/self/style_functional_spec.rb +5 -0
- data/mod/03_machines/spec/set/self/style_jquery_ui_smoothness_spec.rb +5 -0
- data/mod/03_machines/spec/set/self/style_standard_spec.rb +5 -0
- data/mod/03_machines/spec/set/type/coffeescript_spec.rb +29 -0
- data/mod/03_machines/spec/set/type/css_spec.rb +34 -0
- data/mod/03_machines/spec/set/type/javascript_spec.rb +28 -0
- data/mod/03_machines/spec/set/type/scss_spec.rb +56 -0
- data/mod/03_machines/spec/set/type/skin_spec.rb +70 -0
- data/mod/04_settings/lib/card/setting.rb +65 -0
- data/mod/04_settings/set/right/add_help.rb +11 -0
- data/mod/04_settings/set/right/comment.rb +91 -0
- data/mod/04_settings/set/right/create.rb +3 -0
- data/mod/04_settings/set/right/default.rb +3 -0
- data/mod/04_settings/set/right/delete.rb +4 -0
- data/mod/04_settings/set/right/help.rb +3 -0
- data/mod/04_settings/set/right/read.rb +2 -0
- data/mod/04_settings/set/right/script.rb +10 -0
- data/mod/04_settings/set/right/structure.rb +4 -0
- data/mod/04_settings/set/right/style.rb +10 -0
- data/mod/04_settings/set/right/update.rb +2 -0
- data/mod/04_settings/set/self/accountable.rb +3 -0
- data/mod/04_settings/set/self/add_help.rb +2 -0
- data/mod/04_settings/set/self/autoname.rb +2 -0
- data/mod/04_settings/set/self/captcha.rb +2 -0
- data/mod/04_settings/set/self/comment.rb +2 -0
- data/mod/04_settings/set/self/create.rb +2 -0
- data/mod/04_settings/set/self/default.rb +2 -0
- data/mod/04_settings/set/self/delete.rb +2 -0
- data/mod/04_settings/set/self/help.rb +2 -0
- data/mod/04_settings/set/self/input.rb +2 -0
- data/mod/04_settings/set/self/layout.rb +2 -0
- data/mod/04_settings/set/self/on_create.rb +2 -0
- data/mod/04_settings/set/self/on_delete.rb +2 -0
- data/mod/04_settings/set/self/on_update.rb +2 -0
- data/mod/04_settings/set/self/options.rb +2 -0
- data/mod/04_settings/set/self/options_label.rb +2 -0
- data/mod/04_settings/set/self/read.rb +2 -0
- data/mod/04_settings/set/self/script.rb +2 -0
- data/mod/04_settings/set/self/structure.rb +2 -0
- data/mod/04_settings/set/self/style.rb +2 -0
- data/mod/04_settings/set/self/table_of_contents.rb +2 -0
- data/mod/04_settings/set/self/thanks.rb +2 -0
- data/mod/04_settings/set/self/update.rb +2 -0
- data/mod/04_settings/set/type/setting.rb +82 -0
- data/mod/04_settings/spec/set/right/add_help_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/comment_spec.rb +41 -0
- data/mod/04_settings/spec/set/right/create_spec.rb +10 -0
- data/mod/04_settings/spec/set/right/default_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/delete_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/help_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/read_spec.rb +5 -0
- data/mod/04_settings/spec/set/right/script_spec.rb +24 -0
- data/mod/04_settings/spec/set/right/structure_spec.rb +17 -0
- data/mod/04_settings/spec/set/right/style_spec.rb +29 -0
- data/mod/04_settings/spec/set/right/update_spec.rb +5 -0
- data/mod/04_settings/spec/set/type/setting_spec.rb +10 -0
- data/mod/05_email/format/email_html_format.rb +9 -0
- data/mod/05_email/format/email_text_format.rb +11 -0
- data/mod/05_email/lib/card/follow_option.rb +90 -0
- data/mod/05_email/set/all/email_html.rb +5 -0
- data/mod/05_email/set/all/email_text.rb +5 -0
- data/mod/05_email/set/all/follow.rb +256 -0
- data/mod/05_email/set/all/notify.rb +223 -0
- data/mod/05_email/set/all/observer.rb +27 -0
- data/mod/05_email/set/right/bcc.rb +45 -0
- data/mod/05_email/set/right/cc.rb +3 -0
- data/mod/05_email/set/right/follow.rb +9 -0
- data/mod/05_email/set/right/follow_fields.rb +3 -0
- data/mod/05_email/set/right/followers.rb +30 -0
- data/mod/05_email/set/right/following.rb +52 -0
- data/mod/05_email/set/right/from.rb +3 -0
- data/mod/05_email/set/right/html_message.rb +3 -0
- data/mod/05_email/set/right/to.rb +3 -0
- data/mod/05_email/set/self/always.rb +14 -0
- data/mod/05_email/set/self/created.rb +21 -0
- data/mod/05_email/set/self/edited.rb +24 -0
- data/mod/05_email/set/self/follow.rb +2 -0
- data/mod/05_email/set/self/follow_defaults.rb +66 -0
- data/mod/05_email/set/self/never.rb +15 -0
- data/mod/05_email/set/type/email_template.rb +113 -0
- data/mod/05_email/set/type_plus_right/user/follow.rb +176 -0
- data/mod/05_email/spec/set/all/follow_spec.rb +133 -0
- data/mod/05_email/spec/set/all/notify_spec.rb +364 -0
- data/mod/05_email/spec/set/all/observer_spec.rb +76 -0
- data/mod/05_email/spec/set/right/followers_spec.rb +126 -0
- data/mod/05_email/spec/set/right/following_spec.rb +4 -0
- data/mod/05_email/spec/set/self/follow_defaults_spec.rb +18 -0
- data/mod/05_standard/file/103/icon-6566.ico +0 -0
- data/mod/05_standard/file/103/large-6566.ico +0 -0
- data/mod/05_standard/file/103/medium-6566.ico +0 -0
- data/mod/05_standard/file/103/original-6566.ico +0 -0
- data/mod/05_standard/file/103/small-6566.ico +0 -0
- data/mod/05_standard/file/79/icon-6556.png +0 -0
- data/mod/05_standard/file/79/large-6556.png +0 -0
- data/mod/05_standard/file/79/medium-6556.png +0 -0
- data/mod/05_standard/file/79/original-6556.png +0 -0
- data/mod/05_standard/file/79/small-6556.png +0 -0
- data/mod/05_standard/file/790/icon-6419.png +0 -0
- data/mod/05_standard/file/790/large-6419.png +0 -0
- data/mod/05_standard/file/790/medium-6419.png +0 -0
- data/mod/05_standard/file/790/original-6419.png +0 -0
- data/mod/05_standard/file/790/small-6419.png +0 -0
- data/mod/05_standard/set/all/account.rb +67 -0
- data/mod/05_standard/set/all/attach.rb +152 -0
- data/mod/05_standard/set/all/comment.rb +39 -0
- data/mod/05_standard/set/all/error.rb +214 -0
- data/mod/05_standard/set/all/event_viz.rb +62 -0
- data/mod/05_standard/set/all/links.rb +110 -0
- data/mod/05_standard/set/all/rich_html/content.rb +173 -0
- data/mod/05_standard/set/all/rich_html/editing.rb +145 -0
- data/mod/05_standard/set/all/rich_html/form.rb +234 -0
- data/mod/05_standard/set/all/rich_html/header.rb +64 -0
- data/mod/05_standard/set/all/rich_html/wrapper.rb +105 -0
- data/mod/05_standard/set/right/account.rb +180 -0
- data/mod/05_standard/set/right/email.rb +52 -0
- data/mod/05_standard/set/right/password.rb +39 -0
- data/mod/05_standard/set/right/salt.rb +5 -0
- data/mod/05_standard/set/right/stats.rb +35 -0
- data/mod/05_standard/set/right/status.rb +9 -0
- data/mod/05_standard/set/right/token.rb +5 -0
- data/mod/05_standard/set/right/when_created.rb +5 -0
- data/mod/05_standard/set/right/when_last_edited.rb +5 -0
- data/mod/05_standard/set/rstar/rules.rb +407 -0
- data/mod/05_standard/set/self/account_links.rb +61 -0
- data/mod/05_standard/set/self/alerts.rb +5 -0
- data/mod/05_standard/set/self/all.rb +21 -0
- data/mod/05_standard/set/self/foot.rb +8 -0
- data/mod/05_standard/set/self/head.rb +121 -0
- data/mod/05_standard/set/self/navbox.rb +20 -0
- data/mod/05_standard/set/self/now.rb +6 -0
- data/mod/05_standard/set/self/recent.rb +48 -0
- data/mod/05_standard/set/self/search.rb +43 -0
- data/mod/05_standard/set/self/signin.rb +121 -0
- data/mod/05_standard/set/self/stats.rb +91 -0
- data/mod/05_standard/set/self/version.rb +9 -0
- data/mod/05_standard/set/type/basic.rb +46 -0
- data/mod/05_standard/set/type/cardtype.rb +43 -0
- data/mod/05_standard/set/type/date.rb +8 -0
- data/mod/05_standard/set/type/file.rb +85 -0
- data/mod/05_standard/set/type/html.rb +22 -0
- data/mod/05_standard/set/type/image.rb +67 -0
- data/mod/05_standard/set/type/layout_type.rb +14 -0
- data/mod/05_standard/set/type/number.rb +19 -0
- data/mod/05_standard/set/type/phrase.rb +3 -0
- data/mod/05_standard/set/type/search_type.rb +243 -0
- data/mod/05_standard/set/type/set.rb +198 -0
- data/mod/05_standard/set/type/signup.rb +144 -0
- data/mod/05_standard/set/type/toggle.rb +12 -0
- data/mod/05_standard/set/type/uri.rb +11 -0
- data/mod/05_standard/set/type/user.rb +72 -0
- data/mod/05_standard/spec/chunk/include_spec.rb +186 -0
- data/mod/05_standard/spec/chunk/link_spec.rb +61 -0
- data/mod/05_standard/spec/format/css_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/csv_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/email_html_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/file_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/js_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/json_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/rss_format_spec.rb +5 -0
- data/mod/05_standard/spec/format/xml_format_spec.rb +5 -0
- data/mod/05_standard/spec/set/all/account_spec.rb +137 -0
- data/mod/05_standard/spec/set/all/attach_spec.rb +9 -0
- data/mod/05_standard/spec/set/all/comment_spec.rb +5 -0
- data/mod/05_standard/spec/set/all/email_html_spec.rb +15 -0
- data/mod/05_standard/spec/set/all/error_spec.rb +9 -0
- data/mod/05_standard/spec/set/all/event_viz_spec.rb +9 -0
- data/mod/05_standard/spec/set/all/history_spec.rb +173 -0
- data/mod/05_standard/spec/set/all/rich_html/form_spec.rb +43 -0
- data/mod/05_standard/spec/set/all/rich_html/wrapper_spec.rb +28 -0
- data/mod/05_standard/spec/set/right/account_spec.rb +162 -0
- data/mod/05_standard/spec/set/right/email_spec.rb +55 -0
- data/mod/05_standard/spec/set/right/password_spec.rb +45 -0
- data/mod/05_standard/spec/set/right/salt_spec.rb +5 -0
- data/mod/05_standard/spec/set/right/stats_spec.rb +13 -0
- data/mod/05_standard/spec/set/right/status_spec.rb +5 -0
- data/mod/05_standard/spec/set/right/token_spec.rb +5 -0
- data/mod/05_standard/spec/set/right/when_created_spec.rb +7 -0
- data/mod/05_standard/spec/set/right/when_last_edited_spec.rb +7 -0
- data/mod/05_standard/spec/set/rstar/rules_spec.rb +25 -0
- data/mod/05_standard/spec/set/self/account_links_spec.rb +9 -0
- data/mod/05_standard/spec/set/self/alerts_spec.rb +5 -0
- data/mod/05_standard/spec/set/self/all_spec.rb +48 -0
- data/mod/05_standard/spec/set/self/foot_spec.rb +5 -0
- data/mod/05_standard/spec/set/self/head_spec.rb +17 -0
- data/mod/05_standard/spec/set/self/navbox_spec.rb +7 -0
- data/mod/05_standard/spec/set/self/now_spec.rb +7 -0
- data/mod/05_standard/spec/set/self/recent_spec.rb +5 -0
- data/mod/05_standard/spec/set/self/search_spec.rb +5 -0
- data/mod/05_standard/spec/set/self/signin_spec.rb +73 -0
- data/mod/05_standard/spec/set/self/stats_spec.rb +12 -0
- data/mod/05_standard/spec/set/self/version_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/basic_spec.rb +5 -0
- data/mod/05_standard/spec/set/type/cardtype_spec.rb +5 -0
- data/mod/05_standard/spec/set/type/date_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/email_template_spec.rb +208 -0
- data/mod/05_standard/spec/set/type/file_spec.rb +5 -0
- data/mod/05_standard/spec/set/type/html_spec.rb +23 -0
- data/mod/05_standard/spec/set/type/image_spec.rb +16 -0
- data/mod/05_standard/spec/set/type/layout_type_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/number_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/phrase_spec.rb +7 -0
- data/mod/05_standard/spec/set/type/search_type_spec.rb +27 -0
- data/mod/05_standard/spec/set/type/set_spec.rb +26 -0
- data/mod/05_standard/spec/set/type/signup_spec.rb +228 -0
- data/mod/05_standard/spec/set/type/toggle_spec.rb +12 -0
- data/mod/05_standard/spec/set/type/uri_spec.rb +41 -0
- data/mod/05_standard/spec/set/type/user_spec.rb +5 -0
- data/mod/06_bootstrap/lib/javascript/bootstrap.js +2306 -0
- data/mod/06_bootstrap/lib/javascript/bootstrap.min.js +7 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap-theme.css +476 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap.css +6565 -0
- data/mod/06_bootstrap/lib/stylesheets/darkly.css +6583 -0
- data/mod/06_bootstrap/set/all/bootstrap/form.rb +37 -0
- data/mod/06_bootstrap/set/all/bootstrap/header.rb +29 -0
- data/mod/06_bootstrap/set/all/bootstrap/wrapper.rb +12 -0
- data/mod/06_bootstrap/set/all/rich_bootstrap.rb +28 -0
- data/mod/06_bootstrap/set/self/bootstrap_css.rb +7 -0
- data/mod/06_bootstrap/set/self/bootstrap_js.rb +7 -0
- data/mod/06_bootstrap/set/self/bootstrap_theme_css.rb +7 -0
- data/mod/06_bootstrap/set/self/navbox.rb +32 -0
- data/mod/06_bootstrap/set/type/search_type.rb +79 -0
- data/mod/06_bootstrap/spec/set/all/bootstrap/form_spec.rb +13 -0
- data/spec/lib/card/action_spec.rb +14 -0
- data/spec/lib/card/auth_spec.rb +17 -0
- data/spec/lib/card/cache_spec.rb +122 -0
- data/spec/lib/card/chunk_spec.rb +17 -0
- data/spec/lib/card/codename_spec.rb +25 -0
- data/spec/lib/card/content_spec.rb +314 -0
- data/spec/lib/card/diff_spec.rb +210 -0
- data/spec/lib/card/format_spec.rb +82 -0
- data/spec/lib/card/loader_spec.rb +39 -0
- data/spec/lib/card/log_spec.rb +270 -0
- data/spec/lib/card/name_spec.rb +279 -0
- data/spec/lib/card/query_spec.rb +456 -0
- data/spec/lib/card/reference_spec.rb +213 -0
- data/spec/lib/card/set_pattern_spec.rb +56 -0
- data/spec/lib/card/set_spec.rb +88 -0
- data/spec/mailers/mailer_spec.rb +64 -0
- data/spec/models/card/cardtype_spec.rb +216 -0
- data/spec/models/card/create_spec.rb +82 -0
- data/spec/models/card/trash_spec.rb +260 -0
- data/spec/models/card/type_transition_spec.rb +161 -0
- data/spec/models/card/validation_spec.rb +36 -0
- data/spec/models/card_spec.rb +177 -0
- data/spec/spec_helper.rb +130 -0
- data/test/fixtures/.gitkeep +0 -0
- data/test/fixtures/card_actions.yml +5706 -0
- data/test/fixtures/card_acts.yml +835 -0
- data/test/fixtures/card_changes.yml +17182 -0
- data/test/fixtures/card_references.yml +5405 -0
- data/test/fixtures/cards.yml +15533 -0
- data/test/fixtures/mao2.jpg +0 -0
- data/test/fixtures/rails.gif +0 -0
- data/test/seed.rb +201 -0
- metadata +762 -38
- data/.gitignore +0 -17
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -29
- data/Rakefile +0 -1
@@ -0,0 +1,39 @@
|
|
1
|
+
event :add_comment, :after=>:approve, :on=>:save, :when=> proc {|c| c.comment } do
|
2
|
+
self.content = %{
|
3
|
+
#{ content }
|
4
|
+
#{ '<hr>' unless content.blank? }
|
5
|
+
#{ comment.split(/\n/).map {|line| "<p>#{line.strip.empty? ? ' ' : line}</p>"} * "\n" }
|
6
|
+
<div class="w-comment-author">--#{
|
7
|
+
if Auth.signed_in?
|
8
|
+
"[[#{Auth.current.name}]]"
|
9
|
+
else
|
10
|
+
Env.session[:comment_author] = comment_author if Env.session
|
11
|
+
"#{ comment_author } (Not signed in)"
|
12
|
+
end
|
13
|
+
}.....#{Time.now}</div>
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
view( :comment_box, :denial=>:blank, :tags=>:unknown_ok, :perms=>lambda { |r| r.card.ok? :comment } ) do |args|
|
18
|
+
|
19
|
+
|
20
|
+
%{<div class="comment-box nodblclick"> #{
|
21
|
+
card_form :update do
|
22
|
+
%{
|
23
|
+
#{ hidden_field_tag( 'card[name]', card.name ) if card.new_card?
|
24
|
+
# FIXME wish we had more generalized solution for names. without this, nonexistent cards will often take left's linkname. (needs test)
|
25
|
+
}
|
26
|
+
#{ text_area :comment, :rows=>3 }
|
27
|
+
<div class="comment-buttons">
|
28
|
+
#{
|
29
|
+
unless Auth.signed_in?
|
30
|
+
card.comment_author= (session[:comment_author] || params[:comment_author] || "Anonymous") #ENGLISH
|
31
|
+
%{<label>My Name is:</label> #{ text_field :comment_author }}
|
32
|
+
end
|
33
|
+
}
|
34
|
+
<input type="submit" value="Comment"/>
|
35
|
+
</div>
|
36
|
+
}
|
37
|
+
end}
|
38
|
+
</div>}
|
39
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
format do
|
4
|
+
view :closed_missing, :perms=>:none, :closed=>true do |args|
|
5
|
+
''
|
6
|
+
end
|
7
|
+
|
8
|
+
view :missing, :perms=>:none do |args|
|
9
|
+
''
|
10
|
+
end
|
11
|
+
|
12
|
+
view :not_found, :perms=>:none, :error_code=>404 do |args|
|
13
|
+
%{ Could not find #{card.name.present? ? %{"#{card.name}"} : 'the card requested'}. }
|
14
|
+
end
|
15
|
+
|
16
|
+
view :server_error, :perms=>:none, :error_code=>500 do |args|
|
17
|
+
%{ Wagn Hitch! Server Error. Yuck, sorry about that.\n}+
|
18
|
+
%{ To tell us more and follow the fix, add a support ticket at http://wagn.org/new/Support_Ticket }
|
19
|
+
end
|
20
|
+
|
21
|
+
view :denial, :perms=>:none, :error_code=>403 do |args|
|
22
|
+
focal? ? 'Permission Denied' : ''
|
23
|
+
end
|
24
|
+
|
25
|
+
view :bad_address, :perms=>:none, :error_code=>404 do |args|
|
26
|
+
%{ 404: Bad Address }
|
27
|
+
end
|
28
|
+
|
29
|
+
view :too_deep, :perms=>:none, :closed=>true do |args|
|
30
|
+
%{ Man, you're too deep. (Too many levels of inclusions at a time) }
|
31
|
+
end
|
32
|
+
|
33
|
+
view :too_slow, :perms=>:none, :closed=>true do |args|
|
34
|
+
%{ Timed out! #{ showname } took too long to load. }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
format :html do
|
40
|
+
def view_for_unknown view, args
|
41
|
+
case
|
42
|
+
when focal? && ok?( :create ) ; :new
|
43
|
+
when commentable?( view, args ) ; view
|
44
|
+
else super
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def commentable? view, args
|
49
|
+
self.class.tagged view, :comment and
|
50
|
+
show_view? :comment_box, args.merge( :default_visibility=>:hide ) and #developer or wagneer has overridden default
|
51
|
+
ok? :comment
|
52
|
+
end
|
53
|
+
|
54
|
+
def rendering_error exception, view
|
55
|
+
details = if Auth.always_ok?
|
56
|
+
card_link(error_cardname, :class=>'render-error-link') +
|
57
|
+
alert('warning', :dismissible=>true, :alert_class=>"render-error-message errors-view admin-error-message") do
|
58
|
+
%{
|
59
|
+
<h3>Error message (visible to admin only)</h3>
|
60
|
+
<p><strong>#{ exception.message }</strong></p>
|
61
|
+
<div>
|
62
|
+
#{exception.backtrace * "<br>\n"}
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
}
|
66
|
+
end
|
67
|
+
else
|
68
|
+
error_cardname
|
69
|
+
end
|
70
|
+
|
71
|
+
content_tag :span, :class=>'render-error' do
|
72
|
+
[
|
73
|
+
'error rendering',
|
74
|
+
details,
|
75
|
+
"(#{view} view)"
|
76
|
+
].join "\n"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def unsupported_view view
|
81
|
+
"<strong>view <em>#{view}</em> not supported for <em>#{error_cardname}</em></strong>"
|
82
|
+
end
|
83
|
+
|
84
|
+
view :message, :perms=>:none, :tags=>:unknown_ok do |args|
|
85
|
+
frame args do
|
86
|
+
params[:message]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
view :missing do |args|
|
92
|
+
return '' unless card.ok? :create # should this be moved into ok_view?
|
93
|
+
|
94
|
+
opts = { :remote=>true, :class=>"slotter missing-#{ args[:denied_view] || args[:home_view]}" }
|
95
|
+
opts[:path_opts] = { :type=> args[:type] } if args[:type]
|
96
|
+
|
97
|
+
wrap args do
|
98
|
+
view_link "Add #{ fancy_title args[:title] }", :new, opts
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
view :closed_missing, :perms=>:none do |args|
|
103
|
+
%{<span class="faint"> #{ showname } </span>}
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
view :conflict, :error_code=>409 do |args|
|
109
|
+
# FIXME: hack to get the conflicted update as a proper act for the diff view
|
110
|
+
card.current_act.save
|
111
|
+
action = card.actions.last # the unsaved action with the new changes
|
112
|
+
action.card_act_id = card.current_act.id
|
113
|
+
action.draft = true
|
114
|
+
action.save
|
115
|
+
card.store_changes # deletes action if there are no changes
|
116
|
+
|
117
|
+
# as a consequence card.current_act.actions can be empty when both users made exactly the same changes
|
118
|
+
# but an act is always supposed to have at least one action, so we have to delete the act to avoid bad things
|
119
|
+
card.current_act.reload
|
120
|
+
if card.current_act.actions.empty?
|
121
|
+
card.current_act.delete
|
122
|
+
card.current_act = nil
|
123
|
+
end
|
124
|
+
|
125
|
+
wrap args.merge( :slot_class=>'error-view' ) do #ENGLISH below
|
126
|
+
alert 'warning' do
|
127
|
+
%{<strong>Conflict!</strong><span class="new-current-revision-id">#{card.last_action_id}</span>
|
128
|
+
<div>#{ card_link card.last_action.act.actor.cardname } has also been making changes.</div>
|
129
|
+
<div>Please examine below, resolve above, and re-submit.</div>
|
130
|
+
#{ wrap do |args|
|
131
|
+
if card.current_act
|
132
|
+
_render_act_expanded :act=>card.current_act, :current_rev_nr => 0
|
133
|
+
else
|
134
|
+
"No difference between your changes and #{card.last_action.act.actor.name}'s version."
|
135
|
+
end
|
136
|
+
end
|
137
|
+
}
|
138
|
+
}
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
view :errors, :perms=>:none do |args|
|
144
|
+
if card.errors.any?
|
145
|
+
title = %{ Problems #{%{ with #{card.name} } unless card.name.blank?} }
|
146
|
+
frame args.merge(:slot_class=>"panel panel-warning", :title=>title, :hide=>'menu' ) do
|
147
|
+
card.errors.map do |attrib, msg|
|
148
|
+
msg = "<strong>#{attrib.to_s.upcase}:</strong> #{msg}" unless attrib == :abort
|
149
|
+
alert 'warning', :dismissible=>true, :alert_class=>'card-error-msg' do
|
150
|
+
msg
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
view :not_found do |args| #ug. bad name.
|
158
|
+
sign_in_or_up_links = if !Auth.signed_in?
|
159
|
+
%{<div>
|
160
|
+
#{ card_link :signin, :text=>'Sign in' } or
|
161
|
+
#{ link_to 'Sign up', card_path('new/:signup') } to create it.
|
162
|
+
</div>}
|
163
|
+
end
|
164
|
+
frame args.merge(:title=>'Not Found', :optional_menu=>:never) do
|
165
|
+
%{
|
166
|
+
<h2>Could not find #{card.name.present? ? "<em>#{card.name}</em>" : 'that'}.</h2>
|
167
|
+
#{sign_in_or_up_links}
|
168
|
+
}
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
view :denial do |args|
|
173
|
+
to_task = if task = args[:denied_task]
|
174
|
+
%{to #{task} this.}
|
175
|
+
else
|
176
|
+
'to do that.'
|
177
|
+
end
|
178
|
+
if !focal?
|
179
|
+
%{<span class="denied"><!-- Sorry, you don't have permission #{to_task} --></span>}
|
180
|
+
else
|
181
|
+
frame args do #ENGLISH below
|
182
|
+
message = case
|
183
|
+
when task != :read && Card.config.read_only
|
184
|
+
"We are currently in read-only mode. Please try again later."
|
185
|
+
when Auth.signed_in?
|
186
|
+
"You need permission #{to_task}"
|
187
|
+
else
|
188
|
+
or_signup = if Card.new(:type_id=>Card::SignupID).ok? :create
|
189
|
+
"or #{ link_to 'sign up', card_url('new/:signup') }"
|
190
|
+
end
|
191
|
+
save_interrupted_action(request.env['REQUEST_URI'])
|
192
|
+
"You have to #{ link_to 'sign in', card_url(':signin') } #{or_signup} #{to_task}"
|
193
|
+
end
|
194
|
+
|
195
|
+
%{<h1>Sorry!</h1>\n<div>#{ message }</div>}
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
|
201
|
+
view :server_error do |args|
|
202
|
+
%{
|
203
|
+
<body>
|
204
|
+
<div class="dialog">
|
205
|
+
<h1>Wagn Hitch :(</h1>
|
206
|
+
<p>Server Error. Yuck, sorry about that.</p>
|
207
|
+
<p><a href="http://www.wagn.org/new/Support_Ticket">Add a support ticket</a>
|
208
|
+
to tell us more and follow the fix.</p>
|
209
|
+
</div>
|
210
|
+
</body>
|
211
|
+
}
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#~~~~~~~~~~~~~~~~
|
2
|
+
# EXPERIMENTAL
|
3
|
+
# the following methods are for visualing card events
|
4
|
+
# not ready for prime time!
|
5
|
+
|
6
|
+
def events action
|
7
|
+
@action = action
|
8
|
+
root = _validate_callbacks + _save_callbacks
|
9
|
+
events = [ events_tree(:validation), events_tree(:save)]
|
10
|
+
@action = nil
|
11
|
+
puts_events events
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def puts_events events, prefix='', depth=0
|
17
|
+
r = ''
|
18
|
+
depth += 1
|
19
|
+
events.each do |e|
|
20
|
+
space = ' ' * (depth * 2)
|
21
|
+
|
22
|
+
#FIXME - this is not right. before and around callbacks are processed in declaration order regardless of kind.
|
23
|
+
# not all befores then all arounds
|
24
|
+
|
25
|
+
if e[:before]
|
26
|
+
r += puts_events( e[:before], space+'v ', depth)
|
27
|
+
end
|
28
|
+
if e[:around]
|
29
|
+
r += puts_events( e[:around], space+'vv ', depth )
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
output = "#{prefix}#{e[:name]}"
|
34
|
+
#warn output
|
35
|
+
r+= "#{output}\n"
|
36
|
+
|
37
|
+
if e[:after]
|
38
|
+
r += puts_events( e[:after ].reverse, space+'^ ', depth )
|
39
|
+
end
|
40
|
+
end
|
41
|
+
r
|
42
|
+
end
|
43
|
+
|
44
|
+
def events_tree filt
|
45
|
+
hash = {:name => filt }
|
46
|
+
if respond_to? "_#{filt}_callbacks"
|
47
|
+
send( "_#{filt}_callbacks" ).each do |callback|
|
48
|
+
next unless callback.applies? self
|
49
|
+
hash[callback.kind] ||= []
|
50
|
+
hash[callback.kind] << events_tree( callback.filter )
|
51
|
+
end
|
52
|
+
end
|
53
|
+
hash
|
54
|
+
end
|
55
|
+
#FIXME - this doesn't belong here!!
|
56
|
+
|
57
|
+
class ::ActiveSupport::Callbacks::Callback
|
58
|
+
def applies? object
|
59
|
+
object.send :eval, "value=nil;halted=false;!!(#{@compiled_options})"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
@@ -0,0 +1,110 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
format do
|
4
|
+
|
5
|
+
# link is called by web_link, card_link, and view_link
|
6
|
+
# (and is overridden in other formats)
|
7
|
+
def link_to text, href, opts={}
|
8
|
+
href = interpret_href href
|
9
|
+
|
10
|
+
if text and href != text
|
11
|
+
"#{text}[#{href}]"
|
12
|
+
else
|
13
|
+
href
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# link to a specific url or path
|
18
|
+
def web_link href, opts={}
|
19
|
+
text = opts.delete(:text) || href
|
20
|
+
new_class = case href
|
21
|
+
when /^https?:/ ; 'external-link'
|
22
|
+
when /^mailto:/ ; 'email-link'
|
23
|
+
when /^([a-zA-Z][\-+\.a-zA-Z\d]*):/ ; $1 + '-link'
|
24
|
+
when /^\//
|
25
|
+
href = internal_url href[1..-1] ; 'internal-link'
|
26
|
+
else
|
27
|
+
return card_link href, opts
|
28
|
+
end
|
29
|
+
add_class opts, new_class
|
30
|
+
link_to text, href, opts
|
31
|
+
end
|
32
|
+
|
33
|
+
# link to a specific card
|
34
|
+
def card_link name_or_card, opts={}
|
35
|
+
text = (opts.delete(:text) || name_or_card).to_name.to_show @context_names
|
36
|
+
name = case name_or_card
|
37
|
+
when Symbol then Card.fetch( name_or_card, :skip_modules=>true ).cardname
|
38
|
+
when Card then name_or_card.cardname
|
39
|
+
else name_or_card
|
40
|
+
end
|
41
|
+
|
42
|
+
path_opts = opts.delete( :path_opts ) || {}
|
43
|
+
path_opts[:name ] = name
|
44
|
+
path_opts[:known] = opts[:known].nil? ? Card.known?(name) : opts.delete(:known)
|
45
|
+
add_class opts, ( path_opts[:known] ? 'known-card' : 'wanted-card' )
|
46
|
+
link_to text, path_opts, opts
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# link to a specific view (defaults to current card)
|
51
|
+
# this is generally used for ajax calls
|
52
|
+
def view_link text, view, opts={}
|
53
|
+
path_opts = opts.delete( :path_opts ) || {}
|
54
|
+
path_opts[:view] = view unless view == :home
|
55
|
+
opts[:remote] = true
|
56
|
+
opts[:rel] = 'nofollow'
|
57
|
+
|
58
|
+
link_to text, path_opts, opts
|
59
|
+
end
|
60
|
+
|
61
|
+
def path opts={}
|
62
|
+
name = opts.delete(:name) || card.name
|
63
|
+
base = opts[:action] ? "card/#{ opts.delete :action }/" : ''
|
64
|
+
|
65
|
+
opts[:no_id] = true if [:new, :create].member? opts[:action]
|
66
|
+
#generalize. dislike hardcoding views/actions here
|
67
|
+
|
68
|
+
linkname = name.to_name.url_key
|
69
|
+
unless name.empty? || opts.delete(:no_id)
|
70
|
+
base += ( opts[:id] ? "~#{ opts.delete :id }" : linkname )
|
71
|
+
end
|
72
|
+
|
73
|
+
opts[:card] = {}
|
74
|
+
opts[:card][:name] = name if opts.delete(:known)==false && name.present? && name.to_s != linkname
|
75
|
+
|
76
|
+
if type = opts.delete(:type) and Card.known?( type )
|
77
|
+
opts[:card][:type] = type
|
78
|
+
end
|
79
|
+
opts.delete(:card) if opts[:card].empty?
|
80
|
+
|
81
|
+
query = opts.empty? ? '' : "?#{opts.to_param}"
|
82
|
+
internal_url( base + query )
|
83
|
+
end
|
84
|
+
|
85
|
+
def internal_url relative_path
|
86
|
+
card_path relative_path
|
87
|
+
end
|
88
|
+
|
89
|
+
def interpret_href href
|
90
|
+
Hash===href ? path(href) : href
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
format :html do
|
96
|
+
|
97
|
+
|
98
|
+
def link_to text, href, opts={}
|
99
|
+
href = interpret_href href
|
100
|
+
|
101
|
+
[:remote, :method].each do |key|
|
102
|
+
if val = opts.delete(key)
|
103
|
+
opts["data-#{key}"] = val
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
content_tag :a, raw(text), opts.merge(:href=>href)
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
|
2
|
+
format :html do
|
3
|
+
|
4
|
+
def show view, args
|
5
|
+
if Env.ajax?
|
6
|
+
view ||= args[:home_view] || :open
|
7
|
+
@inclusion_opts = args.delete(:items)
|
8
|
+
render view, args
|
9
|
+
else
|
10
|
+
args.merge! :view=>view if view
|
11
|
+
@main_opts = args
|
12
|
+
self.render :layout
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
view :layout, :perms=>:none do |args|
|
17
|
+
process_content get_layout_content, :content_opts=>{ :chunk_list=>:references }
|
18
|
+
end
|
19
|
+
|
20
|
+
view :content do |args|
|
21
|
+
wrap args.merge(:slot_class=>'card-content') do
|
22
|
+
[
|
23
|
+
_optional_render( :menu, args, :hide ),
|
24
|
+
_render_core( args )
|
25
|
+
]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
view :titled, :tags=>:comment do |args|
|
30
|
+
wrap args do
|
31
|
+
[
|
32
|
+
_render_header( args.reverse_merge :optional_menu=>:hide ),
|
33
|
+
wrap_body( :content=>true ) { _render_core args },
|
34
|
+
optional_render( :comment_box, args )
|
35
|
+
]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
view :labeled do |args|
|
40
|
+
wrap args do
|
41
|
+
[
|
42
|
+
_optional_render( :menu, args ),
|
43
|
+
"<label>#{ _render_title args }</label>",
|
44
|
+
wrap_body( :body_class=>'closed-content', :content=>true ) do
|
45
|
+
_render_closed_content args
|
46
|
+
end
|
47
|
+
]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
view :title do |args|
|
52
|
+
title = fancy_title args[:title]
|
53
|
+
title = _optional_render( :title_link, args.merge( :title_ready=>title ), :hide ) || title
|
54
|
+
add_name_context
|
55
|
+
title
|
56
|
+
end
|
57
|
+
|
58
|
+
view :title_link do |args|
|
59
|
+
card_link card.cardname, :text=>( args[:title_ready] || showname(args[:title]) )
|
60
|
+
end
|
61
|
+
|
62
|
+
view :open, :tags=>:comment do |args|
|
63
|
+
args[:optional_toggle] ||= main? ? :hide : :show
|
64
|
+
frame args.merge(:content=>true) do
|
65
|
+
[
|
66
|
+
_render_open_content( args ),
|
67
|
+
optional_render( :comment_box, args )
|
68
|
+
]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
=begin
|
75
|
+
view :anchor, :perms=>:none, :tags=>:unknown_ok do |args|
|
76
|
+
%{ <a id="#{card.cardname.url_key}" name="#{card.cardname.url_key}"></a> }
|
77
|
+
end
|
78
|
+
=end
|
79
|
+
|
80
|
+
view :type do |args|
|
81
|
+
klasses = ['cardtype']
|
82
|
+
klass = args[:type_class] and klasses << klass
|
83
|
+
card_link card.type_card.name, :class=>klasses
|
84
|
+
end
|
85
|
+
|
86
|
+
view :closed do |args|
|
87
|
+
frame args.reverse_merge(:content=>true, :body_class=>'closed-content', :toggle_mode=>:close, :optional_toggle=>:show ) do
|
88
|
+
_optional_render :closed_content, args
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
view :change do |args|
|
94
|
+
args[:optional_title_link] = :show
|
95
|
+
wrap args do
|
96
|
+
[
|
97
|
+
_optional_render( :title, args ),
|
98
|
+
_optional_render( :menu, args, :hide ),
|
99
|
+
_optional_render( :last_action, args )
|
100
|
+
]
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
view :options, :tags=>:unknown_ok do |args|
|
105
|
+
current_set = Card.fetch( params[:current_set] || card.related_sets[0][0] )
|
106
|
+
|
107
|
+
frame args do
|
108
|
+
subformat( current_set ).render_content
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
view :related do |args|
|
114
|
+
if rparams = params[:related]
|
115
|
+
rcardname = rparams[:name].to_name.to_absolute_name( card.cardname)
|
116
|
+
rcard = Card.fetch rcardname, :new=>{}
|
117
|
+
|
118
|
+
nest_args = {
|
119
|
+
:view => ( rparams[:view] || :open ),
|
120
|
+
:optional_toggle => :hide,
|
121
|
+
:optional_help => :show,
|
122
|
+
:optional_menu => :show
|
123
|
+
}
|
124
|
+
|
125
|
+
nest_args[:optional_comment_box] = :show if rparams[:name] == '+discussion' #fixme. yuck!
|
126
|
+
|
127
|
+
frame args do
|
128
|
+
nest rcard, nest_args
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
view :help, :tags=>:unknown_ok do |args|
|
134
|
+
text = if args[:help_text]
|
135
|
+
args[:help_text]
|
136
|
+
else
|
137
|
+
setting = card.new_card? ? [ :add_help, { :fallback => :help } ] : :help
|
138
|
+
if help_card = card.rule_card( *setting ) and help_card.ok? :read
|
139
|
+
with_inclusion_mode :normal do
|
140
|
+
process_content _render_raw( args.merge :structure=>help_card.name ), :content_opts=>{ :chunk_list=>:references }
|
141
|
+
# render help card with current card's format so current card's context is used in help card inclusions
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
%{<div class="instruction">#{raw text}</div>} if text
|
146
|
+
end
|
147
|
+
|
148
|
+
|
149
|
+
view :last_action do |args|
|
150
|
+
action_type = case ( action = card.last_act.action_on(card.id) and action.action_type )
|
151
|
+
when :create then 'added'
|
152
|
+
when :delete then 'deleted'
|
153
|
+
else
|
154
|
+
link_to('edited', path(:view=>:history), :class=>'last-edited', :rel=>'nofollow')
|
155
|
+
end
|
156
|
+
%{
|
157
|
+
<span class="last-update">
|
158
|
+
#{ action_type }
|
159
|
+
#{ _render_acted_at }
|
160
|
+
ago by
|
161
|
+
#{ subformat(card.last_actor)._render_link }
|
162
|
+
</span>
|
163
|
+
}
|
164
|
+
end
|
165
|
+
|
166
|
+
private
|
167
|
+
|
168
|
+
def fancy_title title=nil
|
169
|
+
raw %{<span class="card-title">#{ showname(title).to_name.parts.join %{<span class="joint">+</span>} }</span>}
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
|