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
@@ -20,7 +20,7 @@ def initialize args={}
|
|
20
20
|
:type_code => args.delete('type_code'),
|
21
21
|
:type_id => args[ 'type_id' ]
|
22
22
|
}
|
23
|
-
|
23
|
+
|
24
24
|
args['db_content'] = args.delete('content') if args['content']
|
25
25
|
|
26
26
|
#FIXME -- too much of the above is duplicated by assign_attributes (tracked_attributes.rb)
|
@@ -29,11 +29,11 @@ def initialize args={}
|
|
29
29
|
skip_modules = args.delete 'skip_modules'
|
30
30
|
|
31
31
|
super args # ActiveRecord #initialize
|
32
|
-
|
32
|
+
|
33
33
|
if tid = get_type_id( @type_args )
|
34
34
|
self.type_id = tid
|
35
35
|
end
|
36
|
-
|
36
|
+
|
37
37
|
include_set_modules unless skip_modules
|
38
38
|
self
|
39
39
|
end
|
@@ -43,6 +43,7 @@ def include_set_modules
|
|
43
43
|
set_modules.each do |m|
|
44
44
|
singleton_class.send :include, m
|
45
45
|
end
|
46
|
+
assign_set_specific_attributes
|
46
47
|
@set_mods_loaded=true
|
47
48
|
end
|
48
49
|
self
|
@@ -116,8 +116,10 @@ def event_applies? opts
|
|
116
116
|
if opts[:on]
|
117
117
|
return false unless Array.wrap( opts[:on] ).member? @action
|
118
118
|
end
|
119
|
-
if opts[:changed]
|
120
|
-
|
119
|
+
if changed_field = opts[:changed]
|
120
|
+
|
121
|
+
changed_field = 'db_content' if changed_field.to_sym == :content
|
122
|
+
return false if @action == :delete or !changes[ changed_field.to_s ]
|
121
123
|
end
|
122
124
|
if opts[:when]
|
123
125
|
return false unless opts[:when].call self
|
@@ -142,12 +144,14 @@ event :process_subcards, :after=>:approve, :on=>:save do
|
|
142
144
|
|
143
145
|
opts[:supercard] = self
|
144
146
|
|
145
|
-
subcard =
|
146
|
-
known_card
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
147
|
+
subcard =
|
148
|
+
if known_card = Card[ab_name]
|
149
|
+
known_card.refresh.assign_attributes opts
|
150
|
+
known_card
|
151
|
+
elsif (opts['content'].present? && opts['content'].strip.present?) ||
|
152
|
+
opts['subcards'].present? || opts['file'].present? || opts['image'].present?
|
153
|
+
Card.new opts.reverse_merge 'name' => sub_name
|
154
|
+
end
|
151
155
|
|
152
156
|
if subcard
|
153
157
|
@subcards[sub_name] = subcard
|
@@ -9,9 +9,10 @@ def extended_referencers
|
|
9
9
|
(dependents + [self]).map(&:referencers).flatten.uniq
|
10
10
|
end
|
11
11
|
|
12
|
+
|
13
|
+
# replace references in card content
|
12
14
|
def replace_references old_name, new_name
|
13
15
|
obj_content = Card::Content.new raw_content, card=self
|
14
|
-
|
15
16
|
obj_content.find_chunks( Card::Chunk::Reference ).select do |chunk|
|
16
17
|
if old_ref_name = chunk.referee_name and new_ref_name = old_ref_name.replace_part(old_name, new_name)
|
17
18
|
chunk.referee_name = chunk.replace_reference old_name, new_name
|
@@ -22,6 +23,7 @@ def replace_references old_name, new_name
|
|
22
23
|
obj_content.to_s
|
23
24
|
end
|
24
25
|
|
26
|
+
# update entries in reference table
|
25
27
|
def update_references rendered_content = nil, refresh = false
|
26
28
|
raise "update references should not be called on new cards" if id.nil?
|
27
29
|
|
@@ -37,7 +39,6 @@ def update_references rendered_content = nil, refresh = false
|
|
37
39
|
expire if refresh
|
38
40
|
|
39
41
|
rendered_content ||= Card::Content.new(raw_content, card=self)
|
40
|
-
|
41
42
|
rendered_content.find_chunks(Card::Chunk::Reference).each do |chunk|
|
42
43
|
if referee_name = chunk.referee_name # name is referenced (not true of commented inclusions)
|
43
44
|
referee_id = chunk.referee_id
|
@@ -52,13 +53,18 @@ def update_references rendered_content = nil, refresh = false
|
|
52
53
|
# L = link
|
53
54
|
# I = inclusion
|
54
55
|
# P = partial (i.e. the name is part of a compound name that is referenced by a link or inclusion)
|
56
|
+
|
55
57
|
# The partial type is needed to keep track of references of virtual cards.
|
56
58
|
# For example a link [[A+*self]] won't make it to the reference table because A+*self is virtual and
|
57
59
|
# doesn't have an id but when A's name is changed we have to find and update that link.
|
58
|
-
ref_type =
|
59
|
-
|
60
|
-
|
61
|
-
'
|
60
|
+
ref_type =
|
61
|
+
if name == referee_name
|
62
|
+
case chunk
|
63
|
+
when Card::Chunk::Link then 'L'
|
64
|
+
when Card::Chunk::QueryReference then 'Q'
|
65
|
+
else 'I'
|
66
|
+
end
|
67
|
+
else 'P'
|
62
68
|
end
|
63
69
|
Card::Reference.create!(
|
64
70
|
:referer_id => id,
|
@@ -1,3 +1,7 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
|
1
5
|
RuleSQL = %{
|
2
6
|
select rules.id as rule_id, settings.id as setting_id, sets.id as set_id, sets.left_id as anchor_id, sets.right_id as set_tag_id
|
3
7
|
from cards rules
|
@@ -17,10 +21,9 @@ ReadRuleSQL = %{
|
|
17
21
|
where read_rules.right_id = #{Card::ReadID} and read_rules.trash is false and sets.type_id = #{Card::SetID};
|
18
22
|
}
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
+
def is_rule?
|
25
|
+
is_standard_rule? || is_user_rule?
|
26
|
+
end
|
24
27
|
|
25
28
|
def is_standard_rule?
|
26
29
|
(r = right( :skip_modules=>true )) &&
|
@@ -56,7 +59,7 @@ def rule_card_id setting_code, options={}
|
|
56
59
|
if Card::Setting.user_specific? setting_code
|
57
60
|
user_id = options[:user_id] || (options[:user] and options[:user].id) || Auth.current_id
|
58
61
|
if user_id
|
59
|
-
fallback = "#{setting_code}+#{
|
62
|
+
fallback = "#{setting_code}+#{AllID}"
|
60
63
|
setting_code = "#{setting_code}+#{user_id}"
|
61
64
|
end
|
62
65
|
end
|
@@ -135,11 +138,11 @@ module ClassMethods
|
|
135
138
|
end
|
136
139
|
|
137
140
|
def cache_key row
|
138
|
-
setting_code =
|
141
|
+
setting_code = Codename[ row['setting_id'].to_i ] or return false
|
139
142
|
|
140
143
|
anchor_id = row['anchor_id']
|
141
144
|
set_class_id = anchor_id.nil? ? row['set_id'] : row['set_tag_id']
|
142
|
-
set_class_code =
|
145
|
+
set_class_code = Codename[ set_class_id.to_i ] or return false
|
143
146
|
|
144
147
|
key_base = [ anchor_id, set_class_code, setting_code].compact.map( &:to_s ) * '+'
|
145
148
|
end
|
@@ -174,15 +177,15 @@ module ClassMethods
|
|
174
177
|
|
175
178
|
def all_user_ids_with_rule_for set_card, setting_code
|
176
179
|
key = if (l=set_card.left) and (r=set_card.right)
|
177
|
-
set_class_code =
|
180
|
+
set_class_code = Codename[ r.id ]
|
178
181
|
"#{l.id}+#{set_class_code}+#{setting_code}"
|
179
182
|
else
|
180
|
-
set_class_code =
|
183
|
+
set_class_code = Codename[ set_card.id ]
|
181
184
|
"#{set_class_code}+#{setting_code}"
|
182
185
|
end
|
183
186
|
user_ids = user_ids_cache[key] || []
|
184
|
-
if user_ids.include?
|
185
|
-
Card.where(:type_id=>
|
187
|
+
if user_ids.include? AllID # rule for all -> return all user ids
|
188
|
+
Card.where(:type_id=>UserID).pluck(:id)
|
186
189
|
else
|
187
190
|
user_ids
|
188
191
|
end
|
@@ -2,6 +2,12 @@
|
|
2
2
|
def assign_attributes args={}
|
3
3
|
if args
|
4
4
|
args = args.stringify_keys
|
5
|
+
|
6
|
+
@set_specific = {}
|
7
|
+
Card.set_specific_attributes.each do |key|
|
8
|
+
@set_specific[key] = args.delete(key) if args[key]
|
9
|
+
end
|
10
|
+
|
5
11
|
if newtype = args.delete('type')
|
6
12
|
args['type_id'] = Card.fetch_id newtype
|
7
13
|
end
|
@@ -13,6 +19,14 @@ def assign_attributes args={}
|
|
13
19
|
super params
|
14
20
|
end
|
15
21
|
|
22
|
+
def assign_set_specific_attributes
|
23
|
+
if @set_specific && @set_specific.present?
|
24
|
+
@set_specific.each_pair do |name, value|
|
25
|
+
self.send "#{name}=", value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
16
30
|
def extract_subcard_args! args={}
|
17
31
|
extracted_subcards = args.delete('subcards') || {}
|
18
32
|
args.keys.each do |key|
|
@@ -94,7 +94,7 @@ describe Card::Set::All::Collection do
|
|
94
94
|
tabs = render_card :tabs, :content=>"[[A]]\n[[B]]\n[[C]]", :type=>'pointer'
|
95
95
|
assert_view_select tabs, 'div[role=tabpanel]' do
|
96
96
|
assert_select 'div.tab-pane#tempo_rary-a .card-slot#A'
|
97
|
-
assert_select 'li > a.load[data-toggle=tab][href
|
97
|
+
assert_select 'li > a.load[data-toggle=tab][href="#tempo_rary-b"]'
|
98
98
|
assert_select 'div.tab-pane#tempo_rary-b', ''
|
99
99
|
end
|
100
100
|
end
|
@@ -118,15 +118,15 @@ describe Card::Set::All::Collection do
|
|
118
118
|
|
119
119
|
it 'handles item params' do
|
120
120
|
tabs = render_content '{{Fruit+*type+*create|tabs|name;structure:Home}}'
|
121
|
-
path = "/Anyone?#{ {:
|
121
|
+
path = "/Anyone?#{ {:slot=>{:structure=>'Home'},:view=>:name}.to_param}"
|
122
122
|
assert_view_select tabs, 'div[role=tabpanel]' do
|
123
|
-
assert_select
|
123
|
+
assert_select %{li > a[data-toggle="tab"][data-url="#{path}"]}
|
124
124
|
end
|
125
125
|
end
|
126
126
|
it 'handles nests as items' do
|
127
127
|
tabs = render_card :tabs, :name=>'tab_test', :type_id=>Card::PlainTextID, :content=>"{{A|type;title:my tab title}}"
|
128
128
|
assert_view_select tabs, 'div[role=tabpanel]' do
|
129
|
-
assert_select 'li > a[data-toggle=tab][href
|
129
|
+
assert_select 'li > a[data-toggle=tab][href="#tab_test-a"]', 'my tab title'
|
130
130
|
assert_select 'div.tab-pane#tab_test-a', 'Basic'
|
131
131
|
end
|
132
132
|
end
|
@@ -135,7 +135,7 @@ describe Card::Set::All::Collection do
|
|
135
135
|
Card.create :type=>'Search', :name=>'Asearch', :content=>%{{"type":"User"}}
|
136
136
|
tabs=render_content("{{Asearch|tabs;item:name}}")
|
137
137
|
assert_view_select tabs, 'div[role=tabpanel]' do
|
138
|
-
assert_select 'li > a[data-toggle=tab][href
|
138
|
+
assert_select 'li > a[data-toggle=tab][href="#asearch-joe_admin"] span.card-title', 'Joe Admin'
|
139
139
|
end
|
140
140
|
end
|
141
141
|
end
|
@@ -26,32 +26,32 @@ describe Card::Set::All::Name do
|
|
26
26
|
expect(b1.name).to eq('b1')
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
describe 'codename' do
|
31
31
|
before :each do
|
32
32
|
@card = Card['a']
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it 'should require admin permission' do
|
36
36
|
@card.update_attributes :codename=>'structure'
|
37
37
|
expect(@card.errors[:codename].first).to match(/only admins/)
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
it 'should check uniqueness' do
|
41
41
|
Card::Auth.as_bot do
|
42
42
|
@card.update_attributes :codename=>'structure'
|
43
43
|
expect(@card.errors[:codename].first).to match(/already in use/)
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
46
|
+
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
describe 'repair_key' do
|
50
50
|
it 'should fix broken keys' do
|
51
51
|
a = Card['a']
|
52
52
|
a.update_column 'key', 'broken_a'
|
53
53
|
a.expire
|
54
|
-
|
54
|
+
|
55
55
|
a = Card.find a.id
|
56
56
|
expect(a.key).to eq('broken_a')
|
57
57
|
a.repair_key
|
@@ -47,13 +47,13 @@ class Card
|
|
47
47
|
|
48
48
|
def relevant_drafts_for card
|
49
49
|
drafts.select do |action|
|
50
|
-
card.included_card_ids.include?(action.card_id) || (card == action.
|
50
|
+
card.included_card_ids.include?(action.card_id) || (card.id == action.card_id)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
def relevant_actions_for card, with_drafts=false
|
55
55
|
actions.select do |action|
|
56
|
-
card.included_card_ids.include?(action.card_id) || (card == action.
|
56
|
+
card.included_card_ids.include?(action.card_id) || (card.id == action.card_id)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
@@ -16,6 +16,12 @@ class Card
|
|
16
16
|
# replace with enum if we start using rails 4
|
17
17
|
TYPE = [:create, :update, :delete]
|
18
18
|
|
19
|
+
def expire
|
20
|
+
self.class.cache.delete id.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
after_save :expire
|
24
|
+
|
19
25
|
class << self
|
20
26
|
def cache
|
21
27
|
Card::Cache[Action]
|
@@ -27,7 +33,6 @@ class Card
|
|
27
33
|
end
|
28
34
|
end
|
29
35
|
|
30
|
-
|
31
36
|
def delete_cardless
|
32
37
|
Card::Action.joins('LEFT JOIN cards ON card_actions.card_id = cards.id').where('cards.id IS NULL').delete_all
|
33
38
|
end
|
@@ -174,10 +179,14 @@ class Card
|
|
174
179
|
|
175
180
|
def content_diff_builder opts=nil
|
176
181
|
@content_diff_builder ||= begin
|
177
|
-
Card::Diff::DiffBuilder.new(old_values[:content], new_values[:content], opts || card.diff_args)
|
182
|
+
Card::Diff::DiffBuilder.new(old_values[:content], new_values[:content], opts || card.include_set_modules.diff_args)
|
178
183
|
end
|
179
184
|
end
|
180
185
|
|
186
|
+
def card
|
187
|
+
Card.fetch card_id, look_in_trash: true
|
188
|
+
end
|
189
|
+
|
181
190
|
end
|
182
191
|
end
|
183
192
|
|
@@ -5,13 +5,14 @@ def select_action_by_params params
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def find_action_by_params args
|
8
|
-
|
9
|
-
when args[:rev]
|
8
|
+
if args[:rev]
|
10
9
|
nth_action args[:rev]
|
11
|
-
|
10
|
+
elsif args[:rev_id] =~ /^\d+$/
|
12
11
|
if action = Action.fetch(args[:rev_id]) and action.card_id == id
|
13
12
|
action
|
14
13
|
end
|
14
|
+
elsif args[:rev_id] # revision id is probalby a mod (e.g. if you request files/:logo/05_standard.png)
|
15
|
+
last_action
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
@@ -56,7 +56,7 @@ end
|
|
56
56
|
|
57
57
|
def selected_content_action_id
|
58
58
|
@selected_action_id ||
|
59
|
-
|
59
|
+
(@current_action && (new_card? || @current_action.new_content? || db_content_changed?) && @current_action.id) ||
|
60
60
|
last_content_action_id
|
61
61
|
end
|
62
62
|
|
@@ -4,74 +4,43 @@ def history?
|
|
4
4
|
true
|
5
5
|
end
|
6
6
|
|
7
|
-
event :create_act_and_action_for_save, :before=>:process_subcards, :on=>:save, :when=>proc {|c| c.history?} do
|
8
|
-
create_act_and_action
|
9
|
-
end
|
10
|
-
event :create_act_and_action_for_delete, :before =>:validate_delete_children, :on=>:delete, :when=>proc {|c| c.history? } do
|
11
|
-
create_act_and_action
|
12
|
-
end
|
13
|
-
|
14
|
-
event :create_card_changes, :after =>:stored, :when=>proc {|c| c.history? } do
|
15
|
-
store_changes
|
16
|
-
end
|
17
|
-
|
18
|
-
event :finalize_act, :after=>:create_card_changes, :when=>proc {|c| c.history? } do
|
19
|
-
if !@supercard
|
20
|
-
if @current_act.actions(true).empty?
|
21
|
-
@current_act.delete
|
22
|
-
@current_act = nil
|
23
|
-
else
|
24
|
-
@current_act.update_attributes! :card_id=>id
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
7
|
# must be called on all actions and before :set_name, :process_subcards and :validate_delete_children
|
31
|
-
|
8
|
+
event :assign_act, :before=>:approve, :when=>proc {|c| c.history?} do
|
32
9
|
@current_act = (@supercard && @supercard.current_act) || Card::Act.create(:ip_address=>Env.ip)
|
10
|
+
end
|
11
|
+
|
12
|
+
event :assign_action, :after=>:assign_act do
|
33
13
|
@current_action = Card::Action.create(:card_act_id=>@current_act.id, :action_type=>@action, :draft=>(Env.params['draft'] == 'true') )
|
34
14
|
if (@supercard and @supercard !=self)
|
35
15
|
@current_action.super_action = @supercard.current_action
|
36
16
|
end
|
37
17
|
end
|
38
18
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
19
|
+
|
20
|
+
# stores changes in the changes table and assigns them to the current action
|
21
|
+
# removes the action if there are no changes
|
22
|
+
event :finalize_action, :after =>:stored, :when=>proc {|c| c.history? && c.current_action} do
|
23
|
+
@changed_fields = Card::TRACKED_FIELDS.select{ |f| changed_attributes.member? f }
|
24
|
+
if @changed_fields.present?
|
25
|
+
@changed_fields.each{ |f| Card::Change.create :field => f, :value => self[f], :card_action_id=>@current_action.id }
|
26
|
+
@current_action.update_attributes! :card_id => id
|
27
|
+
elsif @current_action.card_changes(true).empty?
|
28
|
+
@current_action.delete
|
29
|
+
@current_action = nil
|
49
30
|
end
|
50
31
|
end
|
51
32
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
@current_act = if @supercard
|
57
|
-
@supercard.current_act || @supercard.acts.build(:ip_address=>Env.ip)
|
33
|
+
event :finalize_act, :after=>:finalize_action, :when=>proc {|c| c.history? && !c.supercard } do
|
34
|
+
if @current_act.actions(true).empty?
|
35
|
+
@current_act.delete
|
36
|
+
@current_act = nil
|
58
37
|
else
|
59
|
-
|
60
|
-
end
|
61
|
-
@current_action = actions(true).build(:action_type=>@action, :draft=>(Env.params['draft'] == 'true') )
|
62
|
-
@current_action.act = @current_act
|
63
|
-
|
64
|
-
if (@supercard and @supercard !=self)
|
65
|
-
@current_action.super_action = @supercard.current_action
|
38
|
+
@current_act.update_attributes! :card_id=>id
|
66
39
|
end
|
67
40
|
end
|
68
41
|
|
69
42
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
event :rollback_actions, :before=>:approve, :on=>:update, :when=>proc{ |c| c.history? && Env && Env.params['action_ids'] && Env.params['action_ids'].class == Array} do
|
43
|
+
event :rollback_actions, :before=>:approve, :on=>:update, :when=>proc{ |c| c.rollback_request? } do
|
75
44
|
revision = { :subcards => {}}
|
76
45
|
rollback_actions = Env.params['action_ids'].map do |a_id|
|
77
46
|
Action.fetch(a_id) || nil
|
@@ -86,12 +55,31 @@ event :rollback_actions, :before=>:approve, :on=>:update, :when=>proc{ |c| c.his
|
|
86
55
|
Env.params['action_ids'] = nil
|
87
56
|
update_attributes! revision
|
88
57
|
rollback_actions.each do |action|
|
89
|
-
action.card.
|
58
|
+
action.card.try :symlink_to, action.id
|
90
59
|
end
|
91
60
|
clear_drafts
|
92
61
|
abort :success
|
93
62
|
end
|
94
63
|
|
64
|
+
def rollback_request?
|
65
|
+
history? && Env && Env.params['action_ids'] && Env.params['action_ids'].class == Array
|
66
|
+
end
|
67
|
+
|
68
|
+
# alternative approach to handle act and action that doesn't change the database in the beginning
|
69
|
+
# stopped working with Rails 4
|
70
|
+
# def build_act_and_action
|
71
|
+
# @current_act = if @supercard
|
72
|
+
# @supercard.current_act || @supercard.acts.build(:ip_address=>Env.ip)
|
73
|
+
# else
|
74
|
+
# acts.build(:ip_address=>Env.ip)
|
75
|
+
# end
|
76
|
+
# @current_action = actions(true).build(:action_type=>@action, :draft=>(Env.params['draft'] == 'true') )
|
77
|
+
# @current_action.act = @current_act
|
78
|
+
#
|
79
|
+
# if (@supercard and @supercard !=self)
|
80
|
+
# @current_action.super_action = @supercard.current_action
|
81
|
+
# end
|
82
|
+
# end
|
95
83
|
|
96
84
|
|
97
85
|
def intrusive_family_acts args={} # all acts with actions on self and on cards that are descendants of self and included in self
|
@@ -108,7 +96,7 @@ end
|
|
108
96
|
|
109
97
|
def current_rev_nr
|
110
98
|
@current_rev_nr ||= begin
|
111
|
-
|
99
|
+
intrusive_acts.first.actions.last.draft ? @intrusive_acts.size - 1 : @intrusive_acts.size
|
112
100
|
end
|
113
101
|
end
|
114
102
|
|
@@ -154,7 +142,7 @@ format :html do
|
|
154
142
|
def history_legend
|
155
143
|
intr = card.intrusive_acts.page(params['page']).per(REVISIONS_PER_PAGE)
|
156
144
|
render_haml :intr=>intr do
|
157
|
-
|
145
|
+
<<-HAML
|
158
146
|
.history-header
|
159
147
|
%span.slotter
|
160
148
|
= paginate intr, :remote=>true, :theme=>'twitter-bootstrap-3'
|
@@ -166,7 +154,7 @@ format :html do
|
|
166
154
|
%span.glyphicon.glyphicon-minus-sign.diff-red
|
167
155
|
%span
|
168
156
|
= Card::Diff.render_deleted_chunk("Deleted")
|
169
|
-
|
157
|
+
HAML
|
170
158
|
end
|
171
159
|
end
|
172
160
|
|
@@ -187,7 +175,7 @@ format :html do
|
|
187
175
|
render_haml :card=>card, :act=>act, :act_view=>act_view,
|
188
176
|
:current_rev_nr=>current_rev_nr, :rev_nr=>rev_nr,
|
189
177
|
:hide_diff=> hide_diff do
|
190
|
-
|
178
|
+
<<-HAML
|
191
179
|
.act{:style=>"clear:both;"}
|
192
180
|
.head
|
193
181
|
.nr
|
@@ -214,7 +202,7 @@ format :html do
|
|
214
202
|
.action-container{:style=>("clear: left;" if act_view == :expanded)}
|
215
203
|
- act.relevant_actions_for(card).each do |action|
|
216
204
|
= send("_render_action_#{ act_view }", :action=>action )
|
217
|
-
|
205
|
+
HAML
|
218
206
|
end
|
219
207
|
end
|
220
208
|
end
|
@@ -236,7 +224,7 @@ format :html do
|
|
236
224
|
else
|
237
225
|
link_to name_changes(action, hide_diff),
|
238
226
|
path(:view=>:related, :related=>{:view=>"history",:name=>action.card.name}),
|
239
|
-
:class=>'slotter label
|
227
|
+
:class=>'slotter label label-default',
|
240
228
|
'data-slot-selector'=>".card-slot.history-view",
|
241
229
|
:remote=>true
|
242
230
|
end
|
@@ -254,14 +242,14 @@ format :html do
|
|
254
242
|
:name_diff => name_diff,
|
255
243
|
:type_diff => type_diff,
|
256
244
|
:content_diff => content_diff do
|
257
|
-
|
245
|
+
<<-HAML
|
258
246
|
.action
|
259
247
|
.summary
|
260
248
|
%span.ampel
|
261
249
|
= glyphicon 'minus-sign', (action.red? ? 'diff-red' : 'diff-invisible')
|
262
250
|
= glyphicon 'plus-sign', (action.green? ? 'diff-green' : 'diff-invisible')
|
263
251
|
= wrap_diff :name, name_diff
|
264
|
-
= wrap_diff :type, type_diff
|
252
|
+
= wrap_diff :type, type_diff
|
265
253
|
-if content_diff
|
266
254
|
= glyphicon 'arrow-right', 'arrow'
|
267
255
|
-if action_view == :summary
|
@@ -269,14 +257,14 @@ format :html do
|
|
269
257
|
-if content_diff and action_view == :expanded
|
270
258
|
.expanded
|
271
259
|
= wrap_diff :content, content_diff
|
272
|
-
|
260
|
+
HAML
|
273
261
|
end
|
274
262
|
end
|
275
263
|
|
276
264
|
def wrap_diff field, content
|
277
265
|
if content.present?
|
278
266
|
%{
|
279
|
-
<span class="#{field}-diff
|
267
|
+
<span class="#{field}-diff">
|
280
268
|
#{content}
|
281
269
|
</span>
|
282
270
|
}
|
@@ -314,9 +302,10 @@ format :html do
|
|
314
302
|
end
|
315
303
|
end
|
316
304
|
|
317
|
-
def rollback_link
|
318
|
-
|
319
|
-
|
305
|
+
def rollback_link actions
|
306
|
+
not_current = actions.select { |action| action.card.last_action_id != action.id }
|
307
|
+
if card.ok?(:update) && not_current.present?
|
308
|
+
"| " + link_to('Save as current', path(:action=>:update, :view=>:open, :action_ids=>not_current),
|
320
309
|
:class=>'slotter','data-slot-selector'=>'.card-slot.history-view', :remote=>true, :method=>:post, :rel=>'nofollow')
|
321
310
|
end
|
322
311
|
end
|