card 1.96.8 → 1.97.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/config/initializers/01_core_extensions/hash.rb +7 -7
- data/config/initializers/01_core_extensions/object.rb +8 -4
- data/config/initializers/02_patches/kaminari.rb +0 -6
- data/config/locales/de.yml +7 -4
- data/config/locales/en.yml +46 -39
- data/db/migrate/20110511221913_require_earlier_migrations.rb +1 -0
- data/db/migrate/20120105203350_require_1_8_migrations.rb +1 -0
- data/db/migrate/20190116170824_add_left_key_to_card_virtuals.rb +11 -0
- data/db/migrate/20190131223248_add_codename_index.rb +9 -0
- data/db/migrate_core_cards/20120611203506_rails_inflection_updates.rb +8 -2
- data/db/migrate_core_cards/20180712042655_head_rule.rb +14 -0
- data/db/migrate_core_cards/20180905061536_migrate_layouts.rb +64 -0
- data/db/migrate_core_cards/20190125125150_add_script_rules_card.rb +9 -0
- data/db/migrate_core_cards/20190204195039_add_rule_card.rb +7 -0
- data/db/migrate_core_cards/data/decko_logo.svg +59 -0
- data/db/schema.rb +3 -2
- data/db/seed/new/card_actions.yml +1506 -1458
- data/db/seed/new/card_acts.yml +2 -2
- data/db/seed/new/card_references.yml +633 -633
- data/db/seed/new/cards.yml +1802 -1634
- data/db/seed/new/schema_migrations.yml +4 -0
- data/db/seed/new/schema_migrations_core_cards.yml +28 -2
- data/db/seed/test/fixtures/card_actions.yml +2485 -2533
- data/db/seed/test/fixtures/card_acts.yml +520 -460
- data/db/seed/test/fixtures/card_changes.yml +66 -66
- data/db/seed/test/fixtures/card_references.yml +1533 -1407
- data/db/seed/test/fixtures/cards.yml +3392 -2945
- data/db/seed/test/fixtures/schema_migrations.yml +4 -0
- data/db/seed/test/fixtures/schema_migrations_core_cards.yml +28 -2
- data/db/seed/test/seed.rb +33 -1
- data/db/version.txt +1 -1
- data/db/version_core_cards.txt +1 -1
- data/lib/card.rb +1 -0
- data/lib/card/act_manager.rb +6 -2
- data/lib/card/act_manager/stage.rb +5 -5
- data/lib/card/act_manager/stage_director.rb +11 -7
- data/lib/card/act_manager/stage_director/phases.rb +4 -8
- data/lib/card/auth.rb +1 -0
- data/lib/card/auth/current.rb +1 -1
- data/lib/card/auth/permissions.rb +1 -0
- data/lib/card/auth/proxy.rb +1 -0
- data/lib/card/cache.rb +10 -9
- data/lib/card/cache/persistent.rb +2 -1
- data/lib/card/cache/prepopulate.rb +1 -0
- data/lib/card/cache/temporary.rb +1 -0
- data/lib/card/codename.rb +11 -6
- data/lib/card/content/chunk.rb +24 -9
- data/lib/card/content/clean.rb +4 -2
- data/lib/card/content/diff.rb +4 -4
- data/lib/card/content/diff/lcs.rb +1 -3
- data/lib/card/content/diff/processor.rb +2 -0
- data/lib/card/content/diff/result.rb +3 -0
- data/lib/card/content/parser.rb +2 -1
- data/lib/card/content/truncate.rb +4 -1
- data/lib/card/dirty.rb +3 -2
- data/lib/card/env.rb +11 -2
- data/lib/card/env/location_history.rb +3 -1
- data/lib/card/env/success.rb +3 -1
- data/lib/card/error.rb +42 -8
- data/lib/card/format.rb +22 -9
- data/lib/card/format/content.rb +10 -2
- data/lib/card/format/context_names.rb +4 -2
- data/lib/card/format/error.rb +1 -1
- data/lib/card/format/nest.rb +4 -3
- data/lib/card/format/nesting.rb +2 -0
- data/lib/card/format/nesting/main.rb +11 -5
- data/lib/card/format/nesting/mode.rb +1 -0
- data/lib/card/format/nesting/subformat.rb +12 -0
- data/lib/card/format/permission.rb +3 -0
- data/lib/card/format/registration.rb +7 -3
- data/lib/card/format/render.rb +73 -17
- data/lib/card/mailer.rb +2 -1
- data/lib/card/mark.rb +2 -2
- data/lib/card/migration.rb +115 -113
- data/lib/card/migration/core.rb +1 -0
- data/lib/card/migration/deck_structure.rb +1 -0
- data/lib/card/migration/import.rb +1 -1
- data/lib/card/migration/import/import_data.rb +6 -3
- data/lib/card/migration/import/import_data/card_attributes.rb +56 -54
- data/lib/card/migration/import/import_data/card_content.rb +0 -1
- data/lib/card/mod.rb +4 -1
- data/lib/card/mod/dirs.rb +11 -2
- data/lib/card/mod/load_strategy.rb +4 -4
- data/lib/card/mod/load_strategy/set_binding_magic.rb +9 -5
- data/lib/card/mod/load_strategy/set_tmp_files.rb +1 -1
- data/lib/card/mod/load_strategy/tmp_files.rb +1 -0
- data/lib/card/mod/loader.rb +8 -9
- data/lib/card/mod/loader/set_loader.rb +4 -4
- data/lib/card/mod/loader/set_pattern_loader.rb +2 -2
- data/lib/card/mod/module_template.rb +12 -12
- data/lib/card/model/save_helper.rb +13 -4
- data/lib/card/name.rb +3 -2
- data/lib/card/name/name_variants.rb +3 -3
- data/lib/card/query.rb +19 -12
- data/lib/card/query/abstract_query/query_helper.rb +2 -0
- data/lib/card/query/card_query.rb +1 -0
- data/lib/card/query/card_query/conjunctions.rb +2 -0
- data/lib/card/query/card_query/interpretation.rb +2 -7
- data/lib/card/query/card_query/match_attributes.rb +1 -0
- data/lib/card/query/card_query/reference_attributes.rb +4 -4
- data/lib/card/query/card_query/run.rb +1 -0
- data/lib/card/query/card_query/sorting.rb +1 -0
- data/lib/card/query/clause.rb +14 -12
- data/lib/card/query/join.rb +4 -2
- data/lib/card/query/reference_query.rb +1 -0
- data/lib/card/query/sql_statement.rb +4 -8
- data/lib/card/query/sql_statement/joins.rb +1 -0
- data/lib/card/query/sql_statement/order.rb +7 -6
- data/lib/card/query/sql_statement/where.rb +3 -1
- data/lib/card/query/value.rb +1 -0
- data/lib/card/reference.rb +1 -0
- data/lib/card/set/advanced_api.rb +2 -2
- data/lib/card/set/code_nest.rb +15 -0
- data/lib/card/set/event.rb +4 -3
- data/lib/card/set/event/callbacks.rb +1 -0
- data/lib/card/set/event/delayed_event.rb +7 -6
- data/lib/card/set/event/options.rb +5 -1
- data/lib/card/set/format.rb +21 -0
- data/lib/card/set/format/abstract_format.rb +15 -6
- data/lib/card/set/format/haml_views.rb +1 -1
- data/lib/card/set/format/wrapper.rb +89 -0
- data/lib/card/set/helpers.rb +5 -0
- data/lib/card/set/i18n_scanner.rb +5 -4
- data/lib/card/set/i18n_scope.rb +10 -10
- data/lib/card/set/inheritance.rb +3 -0
- data/lib/card/set/loader.rb +1 -0
- data/lib/card/set/required_field.rb +74 -0
- data/lib/card/set/trait.rb +6 -0
- data/lib/card/set_pattern.rb +8 -4
- data/lib/card/subcards.rb +9 -1
- data/lib/card/subcards/add.rb +1 -3
- data/lib/card/subcards/remove.rb +2 -0
- data/lib/card/tasks/card.rake +2 -0
- data/lib/card/tasks/card/create.rake +2 -1
- data/lib/card/tasks/card/file_card_creator.rb +1 -1
- data/lib/card/tasks/card/file_card_creator/abstract_file_card/migration_file.rb +1 -0
- data/lib/card/tasks/card/migrate.rake +3 -3
- data/lib/card/version.rb +6 -4
- data/lib/card/view.rb +15 -2
- data/lib/card/view/cache.rb +12 -12
- data/lib/card/view/cache_action.rb +11 -14
- data/lib/card/view/classy.rb +168 -0
- data/lib/card/view/layout.rb +14 -0
- data/lib/card/view/options.rb +12 -8
- data/lib/card/view/options/key_lists.rb +4 -4
- data/lib/card/view/options/voo_api.rb +46 -9
- data/lib/card/view/stub.rb +2 -2
- data/lib/card/view/visibility.rb +4 -5
- data/lib/card/view/wrapper.rb +28 -0
- data/lib/cardio.rb +2 -1
- data/mod/Modfile +2 -0
- data/mod/account/set/right/account.rb +4 -6
- data/mod/account/set/right/password.rb +2 -2
- data/mod/account/set/self/signin.rb +16 -9
- data/mod/account/set/type/signup.rb +1 -1
- data/mod/account/spec/set/right/password_spec.rb +26 -19
- data/mod/account/spec/set/type/signup_spec.rb +1 -1
- data/mod/basic_formats/set/self/head.rb +4 -0
- data/mod/bootstrap/lib/javascript/script_load_select2.js.coffee +2 -0
- data/mod/bootstrap/lib/stylesheets/style_bootstrap_cards.scss +76 -21
- data/mod/bootstrap/lib/stylesheets/style_select2_bootstrap.scss +24 -6
- data/mod/bootstrap/set/abstract/bootswatch_theme/html_views.rb +2 -1
- data/mod/bootstrap/set/type/customized_bootswatch_skin/core.haml +2 -2
- data/mod/bootstrap/set/type/customized_bootswatch_skin/html_views.rb +14 -14
- data/mod/bootstrap/set/type_plus_right/customized_bootswatch_skin/colors.rb +4 -0
- data/mod/bootstrap/set/type_plus_right/customized_bootswatch_skin/colors/core.haml +10 -0
- data/mod/carrierwave/lib/carrier_wave/file_card_uploader.rb +2 -2
- data/mod/carrierwave/set/abstract/attachment.rb +1 -1
- data/mod/carrierwave/set/type/file.rb +4 -0
- data/mod/carrierwave/set/type/image.rb +13 -0
- data/mod/carrierwave/spec/lib/carrier_wave/file_card_uploader_spec.rb +2 -2
- data/mod/carrierwave/spec/set/type/file_spec.rb +4 -4
- data/mod/carrierwave/spec/set/type/image_spec.rb +6 -6
- data/mod/core/chunk/nest.rb +9 -1
- data/mod/core/format/html_format.rb +9 -45
- data/mod/core/layout/blank.html +5 -5
- data/mod/core/layout/default.html +10 -8
- data/mod/core/layout/noside.html +6 -9
- data/mod/core/layout/pre.html +1 -2
- data/mod/core/layout/simple.html +1 -5
- data/mod/core/set/abstract/code_file.rb +1 -1
- data/mod/core/set/all/cache.rb +0 -2
- data/mod/core/set/all/codename.rb +2 -0
- data/mod/core/set/all/collection.rb +3 -1
- data/mod/core/set/all/event_conditions.rb +36 -4
- data/mod/core/set/all/export.rb +1 -10
- data/mod/core/set/all/haml.rb +3 -2
- data/mod/core/set/all/layouts.rb +34 -0
- data/mod/core/set/all/name_events.rb +1 -1
- data/mod/core/set/all/pattern.rb +6 -11
- data/mod/core/set/all/subcards.rb +4 -0
- data/mod/core/set/all/utils.rb +21 -1
- data/mod/core/set_pattern/07_type_plus_right.rb +1 -1
- data/mod/core/set_pattern/08_rule.rb +17 -0
- data/mod/core/set_pattern/{08_self.rb → 09_self.rb} +0 -0
- data/mod/core/spec/format/html_format_spec.rb +6 -99
- data/mod/core/spec/set/all/codename_spec.rb +1 -1
- data/mod/core/spec/set/all/collection_spec.rb +9 -5
- data/mod/core/spec/set/all/event_conditions_spec.rb +91 -0
- data/mod/core/spec/set/all/pattern_spec.rb +17 -10
- data/mod/developer/spec/set/right/debug_spec.rb +1 -1
- data/mod/edit/set/all/bridge.rb +61 -0
- data/mod/edit/set/all/bridge/bridge.haml +6 -0
- data/mod/edit/set/all/bridge/follow_section.rb +37 -0
- data/mod/edit/set/all/bridge/tab_views.rb +75 -0
- data/mod/edit/set/all/bridge/tab_visibility.rb +51 -0
- data/mod/edit/set/all/edit_content.rb +58 -0
- data/mod/edit/set/all/edit_in_place.rb +58 -0
- data/mod/edit/set/all/edit_name.rb +87 -0
- data/mod/edit/set/all/edit_type.rb +28 -0
- data/mod/edit/set/all/editing.rb +79 -0
- data/mod/{standard/set/all/rich_html → edit/set/all}/editor.rb +1 -0
- data/mod/{standard/set/all/rich_html → edit/set/all}/form.rb +17 -10
- data/mod/edit/set/all/form_buttons.rb +52 -0
- data/mod/{standard/set/all/rich_html → edit/set/all}/form_elements.rb +2 -1
- data/mod/{standard/set/all/rich_html → edit/set/all}/formgroup.rb +3 -1
- data/mod/{standard/set/all/rich_html → edit/set/all}/new.rb +0 -2
- data/mod/edit/set/all/toolbar.rb +8 -0
- data/mod/edit/spec/set/all/bridge/tab_views_spec.rb +14 -0
- data/mod/{standard/spec/set/all/rich_html/editing_spec.rb → edit/spec/set/all/bridge_spec.rb} +1 -1
- data/mod/edit/spec/set/all/editing_spec.rb +15 -0
- data/mod/{standard/spec/set/all/rich_html → edit/spec/set/all}/form_elements_spec.rb +10 -8
- data/mod/edit/spec/set/all/form_spec.rb +50 -0
- data/mod/follow/lib/card/follower_stash.rb +5 -0
- data/mod/follow/set/abstract/follow_option.rb +0 -1
- data/mod/follow/set/all/follow/follow_link.rb +42 -54
- data/mod/follow/set/all/follow/follow_link_views.rb +29 -0
- data/mod/follow/set/all/follow/followed_by.rb +3 -0
- data/mod/follow/set/all/follow/follower_ids.rb +5 -0
- data/mod/follow/set/all/follow/start_follow_link.rb +11 -0
- data/mod/follow/set/all/follow/stop_follow_link.rb +12 -0
- data/mod/follow/set/all/notify.rb +4 -0
- data/mod/follow/set/all/notify/base_views.rb +11 -0
- data/mod/follow/set/right/account.rb +2 -1
- data/mod/follow/set/right/follow.rb +4 -0
- data/mod/follow/set/right/follow/follow_status.haml +2 -2
- data/mod/follow/set/right/followers.rb +1 -0
- data/mod/follow/set/right/following.rb +2 -3
- data/mod/follow/set/self/follow_defaults.rb +17 -16
- data/mod/follow/set/type/set.rb +2 -0
- data/mod/follow/set/type/user.rb +1 -0
- data/mod/follow/set/type_plus_right/user/follow.rb +1 -0
- data/mod/follow/set/type_plus_right/user/follow/follow_editor.haml +4 -1
- data/mod/follow/set/type_plus_right/user/follow/follow_editor_helper.rb +6 -0
- data/mod/follow/spec/set/all/follow/follow_link_views_spec.rb +27 -0
- data/mod/follow/spec/set/all/follow/start_follow_link_spec.rb +11 -0
- data/mod/follow/spec/set/all/follow/stop_follow_link_spec.rb +13 -0
- data/mod/follow/spec/set/all/follow_spec.rb +13 -9
- data/mod/follow/spec/set/all/notify_spec.rb +4 -3
- data/mod/follow/spec/set/right/account_spec.rb +29 -31
- data/mod/follow/spec/set/right/following_spec.rb +2 -8
- data/mod/history/lib/card/act.rb +9 -7
- data/mod/history/lib/card/act/act_renderer.rb +12 -9
- data/mod/history/lib/card/act/act_renderer/absolute_act_renderer.rb +2 -2
- data/mod/history/lib/card/act/act_renderer/bridge_act_renderer.rb +53 -0
- data/mod/history/lib/card/act/act_renderer/relative_act_renderer.rb +3 -0
- data/mod/history/lib/card/action.rb +9 -4
- data/mod/history/lib/card/action/action_renderer.rb +5 -3
- data/mod/history/lib/card/action/differ.rb +3 -0
- data/mod/history/set/all/history.rb +2 -1
- data/mod/history/set/all/history/act_listing.rb +11 -8
- data/mod/history/set/all/history/actions.rb +11 -2
- data/mod/history/set/all/history/events.rb +0 -1
- data/mod/history/set/all/history/last.rb +2 -1
- data/mod/history/set/all/history/revision.rb +1 -0
- data/mod/history/set/all/history/selected.rb +1 -1
- data/mod/history/set/all/history/views.rb +0 -1
- data/mod/history/set/all/history_bridge.rb +66 -0
- data/mod/item/set/all/bar.haml +1 -3
- data/mod/item/set/all/bar.rb +39 -21
- data/mod/item/set/all/box.haml +1 -0
- data/mod/item/set/all/box.rb +13 -3
- data/mod/item/set/all/expanded_bar.haml +4 -6
- data/mod/machines/file/all_script_machine_output/file.js +37380 -65
- data/mod/machines/file/all_style_machine_output/file.css +2 -2
- data/mod/machines/file/script_html5shiv_printshiv_machine_output/file.js +1 -1
- data/mod/machines/lib/javascript/decko.js.coffee +2 -17
- data/mod/machines/lib/javascript/decko_bridge.js.coffee +28 -0
- data/mod/machines/lib/javascript/decko_components.js.coffee +21 -0
- data/mod/machines/lib/javascript/decko_filter.js.coffee +3 -1
- data/mod/machines/lib/javascript/decko_mod.js.coffee +7 -64
- data/mod/machines/lib/javascript/decko_modal.js.coffee +108 -0
- data/mod/machines/lib/javascript/decko_navbox.js.coffee +2 -0
- data/mod/machines/lib/javascript/decko_overlay.js.coffee +42 -0
- data/mod/machines/lib/javascript/decko_recaptcha.js.coffee +9 -1
- data/mod/machines/lib/javascript/decko_slot.js.coffee +46 -50
- data/mod/machines/lib/javascript/decko_slotter.js.coffee +204 -63
- data/mod/machines/lib/javascript/script_card_menu.js.coffee +3 -3
- data/mod/machines/lib/stylesheets/style_cards.scss +234 -107
- data/mod/machines/set/abstract/machine.rb +4 -3
- data/mod/machines/set/self/script_slot.rb +2 -2
- data/mod/machines/set/type/css.rb +8 -1
- data/mod/machines/set/type/skin.rb +1 -1
- data/mod/machines/spec/set/type/coffeescript_spec.rb +3 -3
- data/mod/pointer/set/abstract/00_paging_params.rb +2 -0
- data/mod/pointer/set/abstract/01_paging.rb +12 -6
- data/mod/pointer/set/abstract/02_pointer/html_views.rb +25 -0
- data/mod/pointer/set/abstract/02_pointer/html_views/filter.rb +20 -4
- data/mod/pointer/set/abstract/02_pointer/html_views/filter/filter_items.haml +1 -6
- data/mod/pointer/set/abstract/02_pointer/html_views/filter/filtered_list_input.haml +4 -13
- data/mod/pointer/set/type/pointer.rb +9 -0
- data/mod/pointer/spec/set/abstract/pointer/events_spec.rb +6 -0
- data/mod/rules/lib/javascript/script_rules.js.coffee +23 -0
- data/mod/rules/set/rstar/rule_user.rb +8 -0
- data/mod/rules/set/rule/bridge_rules_editor.rb +32 -0
- data/mod/rules/set/rule/editor.rb +144 -0
- data/mod/rules/set/rule/rule_form.rb +57 -0
- data/mod/rules/set/rule/rule_form/buttons.rb +44 -0
- data/mod/rules/set/rule/rule_form/form_elements.rb +52 -0
- data/mod/rules/set/rule/rule_form/rule_form.haml +20 -0
- data/mod/rules/set/rule/rule_form/rule_set_radio.rb +86 -0
- data/mod/rules/set/rule/rule_form/set_selection.rb +46 -0
- data/mod/{standard/set/rstar → rules/set/rule}/rules.rb +5 -9
- data/mod/rules/set/rule/table.rb +27 -0
- data/mod/rules/set/rule/table_row.rb +62 -0
- data/mod/rules/set/self/script_rules.rb +3 -0
- data/mod/{standard → rules}/set/type/set.rb +8 -10
- data/mod/rules/set/type/set/html_views.rb +72 -0
- data/mod/{standard → rules}/set/type/set/html_views/group_panel.haml +0 -0
- data/mod/rules/set/type/set/html_views/rules_bridge.rb +129 -0
- data/mod/rules/set/type/set/html_views/rules_table.haml +11 -0
- data/mod/{standard → rules}/set/type/set/html_views/template.rb +3 -7
- data/mod/{standard → rules}/set/type/set/html_views/template/template_editor.haml +0 -0
- data/mod/rules/spec/set/rule/editor_spec.rb +9 -0
- data/mod/rules/spec/set/rule/table_row_spec.rb +9 -0
- data/mod/rules/spec/set/rule/table_spec.rb +15 -0
- data/mod/rules/spec/set/type/set/html_views_spec.rb +22 -0
- data/mod/{standard → rules}/spec/set/type/set_spec.rb +18 -18
- data/mod/search/set/abstract/00_filter_helper.rb +15 -7
- data/mod/search/set/abstract/01_filter_form_helper.rb +1 -0
- data/mod/search/set/abstract/02_search_params.rb +7 -5
- data/mod/search/set/abstract/03_filter.rb +3 -2
- data/mod/search/set/abstract/04_right_filter_form.rb +1 -2
- data/mod/search/set/abstract/search.rb +1 -1
- data/mod/search/set/abstract/search/views.rb +2 -0
- data/mod/search/set/abstract/wql_search.rb +6 -0
- data/mod/search/set/self/navbox.rb +1 -1
- data/mod/search/set/self/search.rb +2 -2
- data/mod/settings/lib/card/setting.rb +6 -1
- data/mod/settings/set/right/help.rb +4 -0
- data/mod/settings/set/right/read.rb +14 -4
- data/mod/settings/set/right/structure.rb +3 -0
- data/mod/settings/set/right/style.rb +2 -1
- data/mod/settings/set/self/create.rb +2 -1
- data/mod/settings/set/self/default.rb +2 -1
- data/mod/settings/set/self/delete.rb +2 -1
- data/mod/settings/set/self/head.rb +2 -0
- data/mod/settings/set/self/help.rb +2 -1
- data/mod/settings/set/self/input.rb +1 -1
- data/mod/settings/set/self/read.rb +2 -1
- data/mod/settings/set/self/structure.rb +2 -1
- data/mod/settings/set/self/thanks.rb +2 -1
- data/mod/settings/set/self/update.rb +2 -1
- data/mod/settings/set/type/setting.rb +1 -1
- data/mod/solid_cache/set/abstract/solid_cache.rb +2 -2
- data/mod/standard/file/logo/image-original.svg +59 -0
- data/mod/standard/lib/card/layout.rb +79 -0
- data/mod/standard/lib/card/layout/card_layout.rb +44 -0
- data/mod/standard/lib/card/layout/code_layout.rb +9 -0
- data/mod/standard/lib/card/layout/proc_layout.rb +9 -0
- data/mod/standard/lib/card/layout/unknown_layout.rb +20 -0
- data/mod/standard/set/all/links.rb +5 -20
- data/mod/standard/set/all/rich_html.rb +4 -0
- data/mod/standard/set/all/rich_html/alert.rb +23 -0
- data/mod/standard/set/all/rich_html/content.rb +26 -100
- data/mod/standard/set/all/rich_html/error.rb +27 -3
- data/mod/standard/set/all/rich_html/error/debug_server_error.haml +1015 -0
- data/mod/standard/set/all/rich_html/frame.rb +10 -54
- data/mod/standard/set/all/rich_html/header.rb +25 -15
- data/mod/standard/set/all/rich_html/header/header_wrap.haml +2 -1
- data/mod/standard/set/all/rich_html/html_views/help.rb +18 -0
- data/mod/standard/set/all/rich_html/html_views/info.rb +59 -0
- data/mod/standard/set/all/rich_html/html_views/size.rb +17 -0
- data/mod/standard/set/all/rich_html/menu.rb +44 -146
- data/mod/standard/set/all/rich_html/modal.rb +99 -24
- data/mod/standard/set/all/rich_html/modal/modal_dialog.haml +12 -0
- data/mod/standard/set/all/rich_html/overlay.rb +57 -13
- data/mod/standard/set/all/rich_html/process_layout.rb +91 -0
- data/mod/standard/set/all/rich_html/show.rb +37 -0
- data/mod/standard/set/all/rich_html/wrapper.rb +47 -10
- data/mod/standard/set/right/head.rb +11 -0
- data/mod/standard/set/type/cardtype.rb +1 -1
- data/mod/standard/set/type/listed_by.rb +3 -3
- data/mod/standard/spec/set/all/email_html_format_spec.rb +17 -0
- data/mod/standard/spec/set/all/links_spec.rb +1 -22
- data/mod/standard/spec/set/all/rich_html/overlay_spec.rb +18 -0
- data/mod/standard/spec/set/all/rich_html/process_layout/explicit_modal_wrapper_spec.rb +29 -0
- data/mod/standard/spec/set/all/rich_html/process_layout_spec.rb +110 -0
- data/mod/standard/spec/set/all/rich_html/show_spec.rb +9 -0
- data/mod/standard/spec/set/all/rich_html/wrapper_spec.rb +17 -24
- data/mod/standard/spec/set/type/email_template/email_config_spec.rb +9 -5
- data/mod/standard/spec/set/type/layout_type_spec.rb +6 -0
- data/mod/standard/spec/set/type/search_type_spec.rb +1 -1
- data/mod/tinymce_editor/db/migrate_core_cards/20190306172623_update_tinymce_config_to_v5.rb +23 -0
- data/mod/tinymce_editor/lib/javascript/script_tinymce.js +9 -2
- data/mod/tinymce_editor/lib/javascript/script_tinymce_config.js.coffee +3 -2
- data/mod/tinymce_editor/public/assets/tinymce/jquery.tinymce.min.js +92 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/advlist/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/anchor/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/autolink/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/autoresize/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/autosave/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/bbcode/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/charmap/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/code/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/codesample/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/colorpicker/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/contextmenu/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/directionality/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/js/emojis.js +9015 -0
- data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/js/emojis.min.js +2 -0
- data/mod/tinymce_editor/public/assets/tinymce/plugins/emoticons/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/fullpage/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/fullscreen/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/help/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/hr/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/image/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/imagetools/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/importcss/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/insertdatetime/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/legacyoutput/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/link/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/lists/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/media/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/nonbreaking/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/noneditable/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/pagebreak/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/paste/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/preview/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/print/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/quickbars/plugin.min.js +9 -0
- data/mod/tinymce_editor/public/assets/tinymce/plugins/save/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/searchreplace/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/spellchecker/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/tabfocus/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/table/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/template/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/textcolor/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/textpattern/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/toc/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/visualblocks/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/visualchars/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/plugins/wordcount/plugin.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/skins/content/default/content.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/content/document/content.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/content/writer/content.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide-dark/content.inline.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide-dark/content.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide-dark/skin.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/content.inline.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/content.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/content.mobile.min.css +1 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/fonts/tinymce-mobile.woff +0 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/skin.min.css +7 -0
- data/mod/tinymce_editor/public/assets/tinymce/skins/ui/oxide/skin.mobile.min.css +1 -0
- data/mod/tinymce_editor/public/assets/tinymce/themes/mobile/theme.min.js +9 -1
- data/mod/tinymce_editor/public/assets/tinymce/themes/silver/theme.min.js +9 -0
- data/mod/tinymce_editor/public/assets/tinymce/tinymce.min.js +9 -2
- data/mod/utility/spec/set/abstract/media_spec.rb +6 -6
- data/mod/virtual/lib/card/virtual.rb +17 -2
- data/mod/virtual/set/abstract/virtual_cache.rb +1 -1
- data/mod/virtual/spec/set/lib/card/virtual_spec.rb +1 -1
- metadata +121 -42
- data/mod/core/layout/modal.html +0 -9
- data/mod/core/layout/simple_modal.html +0 -3
- data/mod/follow/spec/set/all/follow/follow_link_spec.rb +0 -7
- data/mod/standard/file/logo/image-icon.png +0 -0
- data/mod/standard/file/logo/image-large.png +0 -0
- data/mod/standard/file/logo/image-medium.png +0 -0
- data/mod/standard/file/logo/image-original.png +0 -0
- data/mod/standard/file/logo/image-small.png +0 -0
- data/mod/standard/set/abstract/toolbar_split_button.rb +0 -22
- data/mod/standard/set/all/rich_html/classy.rb +0 -37
- data/mod/standard/set/all/rich_html/editing.rb +0 -176
- data/mod/standard/set/all/rich_html/related.rb +0 -30
- data/mod/standard/set/all/rich_html/toolbar.rb +0 -264
- data/mod/standard/set/rstar/rules_editor.rb +0 -371
- data/mod/standard/set/self/activity_toolbar_button.rb +0 -14
- data/mod/standard/set/self/rules_toolbar_button.rb +0 -44
- data/mod/standard/set/type/set/html_views.rb +0 -155
- data/mod/standard/set/type/set/html_views/rules_table.haml +0 -9
- data/mod/standard/spec/set/all/rich_html/form_spec.rb +0 -47
- data/mod/standard/spec/set/all/rich_html/toolbar_spec.rb +0 -25
- data/mod/standard/spec/set/rstar/rules_spec.rb +0 -26
- data/mod/standard/spec/set/self/activity_toolbar_button_spec.rb +0 -22
- data/mod/standard/spec/set/type/set/html_views_spec.rb +0 -10
data/lib/card/set_pattern.rb
CHANGED
@@ -8,10 +8,9 @@ class Card
|
|
8
8
|
|
9
9
|
def card_keys
|
10
10
|
@card_keys ||=
|
11
|
-
Card.set_patterns.
|
11
|
+
Card.set_patterns.each_with_object({}) do |set_pattern, hash|
|
12
12
|
card_key = Card.quick_fetch(set_pattern.pattern_code).key
|
13
13
|
hash[card_key] = true
|
14
|
-
hash
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
@@ -24,7 +23,8 @@ class Card
|
|
24
23
|
class Abstract
|
25
24
|
class << self
|
26
25
|
attr_accessor :pattern_code, :pattern_id, :junction_only,
|
27
|
-
:assigns_type, :anchorless
|
26
|
+
:assigns_type, :anchorless
|
27
|
+
attr_writer :anchor_parts_count
|
28
28
|
|
29
29
|
def new card
|
30
30
|
super if pattern_applies? card
|
@@ -64,6 +64,7 @@ class Card
|
|
64
64
|
def module_key anchor_codes
|
65
65
|
return pattern_code.to_s.camelize if anchorless?
|
66
66
|
return unless anchor_codes # is this not an error?
|
67
|
+
|
67
68
|
([pattern_code] + anchor_codes).map { |code| code.to_s.camelize }.join "::"
|
68
69
|
end
|
69
70
|
end
|
@@ -116,6 +117,7 @@ class Card
|
|
116
117
|
|
117
118
|
def anchor_parts
|
118
119
|
return [@anchor_name] unless anchor_parts_count > 1
|
120
|
+
|
119
121
|
parts = @anchor_name.parts
|
120
122
|
if parts.size <= anchor_parts_count
|
121
123
|
parts
|
@@ -184,16 +186,18 @@ class Card
|
|
184
186
|
|
185
187
|
def lookup_inherited_key
|
186
188
|
return unless @inherit_card
|
189
|
+
|
187
190
|
card = @inherit_card
|
188
191
|
@inherit_card = nil
|
189
192
|
return unless (type_code = default_type_code card)
|
193
|
+
|
190
194
|
mod_key = "Type::#{type_code.to_s.camelize}"
|
191
195
|
mod_key if mods_exist_for_key? mod_key
|
192
196
|
end
|
193
197
|
|
194
198
|
def default_type_code card
|
195
199
|
default_rule = card.rule_card :default
|
196
|
-
default_rule
|
200
|
+
default_rule&.type_code
|
197
201
|
end
|
198
202
|
|
199
203
|
def mods_exist_for_key? mod_key
|
data/lib/card/subcards.rb
CHANGED
@@ -36,6 +36,7 @@ class Card
|
|
36
36
|
|
37
37
|
def card name
|
38
38
|
return unless @keys.include? name.to_name.key
|
39
|
+
|
39
40
|
fetch_subcard name
|
40
41
|
end
|
41
42
|
|
@@ -51,12 +52,18 @@ class Card
|
|
51
52
|
|
52
53
|
def rename old_name, new_name
|
53
54
|
return unless @keys.include? old_name.to_name.key
|
55
|
+
|
54
56
|
@keys.delete old_name.to_name.key
|
55
57
|
@keys << new_name.to_name.key
|
56
58
|
end
|
57
59
|
|
60
|
+
def respond_to_missing? method_name, _include_private=false
|
61
|
+
@keys.respond_to? method_name
|
62
|
+
end
|
63
|
+
|
58
64
|
def method_missing method, *args
|
59
|
-
return unless
|
65
|
+
return unless respond_to_missing?(method)
|
66
|
+
|
60
67
|
@keys.send method, *args
|
61
68
|
end
|
62
69
|
|
@@ -101,6 +108,7 @@ class Card
|
|
101
108
|
def absolutize_subcard_name name
|
102
109
|
name = Card::Name[name]
|
103
110
|
return name if @context_card.name.parts.first.blank?
|
111
|
+
|
104
112
|
name.absolute_name @context_card.name
|
105
113
|
end
|
106
114
|
end
|
data/lib/card/subcards/add.rb
CHANGED
@@ -97,9 +97,7 @@ class Card
|
|
97
97
|
|
98
98
|
# ensure a leading '+'
|
99
99
|
def normalize_subfield_key key
|
100
|
-
if key.is_a?(Symbol) && Card::Codename.exist?(key)
|
101
|
-
key = Card::Codename.name(key)
|
102
|
-
end
|
100
|
+
key = Card::Codename.name(key) if key.is_a?(Symbol) && Card::Codename.exist?(key)
|
103
101
|
key.to_name.prepend_joint
|
104
102
|
end
|
105
103
|
|
data/lib/card/subcards/remove.rb
CHANGED
@@ -11,6 +11,7 @@ class Card
|
|
11
11
|
def remove name_or_card
|
12
12
|
key = subcard_key name_or_card
|
13
13
|
return unless @keys.include? key
|
14
|
+
|
14
15
|
@keys.delete key
|
15
16
|
clear_key key
|
16
17
|
end
|
@@ -32,6 +33,7 @@ class Card
|
|
32
33
|
def deep_clear cleared=::Set.new
|
33
34
|
each_card do |card|
|
34
35
|
next if cleared.include? card.id
|
36
|
+
|
35
37
|
cleared << card.id
|
36
38
|
card.subcards.deep_clear cleared
|
37
39
|
end
|
data/lib/card/tasks/card.rake
CHANGED
@@ -47,6 +47,7 @@ namespace :card do
|
|
47
47
|
_task, name, url = ARGV
|
48
48
|
raise "no name given" unless name.present?
|
49
49
|
raise "no url given" unless url.present?
|
50
|
+
|
50
51
|
importer.add_remote name, url
|
51
52
|
exit
|
52
53
|
end
|
@@ -54,6 +55,7 @@ namespace :card do
|
|
54
55
|
def pull_card opts={}
|
55
56
|
_task, card = ARGV
|
56
57
|
raise "no card given" unless card.present?
|
58
|
+
|
57
59
|
importer.pull card, opts.merge(remote: ENV["from"])
|
58
60
|
exit # without exit the card argument is treated as second rake task
|
59
61
|
end
|
@@ -58,6 +58,7 @@ namespace :card do
|
|
58
58
|
def with_params *keys
|
59
59
|
optional_params = keys.last.is_a?(Hash) ? keys.pop : {}
|
60
60
|
return unless params_present?(*keys)
|
61
|
+
|
61
62
|
values = keys.map { |k| ENV[k.to_s] }
|
62
63
|
optional_params.each_pair do |k, v|
|
63
64
|
values << (ENV[k.to_s] || v)
|
@@ -66,7 +67,7 @@ namespace :card do
|
|
66
67
|
end
|
67
68
|
|
68
69
|
def params_present? *env_keys
|
69
|
-
missing = env_keys.
|
70
|
+
missing = env_keys.reject { |k| ENV[k.to_s] }
|
70
71
|
missing.each do |key|
|
71
72
|
color_puts "missing parameter:", :red, key
|
72
73
|
end
|
@@ -9,6 +9,7 @@ class Card
|
|
9
9
|
puts "creating migration file...".yellow
|
10
10
|
migration_out = `#{migrate_command}`
|
11
11
|
return if migration_out.include?("conflict")
|
12
|
+
|
12
13
|
migration_file_name = migration_out[/db.*/]
|
13
14
|
write_at migration_file_name, 5, indented_migration_content # 5 is line no.
|
14
15
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
def run_card_migration core_or_deck
|
3
2
|
prepare_migration
|
4
3
|
verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
@@ -36,7 +35,7 @@ end
|
|
36
35
|
namespace :card do
|
37
36
|
namespace :migrate do
|
38
37
|
desc "migrate cards"
|
39
|
-
task cards: [
|
38
|
+
task cards: %i[core_cards deck_cards]
|
40
39
|
|
41
40
|
desc "migrate structure"
|
42
41
|
task structure: :environment do
|
@@ -85,6 +84,7 @@ namespace :card do
|
|
85
84
|
version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
|
86
85
|
verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
|
87
86
|
raise "VERSION is required" unless version
|
87
|
+
|
88
88
|
ActiveRecord::Migration.verbose = verbose
|
89
89
|
ActiveRecord::SchemaMigration.where(version: version.to_s).delete_all
|
90
90
|
Cardio.migrate :deck_cards, version
|
@@ -100,7 +100,7 @@ namespace :card do
|
|
100
100
|
|
101
101
|
Cardio.schema_mode args[:type] do
|
102
102
|
version = ActiveRecord::Migrator.current_version
|
103
|
-
if version.to_i > 0 && (file = open(stamp_file, "w"))
|
103
|
+
if version.to_i > 0 && (file = ::File.open(stamp_file, "w"))
|
104
104
|
puts ">> writing version: #{version} to #{stamp_file}"
|
105
105
|
file.puts version
|
106
106
|
end
|
data/lib/card/version.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
class Card
|
4
|
+
module Version
|
5
|
+
class << self
|
6
|
+
def release
|
7
|
+
@@version ||= File.read(File.expand_path("../../VERSION", __dir__)).strip
|
8
|
+
end
|
7
9
|
end
|
8
10
|
end
|
9
11
|
end
|
data/lib/card/view.rb
CHANGED
@@ -2,6 +2,7 @@ require_dependency "card/view/visibility"
|
|
2
2
|
require_dependency "card/view/cache"
|
3
3
|
require_dependency "card/view/stub"
|
4
4
|
require_dependency "card/view/options"
|
5
|
+
require_dependency "card/view/classy"
|
5
6
|
|
6
7
|
class Card
|
7
8
|
class View
|
@@ -11,6 +12,9 @@ class Card
|
|
11
12
|
include Cache
|
12
13
|
include Stub
|
13
14
|
include Options
|
15
|
+
include Layout
|
16
|
+
include Wrapper
|
17
|
+
include Classy
|
14
18
|
extend Cache::ClassMethods
|
15
19
|
|
16
20
|
attr_reader :format, :parent, :card
|
@@ -39,6 +43,7 @@ class Card
|
|
39
43
|
def process
|
40
44
|
process_live_options
|
41
45
|
return if optional? && hide?(requested_view)
|
46
|
+
|
42
47
|
fetch { yield ok_view }
|
43
48
|
end
|
44
49
|
|
@@ -67,6 +72,10 @@ class Card
|
|
67
72
|
!parent
|
68
73
|
end
|
69
74
|
|
75
|
+
def deep_root
|
76
|
+
format.root.voo
|
77
|
+
end
|
78
|
+
|
70
79
|
# neither view nor format has a parent
|
71
80
|
# @return [true/false]
|
72
81
|
def deep_root?
|
@@ -75,8 +84,12 @@ class Card
|
|
75
84
|
|
76
85
|
# next voo object found tracing ancestry through parent voos and/or parent formats
|
77
86
|
# @return [Card::View]
|
78
|
-
def next_ancestor
|
79
|
-
parent || (
|
87
|
+
def next_ancestor accross_format=true
|
88
|
+
parent || (accross_format && next_format_ancestor) || nil
|
89
|
+
end
|
90
|
+
|
91
|
+
def next_format_ancestor
|
92
|
+
format.parent&.voo
|
80
93
|
end
|
81
94
|
end
|
82
95
|
end
|
data/lib/card/view/cache.rb
CHANGED
@@ -20,9 +20,11 @@ class Card
|
|
20
20
|
|
21
21
|
# Fetch view via cache and, when appropriate, render its stubs
|
22
22
|
#
|
23
|
-
# If this is a free cache action (see CacheAction), we go through the stubs and
|
24
|
-
#
|
25
|
-
#
|
23
|
+
# If this is a free cache action (see CacheAction), we go through the stubs and
|
24
|
+
# render them now.
|
25
|
+
# If the cache is active (ie, we are inside another view), we do not worry about
|
26
|
+
# stubs but keep going, because the free cache we're inside will take care of
|
27
|
+
# those stubs.
|
26
28
|
#
|
27
29
|
# @return [String (usually)] rendered view
|
28
30
|
def cache_render
|
@@ -32,7 +34,8 @@ class Card
|
|
32
34
|
|
33
35
|
# Is there already a view cache in progress on which this one depends?
|
34
36
|
#
|
35
|
-
# Note that if you create a brand new independent format object
|
37
|
+
# Note that if you create a brand new independent format object
|
38
|
+
# (ie, not a subformat)
|
36
39
|
# its activity will be treated as unrelated to this caching/rendering.
|
37
40
|
#
|
38
41
|
# @return [true/false]
|
@@ -56,11 +59,9 @@ class Card
|
|
56
59
|
self.class.caching(self) { yield }
|
57
60
|
end
|
58
61
|
|
59
|
-
|
60
|
-
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
62
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
61
63
|
# VIEW CACHE KEY
|
62
64
|
|
63
|
-
|
64
65
|
def cache_key
|
65
66
|
@cache_key ||= [
|
66
67
|
card.key, format.class, format.nest_mode, options_for_cache_key
|
@@ -96,15 +97,14 @@ class Card
|
|
96
97
|
|
97
98
|
def option_value_to_string value
|
98
99
|
case value
|
99
|
-
|
100
|
-
|
101
|
-
|
100
|
+
when Hash then "{#{hash_for_cache_key value}}"
|
101
|
+
when Array then array_for_cache_key(value)
|
102
|
+
else value.to_s
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
105
|
-
|
106
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
106
107
|
# cache-related Card::View class methods
|
107
|
-
|
108
108
|
module ClassMethods
|
109
109
|
def cache
|
110
110
|
Card::Cache[Card::View]
|
@@ -13,9 +13,8 @@ class Card
|
|
13
13
|
|
14
14
|
def log_cache_action
|
15
15
|
action = yield
|
16
|
-
|
17
|
-
|
18
|
-
end
|
16
|
+
# TODO: make configurable
|
17
|
+
puts "VIEW CACHE [#{action}] (#{card.name}##{requested_view})" if false
|
19
18
|
action
|
20
19
|
end
|
21
20
|
|
@@ -28,8 +27,7 @@ class Card
|
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
31
|
-
|
32
|
-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
30
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
33
31
|
# CACHE STATUS: OFF
|
34
32
|
# view caching is turned off, format- or system-wide
|
35
33
|
|
@@ -43,8 +41,7 @@ class Card
|
|
43
41
|
:yield
|
44
42
|
end
|
45
43
|
|
46
|
-
|
47
|
-
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
44
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
48
45
|
# CACHE STATUS: FREE
|
49
46
|
# caching is on; no other cache in progress
|
50
47
|
|
@@ -58,7 +55,7 @@ class Card
|
|
58
55
|
cache_setting != :never && clean_enough_to_cache?
|
59
56
|
end
|
60
57
|
|
61
|
-
#
|
58
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
62
59
|
# CACHE STATUS: ACTIVE
|
63
60
|
# another view cache is in progress; this view is inside it
|
64
61
|
|
@@ -71,6 +68,7 @@ class Card
|
|
71
68
|
def active_cache_ok?
|
72
69
|
return false unless parent && clean_enough_to_cache?
|
73
70
|
return true if normalized_options[:skip_perms]
|
71
|
+
|
74
72
|
active_cache_permissible?
|
75
73
|
end
|
76
74
|
|
@@ -91,7 +89,8 @@ class Card
|
|
91
89
|
@permission_task ||= Card::Format.perms[requested_view] || :read
|
92
90
|
end
|
93
91
|
|
94
|
-
# determine the cache action from the cache setting
|
92
|
+
# determine the cache action from the cache setting
|
93
|
+
# (assuming cache status is "active")
|
95
94
|
# @return [Symbol] cache action
|
96
95
|
def active_cache_action_from_setting
|
97
96
|
level = ACTIVE_CACHE_LEVEL[cache_setting]
|
@@ -99,12 +98,12 @@ class Card
|
|
99
98
|
end
|
100
99
|
|
101
100
|
ACTIVE_CACHE_LEVEL = {
|
102
|
-
always:
|
101
|
+
always: :cache_yield, # read/write cache specifically for this view
|
103
102
|
standard: :yield, # render view; it will only be cached within active view
|
104
|
-
never:
|
103
|
+
never: :stub # render a stub
|
105
104
|
}.freeze
|
106
105
|
|
107
|
-
#
|
106
|
+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
108
107
|
# SHARED METHODS
|
109
108
|
|
110
109
|
# Mod developers can configure cache directives on view definitions. eg:
|
@@ -127,7 +126,6 @@ class Card
|
|
127
126
|
format.view_cache_setting requested_view
|
128
127
|
end
|
129
128
|
|
130
|
-
|
131
129
|
# altered view requests and altered cards are not cacheable
|
132
130
|
# @return [True/False]
|
133
131
|
def clean_enough_to_cache?
|
@@ -137,7 +135,6 @@ class Card
|
|
137
135
|
# FIXME: might consider other changes as disqualifying, though
|
138
136
|
# we should make sure not to disallow caching of virtual cards
|
139
137
|
end
|
140
|
-
|
141
138
|
end
|
142
139
|
end
|
143
140
|
end
|
@@ -0,0 +1,168 @@
|
|
1
|
+
class Card
|
2
|
+
class View
|
3
|
+
# API to change css classes in other places
|
4
|
+
module Classy
|
5
|
+
# Add additional css classes to a css class
|
6
|
+
#
|
7
|
+
# Example
|
8
|
+
# class_up "card-slot", "card-dark text-muted"
|
9
|
+
#
|
10
|
+
# If a view later adds the css "card-slot" to a html tag with
|
11
|
+
#
|
12
|
+
# classy("card-slot")
|
13
|
+
#
|
14
|
+
# then all additional css classes will be added.
|
15
|
+
#
|
16
|
+
# The scope when these additional classes apply can be restricted
|
17
|
+
# @param klass [String, Symbol] the css class to be enriched with additional classes
|
18
|
+
# @param classier [String, Array<String>] additional css classes
|
19
|
+
# @param scope [Symbol]
|
20
|
+
# :view only in the same view
|
21
|
+
# :subviews the same and all subviews; not in nests or where its nested
|
22
|
+
# :format all views, sub and parent views; not in nests or where its nested
|
23
|
+
# :nests the same as :format but also in nests
|
24
|
+
# :single_use the same as :nests but is removed after the first use
|
25
|
+
# :global always everywhere
|
26
|
+
def class_up klass, classier, scope=:subviews
|
27
|
+
klass = klass.to_s
|
28
|
+
|
29
|
+
storage_voo(scope).add_extra_classes klass, classier, scope
|
30
|
+
end
|
31
|
+
|
32
|
+
def class_down klass, classier
|
33
|
+
remove_extra_classes klass, classier, :private
|
34
|
+
end
|
35
|
+
|
36
|
+
def with_class_up klass, classier, scope=:subviews
|
37
|
+
class_up klass, classier, scope
|
38
|
+
yield
|
39
|
+
ensure
|
40
|
+
class_down klass, classier
|
41
|
+
end
|
42
|
+
|
43
|
+
# don't use in the given block the additional class that
|
44
|
+
# was added to `klass`
|
45
|
+
def without_upped_class klass
|
46
|
+
tmp_class = class_list.delete klass
|
47
|
+
result = yield tmp_class
|
48
|
+
class_list[klass] = tmp_class
|
49
|
+
result
|
50
|
+
end
|
51
|
+
|
52
|
+
def classy *classes
|
53
|
+
classes = Array.wrap(classes).flatten
|
54
|
+
[classes, extra_classes(classes)].flatten.compact.join " "
|
55
|
+
end
|
56
|
+
|
57
|
+
def add_extra_classes key, classier, scope
|
58
|
+
type = class_list_type scope
|
59
|
+
|
60
|
+
class_list(type)[key] =
|
61
|
+
[class_list(type)[key], classier].flatten.compact.join(" ")
|
62
|
+
end
|
63
|
+
|
64
|
+
# remove classes everywhere where they are visible for the given scope
|
65
|
+
def remove_extra_classes klass, classier, type
|
66
|
+
# TODO: scope handling
|
67
|
+
# Method is not used and maybe no longer necessary with the scope feature
|
68
|
+
# for class_up.
|
69
|
+
|
70
|
+
# It's no longer sufficient to remove only public classes for ancestors.
|
71
|
+
# Needs an approach similar to extra_classes with the "space" argument
|
72
|
+
next_ancestor&.remove_extra_classes klass, classier, :public
|
73
|
+
|
74
|
+
cl = class_list type
|
75
|
+
return unless cl[klass]
|
76
|
+
|
77
|
+
if cl[klass] == classier
|
78
|
+
cl.delete klass
|
79
|
+
else
|
80
|
+
cl[klass].gsub!(/#{classier}\s?/, "")
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def extra_classes klass
|
85
|
+
klass = klass.first if klass.is_a?(Array)
|
86
|
+
klass = klass.to_s
|
87
|
+
|
88
|
+
deep_extra_classes klass, :self
|
89
|
+
end
|
90
|
+
|
91
|
+
# recurse through voos and formats to find all extra classes
|
92
|
+
# @param space [:self, :self_format, :ancestor_format]
|
93
|
+
def deep_extra_classes klass, space
|
94
|
+
[self_extra_classes(klass, space),
|
95
|
+
ancestor_extra_classes(klass, space)].flatten.compact
|
96
|
+
end
|
97
|
+
|
98
|
+
private
|
99
|
+
|
100
|
+
def storage_voo scope
|
101
|
+
# When we climb up the voo tree and cross a nest boundary then we can jump only
|
102
|
+
# to the root voo of the parent format. Hence we have to add classes to the root
|
103
|
+
# if we want them to be found by nests.
|
104
|
+
case scope
|
105
|
+
when :view, :subviews then self
|
106
|
+
when :format, :nests, :single_use then root
|
107
|
+
when :global then deep_root
|
108
|
+
else
|
109
|
+
raise ArgumentError, "invalid class_up scope: #{scope}"
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
113
|
+
def self_extra_classes klass, space
|
114
|
+
classes = ok_types(space).map { |ot| class_list(ot)[klass] }
|
115
|
+
return classes unless class_list(:single_use)&.key? klass
|
116
|
+
|
117
|
+
[classes, class_list(:single_use).delete(klass)]
|
118
|
+
end
|
119
|
+
|
120
|
+
def ancestor_extra_classes klass, space
|
121
|
+
if parent
|
122
|
+
parent_space = space == :self ? :self_format : :ancestor_format
|
123
|
+
parent.deep_extra_classes(klass, parent_space)
|
124
|
+
else
|
125
|
+
next_format_ancestor&.deep_extra_classes(klass, :ancestor_format)
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def ok_types space
|
130
|
+
case space
|
131
|
+
when :ancestor_format then [:public]
|
132
|
+
when :self_format then %i[public format_private]
|
133
|
+
when :self then %i[public format_private private]
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def class_list type=:private
|
138
|
+
case type
|
139
|
+
when :private, :format_private, :public, :single_use
|
140
|
+
@class_list ||= {}
|
141
|
+
@class_list[type] ||= {}
|
142
|
+
else
|
143
|
+
raise ArgumentError, "#{type} not a valid class list"
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
# Translates scopes to the privacy types used to manage the class lists.
|
148
|
+
# A #classy calls looks in the following class_lists:
|
149
|
+
# private - only in the same voo
|
150
|
+
# format_private - the same voo and all parent voos in the same format
|
151
|
+
# public - in all voos in all parent formats
|
152
|
+
def class_list_type scope
|
153
|
+
case scope
|
154
|
+
when :view
|
155
|
+
:private
|
156
|
+
when :format, :subviews
|
157
|
+
:format_private
|
158
|
+
when :nests, :global
|
159
|
+
:public
|
160
|
+
when :single_use
|
161
|
+
:single_use
|
162
|
+
else
|
163
|
+
raise ArgumentError, "invalid class_up scope: #{scope}"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|