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,162 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module Utils; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/utils.rb ~~~~~~~~~~~
|
3
|
+
|
4
|
+
module ClassMethods
|
5
|
+
|
6
|
+
def empty_trash
|
7
|
+
Card.delete_trashed_files
|
8
|
+
Card.where(:trash=>true).delete_all
|
9
|
+
Card::Action.delete_cardless
|
10
|
+
Card::Reference.repair_missing_referees
|
11
|
+
Card::Reference.delete_missing_referers
|
12
|
+
end
|
13
|
+
|
14
|
+
def delete_trashed_files #deletes any file not associated with a real card.
|
15
|
+
dir = Card.paths['files'].existent.first
|
16
|
+
trashed_card_sql = %{ select id from cards where trash is true }
|
17
|
+
trashed_card_ids = Card.connection.select_all( trashed_card_sql ).map( &:values ).flatten.map &:to_i
|
18
|
+
file_ids = Dir.entries( dir )[2..-1].map( &:to_i )
|
19
|
+
file_ids.each do |file_id|
|
20
|
+
if trashed_card_ids.member?(file_id)
|
21
|
+
raise Card::Error, "Narrowly averted deleting current file" if Card.exists?(file_id) #double check!
|
22
|
+
FileUtils.rm_rf "#{dir}/#{file_id}", :secure => true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def merge_list attribs, opts={}
|
28
|
+
unmerged = []
|
29
|
+
attribs.each do |row|
|
30
|
+
result = begin
|
31
|
+
merge row['name'], row, opts
|
32
|
+
# rescue => e
|
33
|
+
# Rails.logger.info "merge_list problem: #{ e.message }"
|
34
|
+
# false
|
35
|
+
end
|
36
|
+
unmerged.push row unless result == true
|
37
|
+
end
|
38
|
+
|
39
|
+
if unmerged.empty?
|
40
|
+
Rails.logger.info "successfully merged all!"
|
41
|
+
else
|
42
|
+
unmerged_json = JSON.pretty_generate unmerged
|
43
|
+
if output_file = opts[:output_file]
|
44
|
+
::File.open output_file, 'w' do |f|
|
45
|
+
f.write unmerged_json
|
46
|
+
end
|
47
|
+
else
|
48
|
+
Rails.logger.info "failed to merge:\n\n#{ unmerged_json }"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
unmerged
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def merge name, attribs={}, opts={}
|
56
|
+
puts "merging #{ name }"
|
57
|
+
card = fetch name, :new=>{}
|
58
|
+
|
59
|
+
if opts[:pristine] && !card.pristine?
|
60
|
+
false
|
61
|
+
else
|
62
|
+
card.attributes = attribs
|
63
|
+
card.save!
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
def debug_type
|
70
|
+
"#{type_code||'no code'}:#{type_id}"
|
71
|
+
end
|
72
|
+
|
73
|
+
def to_s
|
74
|
+
"#<#{self.class.name}[#{debug_type}]#{self.attributes['name']}>"
|
75
|
+
end
|
76
|
+
|
77
|
+
def inspect
|
78
|
+
"#<#{self.class.name}" + "##{id}" +
|
79
|
+
"###{object_id}" + #"l#{left_id}r#{right_id}" +
|
80
|
+
"[#{debug_type}]" + "(#{self.name})" + #"#{object_id}" +
|
81
|
+
#(errors.any? ? '*Errors*' : 'noE') +
|
82
|
+
(errors.any? ? "<E*#{errors.full_messages*', '}*>" : '') +
|
83
|
+
#"{#{references_expired==1 ? 'Exp' : "noEx"}:" +
|
84
|
+
"{#{trash&&'trash:'||''}#{new_card? &&'new:'||''}#{frozen? ? 'Fz' : readonly? ? 'RdO' : ''}" +
|
85
|
+
"#{@virtual &&'virtual:'||''}#{@set_mods_loaded&&'I'||'!loaded' }:#{references_expired.inspect}}" +
|
86
|
+
'>'
|
87
|
+
end
|
88
|
+
|
89
|
+
format :html do
|
90
|
+
view :views_by_format do |args|
|
91
|
+
format_views = self.class.ancestors.each_with_object({}) do |format_class, hash|
|
92
|
+
views =
|
93
|
+
format_class.instance_methods.map do |method|
|
94
|
+
if method.to_s.match /^_view_(.+)$/
|
95
|
+
"<li>#{$1}</li>"
|
96
|
+
end
|
97
|
+
end.compact.join "\n"
|
98
|
+
if views.present?
|
99
|
+
format_class.name.match /^Card(::Set)?::(.+?)$/ #::(\w+Format)
|
100
|
+
hash[$2] = views
|
101
|
+
end
|
102
|
+
end
|
103
|
+
accordion_group format_views
|
104
|
+
end
|
105
|
+
|
106
|
+
view :views_by_name do |args|
|
107
|
+
views = methods.map do |method|
|
108
|
+
if method.to_s.match /^_view_(.+)$/
|
109
|
+
$1
|
110
|
+
end
|
111
|
+
end.compact.sort
|
112
|
+
"<ul>
|
113
|
+
#{ wrap_each_with :li, views }
|
114
|
+
</ul>"
|
115
|
+
end
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
def accordion_group list, collapse_id=card.cardname.safe_key
|
121
|
+
accordions = ''
|
122
|
+
index = 1
|
123
|
+
list.each_pair do |title, content|
|
124
|
+
accordions << accordion(title, content, "#{collapse_id}-#{index}")
|
125
|
+
index += 1
|
126
|
+
end
|
127
|
+
content_tag :div, accordions.html_safe, :class=>"panel-group", :id=>"accordion-#{collapse_id}", :role=>"tablist", 'aria-multiselectable'=>"true"
|
128
|
+
end
|
129
|
+
|
130
|
+
def accordion title, content, collapse_id=card.cardname.safe_key
|
131
|
+
panel_body =
|
132
|
+
case content
|
133
|
+
when Hash
|
134
|
+
accordion_group accordion(content, collapse_id)
|
135
|
+
when Array
|
136
|
+
content.join "\n"
|
137
|
+
else
|
138
|
+
content
|
139
|
+
end
|
140
|
+
%{
|
141
|
+
<div class="panel panel-default">
|
142
|
+
<div class="panel-heading" role="tab" id="heading-#{collapse_id}">
|
143
|
+
<h4 class="panel-title">
|
144
|
+
<a data-toggle="collapse" data-parent="#accordion-#{collapse_id}" href="##{collapse_id}" aria-expanded="true" aria-controls="#{collapse_id}">
|
145
|
+
#{ title }
|
146
|
+
</a>
|
147
|
+
</h4>
|
148
|
+
</div>
|
149
|
+
<div id="#{collapse_id}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-#{collapse_id}">
|
150
|
+
<div class="panel-body">
|
151
|
+
#{ panel_body }
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
}.html_safe
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/utils.rb ~~~~~~~~~~~
|
162
|
+
end;end;end;end;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module ViewCache; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/view_cache.rb ~~~~~~~~~~~
|
3
|
+
event :clear_view_cache, :after=>:store do
|
4
|
+
Card::ViewCache.reset
|
5
|
+
end
|
6
|
+
|
7
|
+
format do
|
8
|
+
def view_caching?
|
9
|
+
false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/view_cache.rb ~~~~~~~~~~~
|
14
|
+
end;end;end;end;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module Actions; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_history/set/all/actions.rb ~~~~~~~~~~~
|
3
|
+
# -*- encoding : utf-8 -*-
|
4
|
+
|
5
|
+
def select_action_by_params params
|
6
|
+
action = find_action_by_params(params) and self.selected_action_id = action.id
|
7
|
+
end
|
8
|
+
|
9
|
+
def find_action_by_params args
|
10
|
+
if args[:rev]
|
11
|
+
nth_action args[:rev]
|
12
|
+
elsif args[:rev_id] =~ /^\d+$/
|
13
|
+
if action = Action.fetch(args[:rev_id]) and action.card_id == id
|
14
|
+
action
|
15
|
+
end
|
16
|
+
elsif args[:rev_id] # revision id is probalby a mod (e.g. if you request files/:logo/05_standard.png)
|
17
|
+
last_action
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def nth_action index
|
22
|
+
index = index.to_i
|
23
|
+
if id and index > 0
|
24
|
+
Action.where("draft is not true AND card_id = #{id}").order(:id).limit(1).offset(index-1).first
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def revision action
|
29
|
+
# a "revision" refers to the state of all tracked fields at the time of a given action
|
30
|
+
if action.is_a? Integer
|
31
|
+
action = Card::Action.fetch(action)
|
32
|
+
end
|
33
|
+
action and Card::TRACKED_FIELDS.inject({}) do |attr_changes, field|
|
34
|
+
last_change = action.card_changes.find_by_field_name(field) || last_change_on(field, :not_after=>action)
|
35
|
+
attr_changes[field.to_sym] = (last_change ? last_change.value : self[field])
|
36
|
+
attr_changes
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete_old_actions
|
41
|
+
Card::TRACKED_FIELDS.each do |field|
|
42
|
+
# assign previous changes on each tracked field to the last action
|
43
|
+
if (la = last_action) && !la.change_for(field).present? and (last_change = last_change_on(field))
|
44
|
+
last_change = Card::Change.find(last_change.id) # last_change comes as readonly record
|
45
|
+
last_change.update_attributes!(:card_action_id=>last_action_id)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
actions.where('id != ?', last_action_id ).delete_all
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_history/set/all/actions.rb ~~~~~~~~~~~
|
54
|
+
end;end;end;end;
|
@@ -0,0 +1,140 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module ContentHistory; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_history/set/all/content_history.rb ~~~~~~~~~~~
|
3
|
+
|
4
|
+
# if these aren't in a nested module, the methods just overwrite the base methods,
|
5
|
+
# but we need a distict module so that super will be able to refer to the base methods.
|
6
|
+
def content
|
7
|
+
if @selected_action_id
|
8
|
+
@selected_content ||= begin
|
9
|
+
(change = last_change_on( :db_content, :not_after=> @selected_action_id ) and change.value) || db_content
|
10
|
+
end
|
11
|
+
else
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def content= value
|
17
|
+
@selected_content = nil
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def save_content_draft content
|
22
|
+
super
|
23
|
+
acts.create do |act|
|
24
|
+
act.actions.build(:draft => true, :card_id=>id).card_changes.build(:field=>:db_content, :value=>content)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def last_change_on(field, opts={})
|
29
|
+
where_sql = 'card_actions.card_id = :card_id AND field = :field AND (draft is not true) '
|
30
|
+
where_sql += if opts[:before]
|
31
|
+
'AND card_action_id < :action_id'
|
32
|
+
elsif opts[:not_after]
|
33
|
+
'AND card_action_id <= :action_id'
|
34
|
+
else
|
35
|
+
''
|
36
|
+
end
|
37
|
+
|
38
|
+
action_arg = opts[:before] || opts[:not_after]
|
39
|
+
action_id = action_arg.kind_of?(Card::Action) ? action_arg.id : action_arg
|
40
|
+
field_index = Card::TRACKED_FIELDS.index(field.to_s)
|
41
|
+
Change.joins(:action).where( where_sql,
|
42
|
+
{:card_id=>id, :field=>field_index, :action_id=>action_id}
|
43
|
+
).order(:id).last
|
44
|
+
end
|
45
|
+
|
46
|
+
def selected_action_id
|
47
|
+
@selected_action_id || (@current_action and @current_action.id) || last_action_id
|
48
|
+
end
|
49
|
+
|
50
|
+
def selected_action_id= action_id
|
51
|
+
@selected_content = nil
|
52
|
+
@selected_action_id = action_id
|
53
|
+
end
|
54
|
+
|
55
|
+
def selected_action
|
56
|
+
selected_action_id and Action.fetch(selected_action_id)
|
57
|
+
end
|
58
|
+
|
59
|
+
def selected_content_action_id
|
60
|
+
@selected_action_id ||
|
61
|
+
(@current_action && (new_card? || @current_action.new_content? || db_content_changed?) && @current_action.id) ||
|
62
|
+
last_content_action_id
|
63
|
+
end
|
64
|
+
|
65
|
+
def last_action_id
|
66
|
+
la = last_action and la.id
|
67
|
+
end
|
68
|
+
|
69
|
+
def last_action
|
70
|
+
actions.where('id IS NOT NULL').last
|
71
|
+
end
|
72
|
+
|
73
|
+
def last_content_action
|
74
|
+
l_c = last_change_on(:db_content) and l_c.action
|
75
|
+
end
|
76
|
+
|
77
|
+
def last_content_action_id
|
78
|
+
l_c = last_change_on(:db_content) and l_c.card_action_id
|
79
|
+
end
|
80
|
+
|
81
|
+
def last_actor
|
82
|
+
last_act.actor
|
83
|
+
end
|
84
|
+
|
85
|
+
def last_act
|
86
|
+
if action = last_action
|
87
|
+
last_act_on_self = acts.last
|
88
|
+
if last_act_on_self and ( action.act==last_act_on_self || last_act_on_self.acted_at>action.act.acted_at )
|
89
|
+
last_act_on_self
|
90
|
+
else
|
91
|
+
action.act
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def acted_at
|
97
|
+
last_act.acted_at
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
def previous_action action_id
|
102
|
+
if action_id
|
103
|
+
action_index = actions.find_index do |a|
|
104
|
+
a.id == action_id
|
105
|
+
end
|
106
|
+
actions[action_index - 1] if action_index.to_i != 0
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def revised_at
|
111
|
+
(last_action and act=last_action.act and act.acted_at) or Time.now
|
112
|
+
end
|
113
|
+
|
114
|
+
def creator
|
115
|
+
Card[ creator_id ]
|
116
|
+
end
|
117
|
+
|
118
|
+
def updater
|
119
|
+
Card[ updater_id ]
|
120
|
+
end
|
121
|
+
|
122
|
+
def clean_html?
|
123
|
+
true
|
124
|
+
end
|
125
|
+
|
126
|
+
def draft_acts
|
127
|
+
drafts.created_by(Card::Auth.current_id).map(&:act)
|
128
|
+
end
|
129
|
+
|
130
|
+
event :detect_conflict, :before=>:approve, :on=>:update, :when=>proc {|c| c.history? } do
|
131
|
+
if last_action_id_before_edit and last_action_id_before_edit.to_i != last_action_id and last_action.act.actor_id != Auth.current_id
|
132
|
+
errors.add :conflict, "changes not based on latest revision"
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_history/set/all/content_history.rb ~~~~~~~~~~~
|
140
|
+
end;end;end;end;
|
@@ -0,0 +1,341 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
class Card; module Set; module All; module History; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_history/set/all/history.rb ~~~~~~~~~~~
|
3
|
+
REVISIONS_PER_PAGE = Card.config.revisions_per_page
|
4
|
+
|
5
|
+
def history?
|
6
|
+
true
|
7
|
+
end
|
8
|
+
|
9
|
+
# must be called on all actions and before :set_name, :process_subcards and :validate_delete_children
|
10
|
+
event :assign_act, :before=>:approve, :when=>proc {|c| c.history?} do
|
11
|
+
@current_act = (@supercard && @supercard.current_act) || Card::Act.create(:ip_address=>Env.ip)
|
12
|
+
end
|
13
|
+
|
14
|
+
event :assign_action, :after=>:assign_act do
|
15
|
+
@current_action = Card::Action.create(:card_act_id=>@current_act.id, :action_type=>@action, :draft=>(Env.params['draft'] == 'true') )
|
16
|
+
if (@supercard and @supercard !=self)
|
17
|
+
@current_action.super_action = @supercard.current_action
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
# stores changes in the changes table and assigns them to the current action
|
23
|
+
# removes the action if there are no changes
|
24
|
+
event :finalize_action, :after =>:stored, :when=>proc {|c| c.history? && c.current_action} do
|
25
|
+
@changed_fields = Card::TRACKED_FIELDS.select{ |f| changed_attributes.member? f }
|
26
|
+
if @changed_fields.present?
|
27
|
+
@changed_fields.each{ |f| Card::Change.create :field => f, :value => self[f], :card_action_id=>@current_action.id }
|
28
|
+
@current_action.update_attributes! :card_id => id
|
29
|
+
elsif @current_action.card_changes(true).empty?
|
30
|
+
@current_action.delete
|
31
|
+
@current_action = nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
event :finalize_act, :after=>:finalize_action, :when=>proc {|c| c.history? && !c.supercard } do
|
36
|
+
if @current_act.actions(true).empty?
|
37
|
+
@current_act.delete
|
38
|
+
@current_act = nil
|
39
|
+
else
|
40
|
+
@current_act.update_attributes! :card_id=>id
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
event :rollback_actions, :before=>:approve, :on=>:update, :when=>proc{ |c| c.rollback_request? } do
|
46
|
+
revision = { :subcards => {}}
|
47
|
+
rollback_actions = Env.params['action_ids'].map do |a_id|
|
48
|
+
Action.fetch(a_id) || nil
|
49
|
+
end
|
50
|
+
rollback_actions.each do |action|
|
51
|
+
if action.card_id == id
|
52
|
+
revision.merge!(revision(action))
|
53
|
+
else
|
54
|
+
revision[:subcards][action.card.name] = revision(action)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
Env.params['action_ids'] = nil
|
58
|
+
update_attributes! revision
|
59
|
+
rollback_actions.each do |action|
|
60
|
+
action.card.try :symlink_to, action.id
|
61
|
+
end
|
62
|
+
clear_drafts
|
63
|
+
abort :success
|
64
|
+
end
|
65
|
+
|
66
|
+
def rollback_request?
|
67
|
+
history? && Env && Env.params['action_ids'] && Env.params['action_ids'].class == Array
|
68
|
+
end
|
69
|
+
|
70
|
+
# alternative approach to handle act and action that doesn't change the database in the beginning
|
71
|
+
# stopped working with Rails 4
|
72
|
+
# def build_act_and_action
|
73
|
+
# @current_act = if @supercard
|
74
|
+
# @supercard.current_act || @supercard.acts.build(:ip_address=>Env.ip)
|
75
|
+
# else
|
76
|
+
# acts.build(:ip_address=>Env.ip)
|
77
|
+
# end
|
78
|
+
# @current_action = actions(true).build(:action_type=>@action, :draft=>(Env.params['draft'] == 'true') )
|
79
|
+
# @current_action.act = @current_act
|
80
|
+
#
|
81
|
+
# if (@supercard and @supercard !=self)
|
82
|
+
# @current_action.super_action = @supercard.current_action
|
83
|
+
# end
|
84
|
+
# end
|
85
|
+
|
86
|
+
|
87
|
+
def intrusive_family_acts args={} # all acts with actions on self and on cards that are descendants of self and included in self
|
88
|
+
@intrusive_family_acts ||= begin
|
89
|
+
Act.find_all_with_actions_on( (included_descendant_card_ids << id), args)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
def intrusive_acts args={:with_drafts=>true} # all acts with actions on self and on cards included in self
|
94
|
+
@intrusive_acts ||= begin
|
95
|
+
Act.find_all_with_actions_on( (included_card_ids << id), args)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def current_rev_nr
|
100
|
+
@current_rev_nr ||= begin
|
101
|
+
intrusive_acts.first.actions.last.draft ? @intrusive_acts.size - 1 : @intrusive_acts.size
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
def included_card_ids
|
106
|
+
Card::Reference.select(:referee_id).where( :ref_type => 'I', :referer_id=>id ).pluck('referee_id').compact.uniq
|
107
|
+
end
|
108
|
+
|
109
|
+
def descendant_card_ids parent_ids=[id]
|
110
|
+
more_ids = Card.where('left_id IN (?)', parent_ids).pluck('id')
|
111
|
+
|
112
|
+
if !more_ids.empty?
|
113
|
+
more_ids += descendant_card_ids more_ids
|
114
|
+
end
|
115
|
+
more_ids
|
116
|
+
end
|
117
|
+
|
118
|
+
def included_descendant_card_ids
|
119
|
+
included_card_ids & descendant_card_ids
|
120
|
+
end
|
121
|
+
|
122
|
+
format :html do
|
123
|
+
view :history do |args|
|
124
|
+
frame args.merge(:body_class=>"history-slot list-group", :content=>true) do
|
125
|
+
[
|
126
|
+
history_legend,
|
127
|
+
_render_revisions
|
128
|
+
]
|
129
|
+
end
|
130
|
+
end
|
131
|
+
def default_history_args args
|
132
|
+
args[:optional_toolbar] ||= :show
|
133
|
+
end
|
134
|
+
|
135
|
+
view :revisions do |args|
|
136
|
+
page = params['page'] || 1
|
137
|
+
count = card.intrusive_acts.size+1-(page.to_i-1)*REVISIONS_PER_PAGE
|
138
|
+
card.intrusive_acts.page(page).per(REVISIONS_PER_PAGE).map do |act|
|
139
|
+
count -= 1
|
140
|
+
render_act_summary args.merge(:act=>act,:rev_nr=>count)
|
141
|
+
end.join
|
142
|
+
end
|
143
|
+
|
144
|
+
def history_legend
|
145
|
+
intr = card.intrusive_acts.page(params['page']).per(REVISIONS_PER_PAGE)
|
146
|
+
render_haml :intr=>intr do
|
147
|
+
<<-HAML
|
148
|
+
.history-header
|
149
|
+
%span.slotter
|
150
|
+
= paginate intr, :remote=>true, :theme=>'twitter-bootstrap-3'
|
151
|
+
%div.history-legend
|
152
|
+
%span.glyphicon.glyphicon-plus-sign.diff-green
|
153
|
+
%span
|
154
|
+
= Card::Diff.render_added_chunk("Added")
|
155
|
+
|
|
156
|
+
%span.glyphicon.glyphicon-minus-sign.diff-red
|
157
|
+
%span
|
158
|
+
= Card::Diff.render_deleted_chunk("Deleted")
|
159
|
+
HAML
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
view :act_summary do |args|
|
164
|
+
render_act :summary, args
|
165
|
+
end
|
166
|
+
|
167
|
+
view :act_expanded do |args|
|
168
|
+
render_act :expanded, args
|
169
|
+
end
|
170
|
+
|
171
|
+
def render_act act_view, args
|
172
|
+
act = (params['act_id'] and Card::Act.find(params['act_id'])) || args[:act]
|
173
|
+
rev_nr = params['rev_nr'] || args[:rev_nr]
|
174
|
+
current_rev_nr = params['current_rev_nr'] || args[:current_rev_nr] || card.current_rev_nr
|
175
|
+
hide_diff = (params["hide_diff"]=="true") || args[:hide_diff]
|
176
|
+
wrap( args.merge(:slot_class=>"revision-#{act.id} history-slot list-group-item") ) do
|
177
|
+
render_haml :card=>card, :act=>act, :act_view=>act_view,
|
178
|
+
:current_rev_nr=>current_rev_nr, :rev_nr=>rev_nr,
|
179
|
+
:hide_diff=> hide_diff do
|
180
|
+
<<-HAML
|
181
|
+
.act{:style=>"clear:both;"}
|
182
|
+
.head
|
183
|
+
.nr
|
184
|
+
= "##{rev_nr}"
|
185
|
+
.title
|
186
|
+
.actor
|
187
|
+
= link_to act.actor.name, card_url( act.actor.cardname.url_key )
|
188
|
+
.time.timeago
|
189
|
+
= time_ago_in_words(act.acted_at)
|
190
|
+
ago
|
191
|
+
- if act.actions.last.draft
|
192
|
+
|
|
193
|
+
%em.info
|
194
|
+
Autosave
|
195
|
+
- if current_rev_nr == rev_nr
|
196
|
+
%em.label.label-info
|
197
|
+
Current
|
198
|
+
- elsif act_view == :expanded
|
199
|
+
= rollback_link act.relevant_actions_for(card, act.actions.last.draft)
|
200
|
+
= show_or_hide_changes_link hide_diff, :act_id=>act.id, :act_view=>act_view, :rev_nr=>rev_nr, :current_rev_nr=>current_rev_nr
|
201
|
+
.toggle
|
202
|
+
= fold_or_unfold_link :act_id=>act.id, :act_view=>act_view, :rev_nr=>rev_nr, :current_rev_nr=>current_rev_nr
|
203
|
+
|
204
|
+
.action-container{:style=>("clear: left;" if act_view == :expanded)}
|
205
|
+
- act.relevant_actions_for(card).each do |action|
|
206
|
+
= send("_render_action_#{ act_view }", :action=>action )
|
207
|
+
HAML
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
view :action_summary do |args|
|
213
|
+
render_action :summary, args
|
214
|
+
end
|
215
|
+
|
216
|
+
view :action_expanded do |args|
|
217
|
+
render_action :expanded, args
|
218
|
+
end
|
219
|
+
|
220
|
+
def render_action action_view, args
|
221
|
+
action = args[:action] || card.last_action
|
222
|
+
hide_diff = Env.params["hide_diff"]=="true" || args[:hide_diff]
|
223
|
+
name_diff =
|
224
|
+
if action.card == card
|
225
|
+
name_changes(action, hide_diff)
|
226
|
+
else
|
227
|
+
link_to name_changes(action, hide_diff),
|
228
|
+
path(:view=>:related, :related=>{:view=>"history",:name=>action.card.name}),
|
229
|
+
:class=>'slotter label label-default',
|
230
|
+
'data-slot-selector'=>".card-slot.history-view",
|
231
|
+
:remote=>true
|
232
|
+
end
|
233
|
+
|
234
|
+
type_diff =
|
235
|
+
action.new_type? &&
|
236
|
+
type_changes(action, hide_diff)
|
237
|
+
|
238
|
+
content_diff =
|
239
|
+
action.new_content? &&
|
240
|
+
action.card.format.render_content_changes(:action=>action, :diff_type=>action_view, :hide_diff=>hide_diff)
|
241
|
+
|
242
|
+
render_haml :action => action,
|
243
|
+
:action_view => action_view,
|
244
|
+
:name_diff => name_diff,
|
245
|
+
:type_diff => type_diff,
|
246
|
+
:content_diff => content_diff do
|
247
|
+
<<-HAML
|
248
|
+
.action
|
249
|
+
.summary
|
250
|
+
%span.ampel
|
251
|
+
= glyphicon 'minus-sign', (action.red? ? 'diff-red' : 'diff-invisible')
|
252
|
+
= glyphicon 'plus-sign', (action.green? ? 'diff-green' : 'diff-invisible')
|
253
|
+
= wrap_diff :name, name_diff
|
254
|
+
= wrap_diff :type, type_diff
|
255
|
+
-if content_diff
|
256
|
+
= glyphicon 'arrow-right', 'arrow'
|
257
|
+
-if action_view == :summary
|
258
|
+
= wrap_diff :content, content_diff
|
259
|
+
-if content_diff and action_view == :expanded
|
260
|
+
.expanded
|
261
|
+
= wrap_diff :content, content_diff
|
262
|
+
HAML
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
def wrap_diff field, content
|
267
|
+
if content.present?
|
268
|
+
%{
|
269
|
+
<span class="#{field}-diff">
|
270
|
+
#{content}
|
271
|
+
</span>
|
272
|
+
}
|
273
|
+
else
|
274
|
+
''
|
275
|
+
end
|
276
|
+
end
|
277
|
+
|
278
|
+
|
279
|
+
def name_changes action, hide_diff=false
|
280
|
+
old_name = (name = action.old_values[:name] and showname(name).to_s)
|
281
|
+
if action.new_name?
|
282
|
+
new_name = showname(action.new_values[:name]).to_s
|
283
|
+
if hide_diff
|
284
|
+
new_name
|
285
|
+
else
|
286
|
+
Card::Diff.complete(old_name,new_name)
|
287
|
+
end
|
288
|
+
else
|
289
|
+
old_name
|
290
|
+
end
|
291
|
+
end
|
292
|
+
|
293
|
+
def type_changes action, hide_diff=false
|
294
|
+
change = hide_diff ? action.new_values[:cardtype] : action.cardtype_diff
|
295
|
+
"(#{change})"
|
296
|
+
end
|
297
|
+
|
298
|
+
|
299
|
+
view :content_changes do |args|
|
300
|
+
if args[:hide_diff]
|
301
|
+
args[:action].new_values[:content]
|
302
|
+
else
|
303
|
+
args[:action].content_diff(args[:diff_type])
|
304
|
+
end
|
305
|
+
end
|
306
|
+
|
307
|
+
def rollback_link actions
|
308
|
+
not_current = actions.select { |action| action.card.last_action_id != action.id }
|
309
|
+
if card.ok?(:update) && not_current.present?
|
310
|
+
"| " + link_to('Save as current', path(:action=>:update, :view=>:open, :action_ids=>not_current),
|
311
|
+
:class=>'slotter','data-slot-selector'=>'.card-slot.history-view', :remote=>true, :method=>:post, :rel=>'nofollow')
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
def fold_or_unfold_link args
|
316
|
+
if (args[:act_view] == :expanded)
|
317
|
+
toggled_view = :act_summary
|
318
|
+
else
|
319
|
+
toggled_view = :act_expanded
|
320
|
+
end
|
321
|
+
link_to '', args.merge(:view=>toggled_view),
|
322
|
+
:class=>"slotter revision-#{args[:act_id]} #{ args[:act_view]==:expanded ? "arrow-down" : "arrow-right"}",
|
323
|
+
:remote=>true
|
324
|
+
end
|
325
|
+
|
326
|
+
def show_or_hide_changes_link hide_diff, args
|
327
|
+
"| " + view_link( (hide_diff ? "Show" : "Hide") + " changes", :act_expanded,
|
328
|
+
:path_opts=>args.merge(:hide_diff=>!hide_diff),
|
329
|
+
:class=>'slotter', :remote=>true )
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
def diff_args
|
334
|
+
{:format=>:text}
|
335
|
+
end
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
|
340
|
+
# ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_history/set/all/history.rb ~~~~~~~~~~~
|
341
|
+
end;end;end;end;
|