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
@@ -1,2 +1,3 @@
|
|
1
|
-
include
|
2
|
-
|
1
|
+
include Abstract::Permission
|
2
|
+
|
3
|
+
format :html do include Abstract::Permission::HtmlFormat end
|
@@ -1,2 +1,3 @@
|
|
1
|
-
include
|
2
|
-
|
1
|
+
include Abstract::Permission
|
2
|
+
|
3
|
+
format :html do include Abstract::Permission::HtmlFormat end
|
@@ -77,7 +77,8 @@ event :stash_followers, :after=>:approve, :on=>:delete do
|
|
77
77
|
act_card.follower_stash ||= FollowerStash.new
|
78
78
|
act_card.follower_stash.add_affected_card self
|
79
79
|
end
|
80
|
-
event :notify_followers_after_delete, :after=>:extend, :on=>:delete,
|
80
|
+
event :notify_followers_after_delete, :after=>:extend, :on=>:delete,
|
81
|
+
:when=>proc{ |ca| ca.notable_change? } do
|
81
82
|
notify_followers
|
82
83
|
end
|
83
84
|
|
@@ -8,13 +8,13 @@ def deliver args={}
|
|
8
8
|
mail = format.render_mail(args)
|
9
9
|
mail.deliver
|
10
10
|
rescue Net::SMTPError => exception
|
11
|
-
errors.add :exception, exception.message
|
11
|
+
errors.add :exception, exception.message
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def process_email_field field, config, args
|
16
|
-
config[field] =
|
17
|
-
if args[field]
|
16
|
+
config[field] =
|
17
|
+
if args[field]
|
18
18
|
args[field]
|
19
19
|
elsif field_card = fetch(:trait=>field)
|
20
20
|
# configuration can be anything visible to configurer
|
@@ -22,7 +22,7 @@ def process_email_field field, config, args
|
|
22
22
|
Auth.as( user ) do
|
23
23
|
yield(field_card)
|
24
24
|
end
|
25
|
-
else
|
25
|
+
else
|
26
26
|
''
|
27
27
|
end
|
28
28
|
end
|
@@ -38,7 +38,7 @@ end
|
|
38
38
|
def email_config args={}
|
39
39
|
config = {}
|
40
40
|
args[:context] ||= self
|
41
|
-
|
41
|
+
|
42
42
|
[:to, :from, :cc, :bcc].each do |field_name|
|
43
43
|
process_email_field( field_name, config, args ) do |field_card|
|
44
44
|
field_card.process_email_addresses args[:context], {:format=>'email_text'}, args
|
@@ -50,22 +50,22 @@ def email_config args={}
|
|
50
50
|
process_message_field :subject, config, args, 'email_text', :content_opts=>{ :chunk_list=>:inclusion_only }
|
51
51
|
process_message_field :text_message, config, args, 'email_text'
|
52
52
|
process_message_field :html_message, config, args, 'email_html'
|
53
|
-
config[:html_message] = Card::Mailer.layout config[:html_message] if config[:html_message].present?
|
54
|
-
|
55
|
-
|
53
|
+
config[:html_message] = Card::Mailer.layout config[:html_message] if config[:html_message].present?
|
54
|
+
|
55
|
+
|
56
56
|
from_name, from_email = (config[:from] =~ /(.*)\<(.*)>/) ? [$1.strip, $2] : [nil, config[:from]]
|
57
57
|
|
58
58
|
if default_from=Card::Mailer.default[:from]
|
59
59
|
config[:from] = from_email ? %["#{from_name || from_email}" <#{default_from}>] : default_from
|
60
60
|
config[:reply_to] ||= config[:from]
|
61
|
-
elsif config[:from].blank?
|
61
|
+
elsif config[:from].blank?
|
62
62
|
config[:from] = Card[Card::WagnBotID].account.email
|
63
63
|
end
|
64
64
|
config.select {|k,v| v.present? }
|
65
65
|
end
|
66
66
|
|
67
67
|
|
68
|
-
format do
|
68
|
+
format do
|
69
69
|
view :mail, :perms=>:none do |args|
|
70
70
|
args = card.email_config(args)
|
71
71
|
text_message = args.delete(:text_message)
|
@@ -73,7 +73,7 @@ format do
|
|
73
73
|
attachment_list = args.delete(:attach)
|
74
74
|
alternative = (text_message.present? && html_message.present?)
|
75
75
|
mail = Card::Mailer.new_mail(args) do
|
76
|
-
if alternative
|
76
|
+
if alternative
|
77
77
|
if attachment_list and !attachment_list.empty?
|
78
78
|
content_type 'multipart/mixed'
|
79
79
|
part :content_type => 'multipart/alternative' do |copy|
|
@@ -83,7 +83,7 @@ format do
|
|
83
83
|
copy.part :content_type => 'text/html' do |html|
|
84
84
|
html.body = html_message
|
85
85
|
end
|
86
|
-
end
|
86
|
+
end
|
87
87
|
else
|
88
88
|
text_part { body text_message }
|
89
89
|
html_part do
|
@@ -98,16 +98,16 @@ format do
|
|
98
98
|
content_type 'text/plain; charset=UTF-8'
|
99
99
|
text_part { body text_message }
|
100
100
|
end
|
101
|
-
|
101
|
+
|
102
102
|
if attachment_list
|
103
103
|
attachment_list.each_with_index do |cardname, i|
|
104
|
-
if c = Card[ cardname ] and c.respond_to?(:
|
105
|
-
add_file :filename => "attachment-#{i + 1}.#{c.
|
104
|
+
if c = Card[ cardname ] and c.respond_to?(:attachment)
|
105
|
+
add_file :filename => "attachment-#{i + 1}.#{c.attachment.extension}", :content => File.read( c.attachment.path )
|
106
106
|
end
|
107
107
|
end
|
108
|
-
end
|
108
|
+
end
|
109
109
|
end #TODO add error handling
|
110
110
|
mail
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
end
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'carrierwave'
|
2
|
+
|
3
|
+
module CarrierWave
|
4
|
+
module CardMount
|
5
|
+
include CarrierWave::Mount
|
6
|
+
|
7
|
+
|
8
|
+
def uploaders
|
9
|
+
Card.uploaders ||= {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def uploader_options
|
13
|
+
Card.uploader_options ||= {}
|
14
|
+
end
|
15
|
+
|
16
|
+
def mount_uploader(column, uploader=nil, options={}, &block)
|
17
|
+
options[:mount_on] ||= :db_content
|
18
|
+
super
|
19
|
+
|
20
|
+
class_eval <<-RUBY, __FILE__, __LINE__+1
|
21
|
+
event :store_#{column}_event, :on=>:save, :before=>:store do
|
22
|
+
store_#{column}!
|
23
|
+
end
|
24
|
+
event :remove_#{column}_event, :on =>:delete, :after=>:stored do
|
25
|
+
remove_#{column}!
|
26
|
+
end
|
27
|
+
event :mark_remove_#{column}_false_event, :on => :update, :after=>:stored do
|
28
|
+
mark_remove_#{column}_false
|
29
|
+
end
|
30
|
+
event :store_previous_model_for_#{column}_event, :on=>:update, :before =>:store do
|
31
|
+
store_previous_model_for_#{column}
|
32
|
+
end
|
33
|
+
|
34
|
+
def attachment
|
35
|
+
#{column}
|
36
|
+
end
|
37
|
+
|
38
|
+
def read_uploader *args
|
39
|
+
read_attribute *args
|
40
|
+
end
|
41
|
+
def write_uploader *args
|
42
|
+
write_attribute *args
|
43
|
+
end
|
44
|
+
def #{column}=(new_file)
|
45
|
+
column = _mounter(:#{column}).serialization_column
|
46
|
+
send(:"\#{column}_will_change!")
|
47
|
+
super
|
48
|
+
end
|
49
|
+
|
50
|
+
def remote_#{column}_url=(url)
|
51
|
+
column = _mounter(:#{column}).serialization_column
|
52
|
+
send(:"\#{column}_will_change!")
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
56
|
+
def remove_#{column}!
|
57
|
+
super
|
58
|
+
_mounter(:#{column}).remove = true
|
59
|
+
_mounter(:#{column}).write_identifier
|
60
|
+
end
|
61
|
+
|
62
|
+
def serializable_hash(options=nil)
|
63
|
+
hash = {}
|
64
|
+
|
65
|
+
except = options && options[:except] && Array.wrap(options[:except]).map(&:to_s)
|
66
|
+
only = options && options[:only] && Array.wrap(options[:only]).map(&:to_s)
|
67
|
+
|
68
|
+
self.class.uploaders.each do |column, uploader|
|
69
|
+
if (!only && !except) || (only && only.include?(column.to_s)) || (!only && except && !except.include?(column.to_s))
|
70
|
+
hash[column.to_s] = _mounter(column).uploader.serializable_hash
|
71
|
+
end
|
72
|
+
end
|
73
|
+
super(options).merge(hash)
|
74
|
+
end
|
75
|
+
RUBY
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
DATABASE_CONTENT
|
4
|
+
if in mod:
|
5
|
+
:codename/modname.ext
|
6
|
+
else
|
7
|
+
~card_id/action_id.ext
|
8
|
+
|
9
|
+
|
10
|
+
FILE SYSTEM
|
11
|
+
if in mod
|
12
|
+
(mod_dir)/files/codename/type_code-variant.ext (no colon on codename!)
|
13
|
+
else
|
14
|
+
(files_dir)/id/action_id-variant.ext (no tilde on id!)
|
15
|
+
|
16
|
+
variant = icon|small|medium|large|original
|
17
|
+
|
18
|
+
|
19
|
+
URLS
|
20
|
+
mark.ext
|
21
|
+
mark/revision.ext
|
22
|
+
mark/revision-variant.ext
|
23
|
+
|
24
|
+
revision = modname or action_id
|
25
|
+
|
26
|
+
Examples:
|
27
|
+
~22/33-medium.png
|
28
|
+
:yeti_skin/05_standard-large.png
|
29
|
+
|
30
|
+
=end
|
31
|
+
|
32
|
+
|
33
|
+
module CarrierWave::Uploader::Versions
|
34
|
+
private
|
35
|
+
|
36
|
+
# put version at the end of the filename
|
37
|
+
def full_filename(for_file)
|
38
|
+
name = super(for_file)
|
39
|
+
parts = name.split '.'
|
40
|
+
basename = [parts.shift, version_name].compact.join('-')
|
41
|
+
"#{basename}.#{parts.join('.')}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
class FileUploader < CarrierWave::Uploader::Base
|
46
|
+
attr_accessor :mod
|
47
|
+
include Card::Format::Location
|
48
|
+
|
49
|
+
storage :file
|
50
|
+
|
51
|
+
def filename
|
52
|
+
if mod_file?
|
53
|
+
"#{model.type_code}#{extension}"
|
54
|
+
else
|
55
|
+
"#{action_id}#{extension}"
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def extension
|
60
|
+
if file && file.extension.present?
|
61
|
+
".#{file.extension}"
|
62
|
+
elsif original_filename
|
63
|
+
File.extname(original_filename)
|
64
|
+
else model.content
|
65
|
+
File.extname(model.content)
|
66
|
+
end.downcase
|
67
|
+
end
|
68
|
+
|
69
|
+
# the identifier gets stored in the card's db_content field
|
70
|
+
def db_content(args={})
|
71
|
+
basename =
|
72
|
+
if (args[:mod])
|
73
|
+
"#{args[:mod]}#{extension}"
|
74
|
+
else
|
75
|
+
filename
|
76
|
+
end
|
77
|
+
"%s/%s" % [file_dir, basename]
|
78
|
+
end
|
79
|
+
|
80
|
+
def url(options = {})
|
81
|
+
"%s/%s/%s" % [card_path(Card.config.files_web_path), file_dir, full_filename(filename)]
|
82
|
+
end
|
83
|
+
|
84
|
+
def file_dir
|
85
|
+
if (mod = mod_file?)
|
86
|
+
":#{model.codename}"
|
87
|
+
elsif model.id
|
88
|
+
"~#{model.id}"
|
89
|
+
else
|
90
|
+
"#{model.key}" # FIXME what if the card has not a name yet?
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def cache_dir
|
95
|
+
Cardio.paths['files'].existent.first + '/tmp'
|
96
|
+
end
|
97
|
+
|
98
|
+
# Carrierwave usually store the filename as identifier in the database
|
99
|
+
# and retrieve_from_store! calls store_path with the identifier from the db
|
100
|
+
# In our case the first part of our identifier is not part of the path
|
101
|
+
# but we construct the filename from db data. So we don't need the identifier.
|
102
|
+
# We can just call store_path always with the filename
|
103
|
+
def store_path(for_file=filename) #
|
104
|
+
super(filename)
|
105
|
+
end
|
106
|
+
|
107
|
+
# paperclip compatibility used in type/file.rb#core (base format)
|
108
|
+
def path(version=nil)
|
109
|
+
version ? versions[version].path : super()
|
110
|
+
end
|
111
|
+
|
112
|
+
def original_filename
|
113
|
+
@original_filename || model.selected_action.comment
|
114
|
+
end
|
115
|
+
|
116
|
+
def store_dir
|
117
|
+
model.store_dir
|
118
|
+
end
|
119
|
+
|
120
|
+
def mod_file?
|
121
|
+
@mod ||= model.mod_file?
|
122
|
+
end
|
123
|
+
|
124
|
+
def action_id
|
125
|
+
model.selected_content_action_id
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'mini_magick'
|
2
|
+
|
3
|
+
class ImageUploader < FileUploader
|
4
|
+
include CarrierWave::MiniMagick
|
5
|
+
|
6
|
+
def path(version=nil)
|
7
|
+
(version && version != :original) ? versions[version].path : super()
|
8
|
+
end
|
9
|
+
|
10
|
+
version :icon do #, :from_version=>:small do
|
11
|
+
process :resize_and_pad => [16,16]
|
12
|
+
end
|
13
|
+
version :small do #, :from_version=>:medium do
|
14
|
+
process :resize_to_fit => [75,75]
|
15
|
+
end
|
16
|
+
version :medium do
|
17
|
+
process :resize_to_fit => [200,200]
|
18
|
+
end
|
19
|
+
version :large do
|
20
|
+
process :resize_to_fit => [500,500]
|
21
|
+
end
|
22
|
+
|
23
|
+
# add 'original' if no version is given
|
24
|
+
def full_filename(for_file)
|
25
|
+
name = super(for_file)
|
26
|
+
if version_name
|
27
|
+
name
|
28
|
+
else
|
29
|
+
parts = name.split '.'
|
30
|
+
"#{parts.shift}-original.#{parts.join('.')}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'carrier_wave/cardmount'
|
2
|
+
def self.included host_class
|
3
|
+
host_class.extend CarrierWave::CardMount
|
4
|
+
end
|
5
|
+
|
6
|
+
|
7
|
+
event :write_identifier, :after=>:assign_action do
|
8
|
+
self.content = attachment.db_content
|
9
|
+
end
|
10
|
+
|
11
|
+
event :save_original_filename, :before=>:finalize_action do
|
12
|
+
if @current_action
|
13
|
+
@current_action.update_attributes! :comment=>original_filename
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
event :move_file_to_store_dir, :after=>:store, :on=>:create do
|
18
|
+
if ::File.exist? tmp_store_dir
|
19
|
+
if ::File.exist? store_dir
|
20
|
+
FileUtils.rm_rf store_dir
|
21
|
+
end
|
22
|
+
FileUtils.mv tmp_store_dir, store_dir
|
23
|
+
end
|
24
|
+
if !(content =~ /^[:~]/)
|
25
|
+
update_column(:db_content,attachment.db_content)
|
26
|
+
expire
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def item_names(args={}) # needed for flexmail attachments. hacky.
|
31
|
+
[self.cardname]
|
32
|
+
end
|
33
|
+
|
34
|
+
def original_filename
|
35
|
+
attachment.original_filename
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def assign_set_specific_attributes
|
40
|
+
if @set_specific && @set_specific.present?
|
41
|
+
self.content = nil
|
42
|
+
end
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
def symlink_to(prior_action_id) # create filesystem links to files from prior action
|
48
|
+
if prior_action_id != last_action_id
|
49
|
+
save_action_id = selected_action_id
|
50
|
+
links = {}
|
51
|
+
|
52
|
+
self.selected_action_id = prior_action_id
|
53
|
+
attachment.versions.each do |name, version|
|
54
|
+
links[name] = version.store_path
|
55
|
+
end
|
56
|
+
original = attachment.store_path
|
57
|
+
|
58
|
+
self.selected_action_id = last_action_id
|
59
|
+
attachment.versions.each do |name, version|
|
60
|
+
::File.symlink links[name], version.store_path
|
61
|
+
end
|
62
|
+
::File.symlink original, attachment.store_path
|
63
|
+
|
64
|
+
self.selected_action_id = save_action_id
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def attachment_format(ext)
|
69
|
+
if ext.present? && attachment && original_ext=attachment.extension
|
70
|
+
if['file', original_ext].member? ext
|
71
|
+
original_ext
|
72
|
+
elsif exts = MIME::Types[attachment.content_type]
|
73
|
+
if exts.find {|mt| mt.extensions.member? ext }
|
74
|
+
ext
|
75
|
+
else
|
76
|
+
exts[0].extensions[0]
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
rescue => e
|
81
|
+
Rails.logger.info "attachment_format issue: #{e.message}"
|
82
|
+
nil
|
83
|
+
end
|
84
|
+
|
85
|
+
|