card 1.16.1 → 1.16.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardoc/checksums +60 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/.yardopts +6 -0
- data/README_Developers.rdoc +100 -0
- data/VERSION +1 -1
- data/card.gemspec +18 -18
- data/db/migrate/20150724210803_add_comment_to_actions.rb +5 -0
- data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +70 -0
- data/db/migrate_core_cards/20150807205221_create_references_for_search_cards.rb +10 -0
- data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +4 -2
- data/db/schema.rb +2 -1
- data/db/seed/new/card_actions.yml +2334 -12538
- data/db/seed/new/card_acts.yml +1 -1
- data/db/seed/new/card_changes.yml +7384 -38929
- data/db/seed/new/card_references.yml +207 -207
- data/db/seed/new/cards.yml +1364 -1440
- data/db/seed/test/fixtures/card_actions.yml +3285 -13219
- data/db/seed/test/fixtures/card_acts.yml +107 -107
- data/db/seed/test/fixtures/card_changes.yml +10830 -42375
- data/db/seed/test/fixtures/card_references.yml +393 -393
- data/db/seed/test/fixtures/cards.yml +1701 -1777
- data/db/version.txt +1 -1
- data/db/version_core_cards.txt +1 -1
- data/lib/card.rb +13 -3
- data/lib/card/chunk.rb +22 -15
- data/lib/card/content.rb +9 -8
- data/lib/card/diff.rb +79 -79
- data/lib/card/loader.rb +33 -33
- data/lib/card/name.rb +8 -0
- data/lib/card/set.rb +44 -17
- data/lib/card/set_pattern.rb +8 -0
- data/lib/cardio.rb +19 -3
- data/mod/01_core/chunk/link.rb +7 -6
- data/mod/01_core/chunk/query_reference.rb +65 -0
- data/mod/01_core/set/all/content.rb +1 -1
- data/mod/01_core/set/all/fetch.rb +15 -7
- data/mod/01_core/set/all/initialize.rb +4 -3
- data/mod/01_core/set/all/phases.rb +12 -8
- data/mod/01_core/set/all/references.rb +12 -6
- data/mod/01_core/set/all/rules.rb +14 -11
- data/mod/01_core/set/all/states.rb +2 -1
- data/mod/01_core/set/all/tracked_attributes.rb +14 -0
- data/mod/01_core/spec/set/all/collection_spec.rb +5 -5
- data/mod/01_core/spec/set/all/name_spec.rb +6 -6
- data/mod/01_history/lib/card/act.rb +2 -2
- data/mod/01_history/lib/card/action.rb +11 -2
- data/mod/01_history/set/all/actions.rb +4 -3
- data/mod/01_history/set/all/content_history.rb +1 -1
- data/mod/01_history/set/all/history.rb +55 -66
- data/mod/02_basic_types/set/all/file.rb +26 -3
- data/mod/02_basic_types/set/type/pointer.rb +13 -14
- data/mod/02_basic_types/spec/set/all/file_spec.rb +0 -1
- data/mod/03_machines/lib/card/machine.rb +4 -4
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +4 -17
- data/mod/03_machines/lib/stylesheets/style_cards.scss +5 -0
- data/mod/03_machines/set/right/machine_input.rb +3 -0
- data/mod/03_machines/set/right/machine_output.rb +4 -0
- data/mod/04_settings/lib/card/setting.rb +2 -1
- data/mod/04_settings/set/abstract/permission.rb +95 -0
- data/mod/04_settings/set/right/comment.rb +2 -90
- data/mod/04_settings/set/right/create.rb +2 -2
- data/mod/04_settings/set/right/delete.rb +2 -3
- data/mod/04_settings/set/right/read.rb +3 -2
- data/mod/04_settings/set/right/update.rb +3 -2
- data/mod/04_settings/set/self/recent_settings.rb +3 -0
- data/mod/04_settings/set/type/setting.rb +9 -1
- data/mod/05_email/set/all/notify.rb +2 -1
- data/mod/05_email/set/type/email_template.rb +17 -17
- data/mod/05_standard/file/credit_image/image-icon.png +0 -0
- data/mod/05_standard/file/credit_image/image-large.png +0 -0
- data/mod/05_standard/file/credit_image/image-medium.png +0 -0
- data/mod/05_standard/file/credit_image/image-original.png +0 -0
- data/mod/05_standard/file/credit_image/image-small.png +0 -0
- data/mod/05_standard/file/favicon/{icon-image.png → image-icon.png} +0 -0
- data/mod/05_standard/file/favicon/{large-image.png → image-large.png} +0 -0
- data/mod/05_standard/file/favicon/{medium-image.png → image-medium.png} +0 -0
- data/mod/05_standard/file/favicon/{original-image.png → image-original.png} +0 -0
- data/mod/05_standard/file/favicon/{small-image.png → image-small.png} +0 -0
- data/mod/05_standard/file/logo/{icon-image.png → image-icon.png} +0 -0
- data/mod/05_standard/file/logo/{large-image.png → image-large.png} +0 -0
- data/mod/05_standard/file/logo/{medium-image.png → image-medium.png} +0 -0
- data/mod/05_standard/file/logo/{original-image.png → image-original.png} +0 -0
- data/mod/05_standard/file/logo/{small-image.png → image-small.png} +0 -0
- data/mod/05_standard/lib/carrier_wave/cardmount.rb +79 -0
- data/mod/05_standard/lib/file_uploader.rb +127 -0
- data/mod/05_standard/lib/image_uploader.rb +35 -0
- data/mod/05_standard/set/abstract/attachment.rb +85 -0
- data/mod/05_standard/set/all/error.rb +1 -18
- data/mod/05_standard/set/all/event_viz.rb +17 -14
- data/mod/05_standard/set/all/rich_html/editing.rb +10 -10
- data/mod/05_standard/set/all/rich_html/toolbar.rb +44 -37
- data/mod/05_standard/set/right/account.rb +1 -1
- data/mod/05_standard/set/right/password.rb +9 -10
- data/mod/05_standard/set/self/recent.rb +1 -1
- data/mod/05_standard/set/type/file.rb +43 -31
- data/mod/05_standard/set/type/image.rb +22 -6
- data/mod/05_standard/set/type/search_type.rb +4 -2
- data/mod/05_standard/set/type/session.rb +7 -5
- data/mod/05_standard/set/type/set.rb +3 -1
- data/mod/05_standard/spec/set/all/history_spec.rb +1 -1
- data/mod/05_standard/spec/set/type/cardtype_spec.rb +3 -3
- data/mod/05_standard/spec/set/type/file_spec.rb +85 -1
- data/mod/05_standard/spec/set/type/image_spec.rb +89 -5
- data/mod/05_standard/spec/set/type/search_type_spec.rb +16 -1
- data/mod/06_bootstrap/file/{cerulean_skin/icon-image.png → cerulean_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{cerulean_skin/large-image.png → cerulean_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{cerulean_skin/medium-image.png → cerulean_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{cerulean_skin/original-image.png → cerulean_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{cerulean_skin/small-image.png → cerulean_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{cosmo_skin/icon-image.png → cosmo_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{cosmo_skin/large-image.png → cosmo_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{cosmo_skin/medium-image.png → cosmo_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{cosmo_skin/original-image.png → cosmo_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{cosmo_skin/small-image.png → cosmo_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{cyborg_skin/icon-image.png → cyborg_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{cyborg_skin/large-image.png → cyborg_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{cyborg_skin/medium-image.png → cyborg_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{cyborg_skin/original-image.png → cyborg_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{cyborg_skin/small-image.png → cyborg_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{darkly_skin/icon-image.png → darkly_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{darkly_skin/large-image.png → darkly_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{darkly_skin/medium-image.png → darkly_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{darkly_skin/original-image.png → darkly_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{darkly_skin/small-image.png → darkly_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{flatly_skin/icon-image.png → flatly_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{flatly_skin/large-image.png → flatly_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{flatly_skin/medium-image.png → flatly_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{flatly_skin/original-image.png → flatly_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{flatly_skin/small-image.png → flatly_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{journal_skin/icon-image.png → journal_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{journal_skin/large-image.png → journal_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{journal_skin/medium-image.png → journal_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{journal_skin/original-image.png → journal_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{journal_skin/small-image.png → journal_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{lumen_skin/icon-image.png → lumen_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{lumen_skin/large-image.png → lumen_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{lumen_skin/medium-image.png → lumen_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{lumen_skin/original-image.png → lumen_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{lumen_skin/small-image.png → lumen_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{paper_skin/icon-image.png → paper_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{paper_skin/large-image.png → paper_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{paper_skin/medium-image.png → paper_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{paper_skin/original-image.png → paper_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{paper_skin/small-image.png → paper_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{readable_skin/icon-image.png → readable_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{readable_skin/large-image.png → readable_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{readable_skin/medium-image.png → readable_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{readable_skin/original-image.png → readable_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{readable_skin/small-image.png → readable_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{sandstone_skin/icon-image.png → sandstone_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{sandstone_skin/large-image.png → sandstone_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{sandstone_skin/medium-image.png → sandstone_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{sandstone_skin/original-image.png → sandstone_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{sandstone_skin/small-image.png → sandstone_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{simplex_skin/icon-image.png → simplex_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{simplex_skin/large-image.png → simplex_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{simplex_skin/medium-image.png → simplex_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{simplex_skin/original-image.png → simplex_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{simplex_skin/small-image.png → simplex_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{slate_skin/icon-image.png → slate_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{slate_skin/large-image.png → slate_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{slate_skin/medium-image.png → slate_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{slate_skin/original-image.png → slate_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{slate_skin/small-image.png → slate_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{spacelab_skin/icon-image.png → spacelab_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{spacelab_skin/large-image.png → spacelab_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{spacelab_skin/medium-image.png → spacelab_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{spacelab_skin/original-image.png → spacelab_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{spacelab_skin/small-image.png → spacelab_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{superhero_skin/icon-image.png → superhero_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{superhero_skin/large-image.png → superhero_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{superhero_skin/medium-image.png → superhero_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{superhero_skin/original-image.png → superhero_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{superhero_skin/small-image.png → superhero_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{united_skin/icon-image.png → united_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{united_skin/large-image.png → united_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{united_skin/medium-image.png → united_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{united_skin/original-image.png → united_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{united_skin/small-image.png → united_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/file/{yeti_skin/icon-image.png → yeti_skin_image/image-icon.png} +0 -0
- data/mod/06_bootstrap/file/{yeti_skin/large-image.png → yeti_skin_image/image-large.png} +0 -0
- data/mod/06_bootstrap/file/{yeti_skin/medium-image.png → yeti_skin_image/image-medium.png} +0 -0
- data/mod/06_bootstrap/file/{yeti_skin/original-image.png → yeti_skin_image/image-original.png} +0 -0
- data/mod/06_bootstrap/file/{yeti_skin/small-image.png → yeti_skin_image/image-small.png} +0 -0
- data/mod/06_bootstrap/lib/stylesheets/bootstrap_cards.scss +5 -3
- data/spec/lib/card/reference_spec.rb +8 -1
- data/tmpsets/README.md +2 -0
- data/tmpsets/set/mod001-01_core/all/active_card.rb +40 -0
- data/tmpsets/set/mod001-01_core/all/collection.rb +348 -0
- data/tmpsets/set/mod001-01_core/all/content.rb +68 -0
- data/tmpsets/set/mod001-01_core/all/erb.rb +17 -0
- data/tmpsets/set/mod001-01_core/all/fetch.rb +242 -0
- data/tmpsets/set/mod001-01_core/all/haml.rb +13 -0
- data/tmpsets/set/mod001-01_core/all/initialize.rb +56 -0
- data/tmpsets/set/mod001-01_core/all/name.rb +279 -0
- data/tmpsets/set/mod001-01_core/all/pattern.rb +62 -0
- data/tmpsets/set/mod001-01_core/all/permissions.rb +289 -0
- data/tmpsets/set/mod001-01_core/all/phases.rb +187 -0
- data/tmpsets/set/mod001-01_core/all/references.rb +130 -0
- data/tmpsets/set/mod001-01_core/all/rules.rb +324 -0
- data/tmpsets/set/mod001-01_core/all/states.rb +28 -0
- data/tmpsets/set/mod001-01_core/all/templating.rb +132 -0
- data/tmpsets/set/mod001-01_core/all/tracked_attributes.rb +136 -0
- data/tmpsets/set/mod001-01_core/all/trash.rb +56 -0
- data/tmpsets/set/mod001-01_core/all/type.rb +91 -0
- data/tmpsets/set/mod001-01_core/all/utils.rb +162 -0
- data/tmpsets/set/mod001-01_core/all/view_cache.rb +14 -0
- data/tmpsets/set/mod002-01_history/all/actions.rb +54 -0
- data/tmpsets/set/mod002-01_history/all/content_history.rb +140 -0
- data/tmpsets/set/mod002-01_history/all/history.rb +341 -0
- data/tmpsets/set/mod003-02_basic_types/all/all_css.rb +48 -0
- data/tmpsets/set/mod003-02_basic_types/all/all_csv.rb +58 -0
- data/tmpsets/set/mod003-02_basic_types/all/all_js.rb +13 -0
- data/tmpsets/set/mod003-02_basic_types/all/base.rb +128 -0
- data/tmpsets/set/mod003-02_basic_types/all/file.rb +42 -0
- data/tmpsets/set/mod003-02_basic_types/all/json.rb +72 -0
- data/tmpsets/set/mod003-02_basic_types/all/rss.rb +78 -0
- data/tmpsets/set/mod003-02_basic_types/all/text.rb +14 -0
- data/tmpsets/set/mod003-02_basic_types/type/html.rb +33 -0
- data/tmpsets/set/mod003-02_basic_types/type/plain_text.rb +16 -0
- data/tmpsets/set/mod003-02_basic_types/type/pointer.rb +358 -0
- data/tmpsets/set/mod004-03_machines/right/machine_input.rb +8 -0
- data/tmpsets/set/mod004-03_machines/right/machine_output.rb +30 -0
- data/tmpsets/set/mod004-03_machines/self/script_ace.rb +18 -0
- data/tmpsets/set/mod004-03_machines/self/script_card_menu.rb +17 -0
- data/tmpsets/set/mod004-03_machines/self/script_html5shiv_printshiv.rb +8 -0
- data/tmpsets/set/mod004-03_machines/self/script_jquery.rb +8 -0
- data/tmpsets/set/mod004-03_machines/self/script_jquery_helper.rb +18 -0
- data/tmpsets/set/mod004-03_machines/self/script_slot.rb +13 -0
- data/tmpsets/set/mod004-03_machines/self/script_tinymce.rb +8 -0
- data/tmpsets/set/mod004-03_machines/self/style_bootstrap_compatible.rb +11 -0
- data/tmpsets/set/mod004-03_machines/self/style_cards.rb +12 -0
- data/tmpsets/set/mod004-03_machines/self/style_jquery_ui_smoothness.rb +9 -0
- data/tmpsets/set/mod004-03_machines/type/coffee_script.rb +67 -0
- data/tmpsets/set/mod004-03_machines/type/css.rb +55 -0
- data/tmpsets/set/mod004-03_machines/type/java_script.rb +43 -0
- data/tmpsets/set/mod004-03_machines/type/scss.rb +28 -0
- data/tmpsets/set/mod004-03_machines/type/skin.rb +18 -0
- data/tmpsets/set/mod005-04_settings/abstract/permission.rb +101 -0
- data/tmpsets/set/mod005-04_settings/right/add_help.rb +17 -0
- data/tmpsets/set/mod005-04_settings/right/comment.rb +9 -0
- data/tmpsets/set/mod005-04_settings/right/create.rb +9 -0
- data/tmpsets/set/mod005-04_settings/right/default.rb +9 -0
- data/tmpsets/set/mod005-04_settings/right/delete.rb +9 -0
- data/tmpsets/set/mod005-04_settings/right/help.rb +9 -0
- data/tmpsets/set/mod005-04_settings/right/read.rb +9 -0
- data/tmpsets/set/mod005-04_settings/right/script.rb +16 -0
- data/tmpsets/set/mod005-04_settings/right/structure.rb +16 -0
- data/tmpsets/set/mod005-04_settings/right/style.rb +16 -0
- data/tmpsets/set/mod005-04_settings/right/update.rb +9 -0
- data/tmpsets/set/mod005-04_settings/self/accountable.rb +9 -0
- data/tmpsets/set/mod005-04_settings/self/add_help.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/autoname.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/captcha.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/create.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/default.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/delete.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/help.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/input.rb +7 -0
- data/tmpsets/set/mod005-04_settings/self/layout.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/on_create.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/on_delete.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/on_update.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/options.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/options_label.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/read.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/recent_settings.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/script.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/structure.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/style.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/table_of_contents.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/thanks.rb +8 -0
- data/tmpsets/set/mod005-04_settings/self/update.rb +8 -0
- data/tmpsets/set/mod005-04_settings/type/setting.rb +96 -0
- data/tmpsets/set/mod006-05_email/all/email_html.rb +11 -0
- data/tmpsets/set/mod006-05_email/all/email_text.rb +11 -0
- data/tmpsets/set/mod006-05_email/all/follow.rb +260 -0
- data/tmpsets/set/mod006-05_email/all/notify.rb +244 -0
- data/tmpsets/set/mod006-05_email/all/observer.rb +33 -0
- data/tmpsets/set/mod006-05_email/right/bcc.rb +51 -0
- data/tmpsets/set/mod006-05_email/right/cc.rb +9 -0
- data/tmpsets/set/mod006-05_email/right/follow.rb +90 -0
- data/tmpsets/set/mod006-05_email/right/follow_fields.rb +8 -0
- data/tmpsets/set/mod006-05_email/right/followers.rb +35 -0
- data/tmpsets/set/mod006-05_email/right/following.rb +58 -0
- data/tmpsets/set/mod006-05_email/right/from.rb +9 -0
- data/tmpsets/set/mod006-05_email/right/html_message.rb +9 -0
- data/tmpsets/set/mod006-05_email/right/to.rb +9 -0
- data/tmpsets/set/mod006-05_email/self/always.rb +20 -0
- data/tmpsets/set/mod006-05_email/self/created.rb +27 -0
- data/tmpsets/set/mod006-05_email/self/edited.rb +30 -0
- data/tmpsets/set/mod006-05_email/self/follow.rb +8 -0
- data/tmpsets/set/mod006-05_email/self/follow_defaults.rb +71 -0
- data/tmpsets/set/mod006-05_email/self/never.rb +21 -0
- data/tmpsets/set/mod006-05_email/type/email_template.rb +119 -0
- data/tmpsets/set/mod006-05_email/type_plus_right/user/follow.rb +182 -0
- data/tmpsets/set/mod007-05_standard/abstract/attachment.rb +91 -0
- data/tmpsets/set/mod007-05_standard/all/account.rb +73 -0
- data/tmpsets/set/mod007-05_standard/all/comment.rb +45 -0
- data/tmpsets/set/mod007-05_standard/all/error.rb +198 -0
- data/tmpsets/set/mod007-05_standard/all/event_viz.rb +75 -0
- data/tmpsets/set/mod007-05_standard/all/links.rb +153 -0
- data/tmpsets/set/mod007-05_standard/all/rich_html/content.rb +248 -0
- data/tmpsets/set/mod007-05_standard/all/rich_html/editing.rb +216 -0
- data/tmpsets/set/mod007-05_standard/all/rich_html/form.rb +238 -0
- data/tmpsets/set/mod007-05_standard/all/rich_html/header.rb +80 -0
- data/tmpsets/set/mod007-05_standard/all/rich_html/menu.rb +135 -0
- data/tmpsets/set/mod007-05_standard/all/rich_html/modal.rb +98 -0
- data/tmpsets/set/mod007-05_standard/all/rich_html/toolbar.rb +271 -0
- data/tmpsets/set/mod007-05_standard/all/rich_html/wrapper.rb +158 -0
- data/tmpsets/set/mod007-05_standard/right/account.rb +187 -0
- data/tmpsets/set/mod007-05_standard/right/discussion.rb +9 -0
- data/tmpsets/set/mod007-05_standard/right/email.rb +57 -0
- data/tmpsets/set/mod007-05_standard/right/password.rb +44 -0
- data/tmpsets/set/mod007-05_standard/right/salt.rb +11 -0
- data/tmpsets/set/mod007-05_standard/right/stats.rb +41 -0
- data/tmpsets/set/mod007-05_standard/right/status.rb +15 -0
- data/tmpsets/set/mod007-05_standard/right/token.rb +11 -0
- data/tmpsets/set/mod007-05_standard/right/when_created.rb +11 -0
- data/tmpsets/set/mod007-05_standard/right/when_last_edited.rb +11 -0
- data/tmpsets/set/mod007-05_standard/rstar/rules.rb +411 -0
- data/tmpsets/set/mod007-05_standard/self/account_links.rb +55 -0
- data/tmpsets/set/mod007-05_standard/self/alerts.rb +11 -0
- data/tmpsets/set/mod007-05_standard/self/all.rb +28 -0
- data/tmpsets/set/mod007-05_standard/self/foot.rb +14 -0
- data/tmpsets/set/mod007-05_standard/self/head.rb +126 -0
- data/tmpsets/set/mod007-05_standard/self/navbox.rb +39 -0
- data/tmpsets/set/mod007-05_standard/self/now.rb +12 -0
- data/tmpsets/set/mod007-05_standard/self/performance_log.rb +98 -0
- data/tmpsets/set/mod007-05_standard/self/recent.rb +54 -0
- data/tmpsets/set/mod007-05_standard/self/search.rb +49 -0
- data/tmpsets/set/mod007-05_standard/self/signin.rb +130 -0
- data/tmpsets/set/mod007-05_standard/self/stats.rb +109 -0
- data/tmpsets/set/mod007-05_standard/self/version.rb +15 -0
- data/tmpsets/set/mod007-05_standard/type/basic.rb +52 -0
- data/tmpsets/set/mod007-05_standard/type/cardtype.rb +78 -0
- data/tmpsets/set/mod007-05_standard/type/date.rb +14 -0
- data/tmpsets/set/mod007-05_standard/type/file.rb +103 -0
- data/tmpsets/set/mod007-05_standard/type/image.rb +89 -0
- data/tmpsets/set/mod007-05_standard/type/layout_type.rb +21 -0
- data/tmpsets/set/mod007-05_standard/type/number.rb +25 -0
- data/tmpsets/set/mod007-05_standard/type/phrase.rb +9 -0
- data/tmpsets/set/mod007-05_standard/type/search_type.rb +291 -0
- data/tmpsets/set/mod007-05_standard/type/session.rb +42 -0
- data/tmpsets/set/mod007-05_standard/type/set.rb +354 -0
- data/tmpsets/set/mod007-05_standard/type/signup.rb +150 -0
- data/tmpsets/set/mod007-05_standard/type/toggle.rb +18 -0
- data/tmpsets/set/mod007-05_standard/type/uri.rb +17 -0
- data/tmpsets/set/mod007-05_standard/type/user.rb +78 -0
- data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/form.rb +41 -0
- data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/helper.rb +150 -0
- data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/wrapper.rb +18 -0
- data/tmpsets/set/mod008-06_bootstrap/all/rich_bootstrap.rb +14 -0
- data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_cards.rb +15 -0
- data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_js.rb +13 -0
- data/tmpsets/set/mod008-06_bootstrap/self/bootswatch_shared.rb +38 -0
- data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_css.rb +13 -0
- data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_js.rb +12 -0
- data/tmpsets/set_pattern/100-all.rb +24 -0
- data/tmpsets/set_pattern/101-all_plus.rb +26 -0
- data/tmpsets/set_pattern/102-type.rb +36 -0
- data/tmpsets/set_pattern/103-star.rb +28 -0
- data/tmpsets/set_pattern/104-rstar.rb +30 -0
- data/tmpsets/set_pattern/105-right.rb +33 -0
- data/tmpsets/set_pattern/106-type_plus_right.rb +36 -0
- data/tmpsets/set_pattern/107-self.rb +32 -0
- metadata +306 -107
- data/mod/05_standard/set/all/attach.rb +0 -164
- data/mod/05_standard/spec/set/all/attach_spec.rb +0 -9
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module States; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/states.rb ~~~~~~~~~~~
|
3
|
+
def new_card?
|
4
|
+
new_record? || # not yet in db (from ActiveRecord)
|
5
|
+
!!@from_trash # in process of restoration from trash, not yet "re-created"
|
6
|
+
end
|
7
|
+
alias_method :new?, :new_card?
|
8
|
+
|
9
|
+
def known?
|
10
|
+
real? || virtual?
|
11
|
+
end
|
12
|
+
|
13
|
+
def real?
|
14
|
+
!new_card?
|
15
|
+
end
|
16
|
+
|
17
|
+
def unknown?
|
18
|
+
!known?
|
19
|
+
end
|
20
|
+
|
21
|
+
def pristine?
|
22
|
+
# has not been edited directly by human users. bleep blorp.
|
23
|
+
new_card? or !actions.joins(:act).where('card_acts.actor_id != ?', Card::WagnBotID).exists?
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/states.rb ~~~~~~~~~~~
|
28
|
+
end;end;end;end;
|
@@ -0,0 +1,132 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module Templating; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/templating.rb ~~~~~~~~~~~
|
3
|
+
|
4
|
+
def is_template?
|
5
|
+
cardname.trait_name? :structure, :default
|
6
|
+
end
|
7
|
+
|
8
|
+
def is_structure?
|
9
|
+
cardname.trait_name? :structure
|
10
|
+
end
|
11
|
+
|
12
|
+
def template
|
13
|
+
# currently applicable templating card.
|
14
|
+
# note that a *default template is never returned for an existing card.
|
15
|
+
@template ||= begin
|
16
|
+
@virtual = false
|
17
|
+
|
18
|
+
# NEW CARDS
|
19
|
+
if new_card?
|
20
|
+
default = rule_card :default, :skip_modules=>true
|
21
|
+
|
22
|
+
dup_card = dup
|
23
|
+
dup_card.type_id = default ? default.type_id : Card.default_type_id
|
24
|
+
|
25
|
+
if structure = dup_card.structure_rule_card
|
26
|
+
@virtual = true if junction?
|
27
|
+
self.type_id = structure.type_id if assign_type_to?(structure)
|
28
|
+
structure
|
29
|
+
else
|
30
|
+
default
|
31
|
+
end
|
32
|
+
|
33
|
+
# EXISTING CARDS
|
34
|
+
elsif structure = structure_rule_card
|
35
|
+
repair_type structure.type_id if assign_type_to?(structure)
|
36
|
+
structure
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def assign_type_to? structure
|
42
|
+
type_id != structure.type_id and structure.assigns_type?
|
43
|
+
end
|
44
|
+
|
45
|
+
def structure
|
46
|
+
if template && template.is_structure?
|
47
|
+
template
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def virtual?
|
52
|
+
return false unless new_card?
|
53
|
+
if @virtual.nil?
|
54
|
+
cardname.simple? ? @virtual=false : template
|
55
|
+
end
|
56
|
+
@virtual
|
57
|
+
end
|
58
|
+
|
59
|
+
def structure_rule_card
|
60
|
+
card = rule_card :structure, :skip_modules=>true
|
61
|
+
card && card.db_content.strip == '_self' ? nil : card
|
62
|
+
end
|
63
|
+
|
64
|
+
def structuree_names
|
65
|
+
if wql = structuree_spec
|
66
|
+
Auth.as_bot do
|
67
|
+
Card::Query.new(wql.merge :return=>:name).run
|
68
|
+
end
|
69
|
+
else
|
70
|
+
[]
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# FIXME: content settings -- do we really need the reference expiration system?
|
75
|
+
#
|
76
|
+
# I kind of think so. otherwise how do we handled patterned references in hard-templated cards?
|
77
|
+
# I'll leave the FIXME here until the need (and/or other solution) is well documented. -efm
|
78
|
+
|
79
|
+
def expire_structuree_references
|
80
|
+
update_structurees :references_expired => 1
|
81
|
+
end
|
82
|
+
|
83
|
+
def update_structurees args
|
84
|
+
# note that this is not smart about overriding templating rules
|
85
|
+
# for example, if someone were to change the type of a +*right+*structure rule that was overridden
|
86
|
+
# by a +*type plus right+*structure rule, the override would not be respected.
|
87
|
+
if query = structuree_spec
|
88
|
+
Auth.as_bot do
|
89
|
+
Card::Query.new( query.merge(:return => :id) ).run.each_slice(100) do |id_batch|
|
90
|
+
Card.where( :id => id_batch ).update_all args
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def assigns_type?
|
97
|
+
# needed because not all *structure templates govern the type of set members
|
98
|
+
# for example, X+*type+*structure governs all cards of type X,
|
99
|
+
# but the content rule does not (in fact cannot) have the type X.
|
100
|
+
if is_structure?
|
101
|
+
if set_pattern = Card.fetch( cardname.trunk_name.tag_name, :skip_modules=>true )
|
102
|
+
pattern_code = set_pattern.codename and
|
103
|
+
set_class = Card::SetPattern.find( pattern_code ) and
|
104
|
+
set_class.assigns_type
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
private
|
110
|
+
|
111
|
+
def repair_type template_type_id
|
112
|
+
# this is a mechanism for repairing bad data. like #repair_key, it should be obviated and removed.
|
113
|
+
self.type_id = template_type_id
|
114
|
+
update_column :type_id, type_id
|
115
|
+
reset_patterns
|
116
|
+
end
|
117
|
+
|
118
|
+
def structuree_spec
|
119
|
+
if is_structure? and c=trunk and c.type_id = Card::SetID #could use is_rule?...
|
120
|
+
c.get_query
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
event :update_structurees_type, :after=>:store, :changed=>:type_id do
|
125
|
+
if assigns_type? # certain *structure templates
|
126
|
+
update_structurees :type_id => type_id
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/templating.rb ~~~~~~~~~~~
|
132
|
+
end;end;end;end;
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module TrackedAttributes; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/tracked_attributes.rb ~~~~~~~~~~~
|
3
|
+
#fixme -this is called by both initialize and update_attributes. really should be optimized for new!
|
4
|
+
def assign_attributes args={}
|
5
|
+
if args
|
6
|
+
args = args.stringify_keys
|
7
|
+
|
8
|
+
@set_specific = {}
|
9
|
+
Card.set_specific_attributes.each do |key|
|
10
|
+
@set_specific[key] = args.delete(key) if args[key]
|
11
|
+
end
|
12
|
+
|
13
|
+
if newtype = args.delete('type')
|
14
|
+
args['type_id'] = Card.fetch_id newtype
|
15
|
+
end
|
16
|
+
@subcards = extract_subcard_args! args
|
17
|
+
reset_patterns
|
18
|
+
end
|
19
|
+
params = ActionController::Parameters.new(args)
|
20
|
+
params.permit!
|
21
|
+
super params
|
22
|
+
end
|
23
|
+
|
24
|
+
def assign_set_specific_attributes
|
25
|
+
if @set_specific && @set_specific.present?
|
26
|
+
@set_specific.each_pair do |name, value|
|
27
|
+
self.send "#{name}=", value
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def extract_subcard_args! args={}
|
33
|
+
extracted_subcards = args.delete('subcards') || {}
|
34
|
+
args.keys.each do |key|
|
35
|
+
if key =~ /^\+/
|
36
|
+
val = args.delete key
|
37
|
+
val = { 'content' => val } if String === val
|
38
|
+
extracted_subcards[key] = val
|
39
|
+
end
|
40
|
+
end
|
41
|
+
extracted_subcards
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
protected
|
46
|
+
|
47
|
+
event :set_content, :before=>:store, :on=>:save do
|
48
|
+
self.db_content = content || '' #necessary?
|
49
|
+
self.db_content = Card::Content.clean! self.db_content if clean_html?
|
50
|
+
@selected_action_id = @selected_content = nil
|
51
|
+
clear_drafts
|
52
|
+
reset_patterns_if_rule saving=true
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
#fixme - the following don't really belong here, but they have to come after the reference stuff. we need to organize a bit!
|
57
|
+
|
58
|
+
event :update_ruled_cards, :after=>:store do
|
59
|
+
if is_rule?
|
60
|
+
# warn "updating ruled cards for #{name}"
|
61
|
+
self.class.clear_rule_cache
|
62
|
+
set = rule_set
|
63
|
+
set.reset_set_patterns
|
64
|
+
|
65
|
+
if right_id==Card::ReadID and (name_changed? or trash_changed?)
|
66
|
+
self.class.clear_read_rule_cache
|
67
|
+
Card.cache.reset # maybe be more surgical, just Auth.user related
|
68
|
+
expire #probably shouldn't be necessary,
|
69
|
+
# but was sometimes getting cached version when card should be in the trash.
|
70
|
+
# could be related to other bugs?
|
71
|
+
in_set = {}
|
72
|
+
if !(self.trash)
|
73
|
+
if class_id = (set and set_class=set.tag and set_class.id)
|
74
|
+
rule_class_ids = set_patterns.map &:pattern_id
|
75
|
+
#warn "rule_class_id #{class_id}, #{rule_class_ids.inspect}"
|
76
|
+
|
77
|
+
#first update all cards in set that aren't governed by narrower rule
|
78
|
+
Auth.as_bot do
|
79
|
+
cur_index = rule_class_ids.index Card[read_rule_class].id
|
80
|
+
if rule_class_index = rule_class_ids.index( class_id )
|
81
|
+
set.item_cards(:limit=>0).each do |item_card|
|
82
|
+
in_set[item_card.key] = true
|
83
|
+
next if cur_index < rule_class_index
|
84
|
+
if cur_index >= rule_class_index
|
85
|
+
item_card.update_read_rule
|
86
|
+
end
|
87
|
+
end
|
88
|
+
# elsif rule_class_index = rule_class_ids.index( 0 )
|
89
|
+
# in_set[trunk.key] = true
|
90
|
+
# #warn "self rule update: #{trunk.inspect}, #{rule_class_index}, #{cur_index}"
|
91
|
+
# trunk.update_read_rule if cur_index > rule_class_index
|
92
|
+
else warn "No current rule index #{class_id}, #{rule_class_ids.inspect}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
#then find all cards with me as read_rule_id that were not just updated and regenerate their read_rules
|
100
|
+
if !new_record?
|
101
|
+
Card.where( :read_rule_id=>self.id, :trash=>false ).reject do |w|
|
102
|
+
in_set[ w.key ]
|
103
|
+
end.each &:update_read_rule
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
event :process_read_rule_update_queue, :after=>:store do
|
111
|
+
Array.wrap(@read_rule_update_queue).each { |card| card.update_read_rule }
|
112
|
+
@read_rule_update_queue = []
|
113
|
+
end
|
114
|
+
|
115
|
+
# set_callback :store, :after, :process_read_rule_update_queue, :prepend=>true
|
116
|
+
|
117
|
+
event :expire_related, :after=>:store do
|
118
|
+
self.expire
|
119
|
+
|
120
|
+
if self.is_structure?
|
121
|
+
self.structuree_names.each do |name|
|
122
|
+
Card.expire name
|
123
|
+
end
|
124
|
+
end
|
125
|
+
# FIXME really shouldn't be instantiating all the following bastards. Just need the key.
|
126
|
+
# fix in id_cache branch
|
127
|
+
self.dependents.each { |c| c.expire }
|
128
|
+
# self.referencers.each { |c| c.expire }
|
129
|
+
self.name_referencers.each { |c| c.expire }
|
130
|
+
# FIXME: this will need review when we do the new defaults/templating system
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/tracked_attributes.rb ~~~~~~~~~~~
|
136
|
+
end;end;end;end;
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module Trash; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/trash.rb ~~~~~~~~~~~
|
3
|
+
def delete
|
4
|
+
update_attributes :trash => true unless new_card?
|
5
|
+
end
|
6
|
+
|
7
|
+
def delete!
|
8
|
+
update_attributes! :trash => true unless new_card?
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
event :pull_from_trash, :before=>:store, :on=>:create do
|
13
|
+
if trashed_card = Card.find_by_key_and_trash(key, true)
|
14
|
+
# a. (Rails way) tried Card.where(:key=>'wagn_bot').select(:id), but it wouldn't work. This #select
|
15
|
+
# generally breaks on cards. I think our initialization process screws with something
|
16
|
+
# b. (Wagn way) we could get card directly from fetch if we add :include_trashed (eg).
|
17
|
+
# likely low ROI, but would be nice to have interface to retrieve cards from trash...
|
18
|
+
self.id = trashed_card.id
|
19
|
+
@from_trash = true
|
20
|
+
@new_record = false
|
21
|
+
end
|
22
|
+
self.trash = false
|
23
|
+
true
|
24
|
+
end
|
25
|
+
|
26
|
+
event :validate_delete, :before=>:approve, :on=>:delete do
|
27
|
+
if !codename.blank?
|
28
|
+
errors.add :delete, "#{name} is is a system card. (#{codename})"
|
29
|
+
end
|
30
|
+
|
31
|
+
undeletable_all_rules_tags = %w{ default style layout create read update delete }
|
32
|
+
if junction? and l=left and l.codename == 'all' and undeletable_all_rules_tags.member? right.codename
|
33
|
+
errors.add :delete, "#{name} is an indestructible rule"
|
34
|
+
end
|
35
|
+
|
36
|
+
if account && Card::Act.find_by_actor_id( self.id )
|
37
|
+
errors.add :delete, "Edits have been made with #{name}'s user account.\nDeleting this card would mess up our history."
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
event :validate_delete_children, :after=>:approve, :on=>:delete do
|
42
|
+
children.each do |child|
|
43
|
+
child.supercard = self
|
44
|
+
subcards[child.name]=child
|
45
|
+
child.trash = true
|
46
|
+
unless child.valid?
|
47
|
+
child.errors.each do |field, message|
|
48
|
+
errors.add field, "can't delete #{child.name}: #{message}"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/trash.rb ~~~~~~~~~~~
|
56
|
+
end;end;end;end;
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module Type; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/type.rb ~~~~~~~~~~~
|
3
|
+
|
4
|
+
module ClassMethods
|
5
|
+
def default_type_id
|
6
|
+
@@default_type_id ||= Card[:all].fetch( :trait=>:default ).type_id
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def type_card
|
11
|
+
return if type_id.nil?
|
12
|
+
Card.fetch type_id.to_i, :skip_modules=>true
|
13
|
+
end
|
14
|
+
|
15
|
+
def type_code
|
16
|
+
Card::Codename[ type_id.to_i ]
|
17
|
+
end
|
18
|
+
|
19
|
+
def type_name
|
20
|
+
type_card.try :name
|
21
|
+
end
|
22
|
+
|
23
|
+
def type_cardname
|
24
|
+
type_card.try :cardname
|
25
|
+
end
|
26
|
+
|
27
|
+
def type= type_name
|
28
|
+
self.type_id = Card.fetch_id type_name
|
29
|
+
end
|
30
|
+
|
31
|
+
def get_type_id args={}
|
32
|
+
return if args[:type_id] # type_id was set explicitly. no need to set again.
|
33
|
+
|
34
|
+
type_id = case
|
35
|
+
when args[:type_code]
|
36
|
+
if code=args[:type_code]
|
37
|
+
Card::Codename[code] || ( c=Card[code] and c.id)
|
38
|
+
end
|
39
|
+
when args[:type]
|
40
|
+
Card.fetch_id args[:type]
|
41
|
+
else :noop
|
42
|
+
end
|
43
|
+
|
44
|
+
case type_id
|
45
|
+
when :noop
|
46
|
+
when false, nil
|
47
|
+
errors.add :type, "#{args[:type] || args[:type_code]} is not a known type."
|
48
|
+
else
|
49
|
+
return type_id
|
50
|
+
end
|
51
|
+
|
52
|
+
if name && t=template
|
53
|
+
reset_patterns #still necessary even with new template handling?
|
54
|
+
t.type_id
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
event :validate_type_change, :before=>:approve, :on=>:update, :changed=>:type_id do
|
60
|
+
if c = dup and c.action == :create and !c.valid?
|
61
|
+
errors.add :type, "of #{ name } can't be changed; errors creating new #{ type_id }: #{ c.errors.full_messages * ', ' }"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
event :validate_type, :before=>:approve, :changed=>:type_id do
|
66
|
+
if !type_name
|
67
|
+
errors.add :type, "No such type"
|
68
|
+
end
|
69
|
+
|
70
|
+
if rt = structure and rt.assigns_type? and type_id!=rt.type_id
|
71
|
+
errors.add :type, "can't be changed because #{name} is hard templated to #{rt.type_name}"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
event :reset_type_specific_fields, :after=>:store do
|
76
|
+
Auth.as_bot do
|
77
|
+
Card.search :left=>{ :left=>type_name }, :right=>{:codename=>'type_plus_right'} do |set_card|
|
78
|
+
set_card.reset_set_patterns
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# Card.search :left_plus=>[ type_name, :right_plus=>{:codename=>'type_plus_right'}] do |right_anchor|
|
84
|
+
# Card["#{lef}"]
|
85
|
+
# set_card.reset_set_patterns
|
86
|
+
# end
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/type.rb ~~~~~~~~~~~
|
91
|
+
end;end;end;end;
|