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
@@ -5,6 +5,7 @@ class Card
|
|
5
5
|
def validate_conditions
|
6
6
|
@opts.each do |key, val|
|
7
7
|
next if key.in? %i[in before after around]
|
8
|
+
|
8
9
|
validate_condition_name key
|
9
10
|
validate_condition_value key, val
|
10
11
|
end
|
@@ -12,6 +13,7 @@ class Card
|
|
12
13
|
|
13
14
|
def validate_condition_name condition
|
14
15
|
return if Card::Set::Event::CONDITIONS.include? condition
|
16
|
+
|
15
17
|
raise ArgumentError,
|
16
18
|
"invalid condition key '#{condition}' in event '#{@event}'\n" \
|
17
19
|
"valid conditions are #{Card::Set::Event::CONDITIONS.to_a.join ', '}"
|
@@ -23,6 +25,7 @@ class Card
|
|
23
25
|
else
|
24
26
|
invalid = Array.wrap(val) - Array.wrap(valid_values(condition))
|
25
27
|
return if invalid.empty?
|
28
|
+
|
26
29
|
raise ArgumentError,
|
27
30
|
"invalid option#{'s' if invalid.size > 1} '#{invalid}' "\
|
28
31
|
"for condition '#{condition}' in event '#{@event}'"
|
@@ -31,6 +34,7 @@ class Card
|
|
31
34
|
|
32
35
|
def validate_when_value val
|
33
36
|
return if val.is_a?(Symbol) || val.is_a?(Proc)
|
37
|
+
|
34
38
|
raise ArgumentError,
|
35
39
|
"invalid value for condition 'when' in event '#{@event}'\n" \
|
36
40
|
"must be a symbol or a proc"
|
@@ -57,7 +61,7 @@ class Card
|
|
57
61
|
end
|
58
62
|
|
59
63
|
def process_action_opts opts
|
60
|
-
opts[:on] = [
|
64
|
+
opts[:on] = %i[create update] if opts[:on] == :save
|
61
65
|
end
|
62
66
|
|
63
67
|
def process_stage_opts opts
|
data/lib/card/set/format.rb
CHANGED
@@ -19,6 +19,13 @@ class Card
|
|
19
19
|
# The external api with checks:
|
20
20
|
# render(:viewname, args)
|
21
21
|
#
|
22
|
+
# TODO:
|
23
|
+
# introduce view settings
|
24
|
+
# modal: { size: :large},
|
25
|
+
# cache
|
26
|
+
# perms
|
27
|
+
# tags: :unknown_ok
|
28
|
+
# bridge
|
22
29
|
module Format
|
23
30
|
require_dependency "card/set/format/haml_views"
|
24
31
|
require_dependency "card/set/format/abstract_format"
|
@@ -80,6 +87,20 @@ class Card
|
|
80
87
|
modules[:base_format][format_class] ||= []
|
81
88
|
modules[:base_format][format_class] << mod
|
82
89
|
end
|
90
|
+
|
91
|
+
class << self
|
92
|
+
def layout_method_name layout
|
93
|
+
"_layout_#{layout.to_name.key}"
|
94
|
+
end
|
95
|
+
|
96
|
+
def wrapper_method_name wrapper
|
97
|
+
"_wrapper_#{wrapper}"
|
98
|
+
end
|
99
|
+
|
100
|
+
def view_method_name view
|
101
|
+
"_view_#{view}"
|
102
|
+
end
|
103
|
+
end
|
83
104
|
end
|
84
105
|
end
|
85
106
|
end
|
@@ -8,6 +8,9 @@ class Card
|
|
8
8
|
module AbstractFormat
|
9
9
|
include Set::Basket
|
10
10
|
include Set::Format::HamlViews
|
11
|
+
include Set::Format::Wrapper
|
12
|
+
|
13
|
+
VIEW_SETTINGS = %i[cache modal bridge wrap].freeze
|
11
14
|
|
12
15
|
mattr_accessor :views
|
13
16
|
self.views = Hash.new { |h, k| h[k] = {} }
|
@@ -17,6 +20,7 @@ class Card
|
|
17
20
|
end
|
18
21
|
|
19
22
|
def view view, *args, &block
|
23
|
+
# binding.pry
|
20
24
|
# view = view.to_viewname.key.to_sym
|
21
25
|
interpret_view_opts view, args[0] if block_given?
|
22
26
|
view_method_block = view_block(view, args, &block)
|
@@ -40,7 +44,7 @@ class Card
|
|
40
44
|
|
41
45
|
def define_standard_view_method view, &block
|
42
46
|
views[self][view] = block
|
43
|
-
define_method
|
47
|
+
define_method Card::Set::Format.view_method_name(view), &block
|
44
48
|
end
|
45
49
|
|
46
50
|
def define_async_view_method view, &block
|
@@ -53,18 +57,23 @@ class Card
|
|
53
57
|
|
54
58
|
def interpret_view_opts view, opts
|
55
59
|
return unless opts.present?
|
60
|
+
|
56
61
|
Card::Format.interpret_view_opts view, opts
|
57
|
-
|
62
|
+
VIEW_SETTINGS.each do |setting_name|
|
63
|
+
define_view_setting_method view, setting_name, opts.delete(setting_name)
|
64
|
+
end
|
58
65
|
end
|
59
66
|
|
60
|
-
def
|
61
|
-
return unless
|
62
|
-
|
63
|
-
|
67
|
+
def define_view_setting_method view, setting_name, setting_value
|
68
|
+
return unless setting_value
|
69
|
+
|
70
|
+
method_name = Card::Format.view_setting_method_name view, setting_name
|
71
|
+
define_method(method_name) { setting_value }
|
64
72
|
end
|
65
73
|
|
66
74
|
def view_block view, args, &block
|
67
75
|
return haml_view_block(view, wrap_with_slot?(args), &block) if haml_view?(args)
|
76
|
+
|
68
77
|
block_given? ? block : lookup_alias_block(view, args)
|
69
78
|
end
|
70
79
|
|
@@ -75,7 +75,6 @@ class Card
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def haml_to_html haml, locals={}, a_binding=nil, debug_info={}
|
78
|
-
# binding.pry unless haml.include? ".panel.panel-primary"
|
79
78
|
a_binding ||= binding
|
80
79
|
::Haml::Engine.new(haml).render a_binding, locals || {}
|
81
80
|
rescue Haml::SyntaxError => e
|
@@ -85,6 +84,7 @@ class Card
|
|
85
84
|
|
86
85
|
def template_location debug_info
|
87
86
|
return "" unless debug_info[:path]
|
87
|
+
|
88
88
|
Pathname.new(debug_info[:path])
|
89
89
|
.relative_path_from(Pathname.new(Dir.pwd))
|
90
90
|
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
class Card
|
2
|
+
module Set
|
3
|
+
module Format
|
4
|
+
# The Wrapper module provides an API to define wrap methods.
|
5
|
+
# It is available in all formats.
|
6
|
+
module Wrapper
|
7
|
+
# Defines a wrapper method with the name "wrap_with_<wrapper_name>".
|
8
|
+
# @param wrapper_name [Symbol, String] the name for the wrap method
|
9
|
+
# @param *args
|
10
|
+
# Inside the wrap_block the variable "interior" is always available
|
11
|
+
# to refer to the content that is supposed to be wrapped by the wrapper.
|
12
|
+
#
|
13
|
+
# Example:
|
14
|
+
# wrapper :burger do |opts|
|
15
|
+
# ["#{opts[:bun]}-bun", interior, "bun"].join "|"
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# It can be used like this:
|
19
|
+
# wrap_with_burger bun: "sesame" do
|
20
|
+
# "meat"
|
21
|
+
# end # => "sesame-bun|meat|bun"
|
22
|
+
#
|
23
|
+
# It's also possible to wrap a whole view with a wrapper
|
24
|
+
# view :whopper, wrap: :burger do
|
25
|
+
# "meat"
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# Options for view wrappers can be provided using a hash or, if not all wrappers
|
29
|
+
# need options, an array of symbols and hashes.
|
30
|
+
# Example
|
31
|
+
# view :big_mac, wrap: { burger: { bun: "sesame" }, paper: { color: :red } }
|
32
|
+
# view :cheese_burger, wrap: [:burger, paper: { color: :yellow }]
|
33
|
+
#
|
34
|
+
# If you want to define a wrapper that wraps only with a single html tag
|
35
|
+
# then use the following syntax:
|
36
|
+
# wrapper :burger, :div, class: "medium"
|
37
|
+
#
|
38
|
+
# wrap_with_burger "meat" # => "<div class='medium'>meat</div>"
|
39
|
+
def wrapper wrapper_name, *args, &wrap_block
|
40
|
+
method_name = Card::Set::Format.wrapper_method_name(wrapper_name)
|
41
|
+
if block_given?
|
42
|
+
define_method method_name, &wrap_block
|
43
|
+
else
|
44
|
+
define_tag_wrapper method_name, *args
|
45
|
+
end
|
46
|
+
define_wrap_with_method wrapper_name, method_name
|
47
|
+
end
|
48
|
+
|
49
|
+
def layout layout, &block
|
50
|
+
Card::Layout.register_built_in_layout layout
|
51
|
+
method_name = Card::Set::Format.layout_method_name(layout)
|
52
|
+
define_method method_name, &block
|
53
|
+
wrapper layout do
|
54
|
+
send method_name
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
attr_accessor :interior
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
# expects a tag with options that defines the wrap
|
63
|
+
def define_tag_wrapper method_name, tag_name, default_opts={}
|
64
|
+
class_eval do
|
65
|
+
define_method method_name do |opts={}|
|
66
|
+
add_class opts, default_opts[:class]
|
67
|
+
wrap_with(tag_name, interior, opts.reverse_merge(default_opts))
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
# defines the wrap_with_... method that you call to use the wrapper
|
73
|
+
def define_wrap_with_method wrapper_name, wrapper_method_name
|
74
|
+
class_exec(self) do |_format|
|
75
|
+
define_method "wrap_with_#{wrapper_name}" do |*args, &interior|
|
76
|
+
@interior, opts = interior ? [interior.call, args.first] : args
|
77
|
+
|
78
|
+
if method(wrapper_method_name).arity.zero?
|
79
|
+
send wrapper_method_name
|
80
|
+
else
|
81
|
+
send wrapper_method_name, (opts || {})
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
data/lib/card/set/helpers.rb
CHANGED
@@ -9,9 +9,14 @@ class Card
|
|
9
9
|
parts[first..last].join "::"
|
10
10
|
end
|
11
11
|
|
12
|
+
def underscore
|
13
|
+
shortname.tr(":", "_").underscore
|
14
|
+
end
|
15
|
+
|
12
16
|
# move to Set::Pattern?
|
13
17
|
def num_set_parts pattern_code
|
14
18
|
return 1 if pattern_code == :abstract
|
19
|
+
|
15
20
|
Pattern.find(pattern_code).anchor_parts_count
|
16
21
|
end
|
17
22
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# lib/my_custom_scanner.rb
|
2
|
-
require
|
2
|
+
require "i18n/tasks/scanners/file_scanner"
|
3
3
|
class Card
|
4
4
|
module Set
|
5
5
|
class I18nScanner < ::I18n::Tasks::Scanners::FileScanner
|
@@ -7,16 +7,17 @@ class Card
|
|
7
7
|
include ::I18n::Tasks::Scanners::OccurrenceFromPosition
|
8
8
|
|
9
9
|
# @return [Array<[absolute key, Results::Occurrence]>]
|
10
|
-
def scan_file
|
10
|
+
def scan_file path
|
11
11
|
text = read_file(path)
|
12
12
|
|
13
13
|
text.scan(/[^\w._-]tr[( ]\s*["':](\w+)/).map do |_match|
|
14
14
|
occurrence = occurrence_from_position(
|
15
|
-
|
15
|
+
path, text, Regexp.last_match.offset(0).first
|
16
|
+
)
|
16
17
|
[absolute_key(".#{_match[0]}", path), occurrence]
|
17
18
|
end
|
18
19
|
end
|
19
20
|
end
|
20
|
-
::I18n::Tasks.add_scanner
|
21
|
+
::I18n::Tasks.add_scanner "Card::Set::I18nScanner"
|
21
22
|
end
|
22
23
|
end
|
data/lib/card/set/i18n_scope.rb
CHANGED
@@ -44,27 +44,26 @@ class Card
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def find_tmp_set_path backtrace
|
47
|
-
path = backtrace.find {|line| line.include? "tmp/set/"}
|
48
|
-
unless path
|
49
|
-
|
50
|
-
end
|
47
|
+
path = backtrace.find { |line| line.include? "tmp/set/" }
|
48
|
+
raise Error, "couldn't find set path in backtrace: #{backtrace}" unless path
|
49
|
+
|
51
50
|
path
|
52
51
|
end
|
53
52
|
|
54
53
|
def find_set_path backtrace
|
55
|
-
path = backtrace.find {|line| line =~ %r{(?<!card)/set/}}
|
56
|
-
unless path
|
57
|
-
|
58
|
-
end
|
54
|
+
path = backtrace.find { |line| line =~ %r{(?<!card)/set/} }
|
55
|
+
raise Error, "couldn't find set path in backtrace: #{backtrace}" unless path
|
56
|
+
|
59
57
|
path
|
60
58
|
end
|
61
59
|
|
62
60
|
# index of the mod part in the tmp path
|
63
61
|
def tmp_path_mod_index parts
|
64
62
|
unless (set_index = parts.index("set")) &&
|
65
|
-
|
63
|
+
parts.size >= set_index + 2
|
66
64
|
raise Error, "not a valid set path: #{path}"
|
67
65
|
end
|
66
|
+
|
68
67
|
set_index + 1
|
69
68
|
end
|
70
69
|
|
@@ -76,9 +75,10 @@ class Card
|
|
76
75
|
# index of the mod part in the path
|
77
76
|
def path_mod_index parts
|
78
77
|
unless (set_index = parts.index("set")) &&
|
79
|
-
|
78
|
+
parts.size >= set_index + 2
|
80
79
|
raise Error, "not a valid set path: #{path}"
|
81
80
|
end
|
81
|
+
|
82
82
|
set_index - 1
|
83
83
|
end
|
84
84
|
end
|
data/lib/card/set/inheritance.rb
CHANGED
@@ -51,6 +51,7 @@ class Card
|
|
51
51
|
each_format set do |format, format_mods|
|
52
52
|
format_sym = Card::Format.format_sym format
|
53
53
|
next unless applicable_format?(format_sym, opts[:except], opts[:only])
|
54
|
+
|
54
55
|
format_mods.each do |format_mod|
|
55
56
|
define_on_format format_sym do
|
56
57
|
include format_mod
|
@@ -67,6 +68,7 @@ class Card
|
|
67
68
|
format_type = "#{set_type}_format".to_sym
|
68
69
|
modules[format_type].each_pair do |format, set_format_mod_hash|
|
69
70
|
next unless (format_mods = set_format_mod_hash[set.shortname])
|
71
|
+
|
70
72
|
yield format, format_mods
|
71
73
|
end
|
72
74
|
end
|
@@ -75,6 +77,7 @@ class Card
|
|
75
77
|
format_sym = Card::Format.format_sym format
|
76
78
|
return false if except && Array(except).include?(format_sym)
|
77
79
|
return false if only && !Array(only).include?(format_sym)
|
80
|
+
|
78
81
|
true
|
79
82
|
end
|
80
83
|
end
|
data/lib/card/set/loader.rb
CHANGED
@@ -45,6 +45,7 @@ class Card
|
|
45
45
|
# 'nonbase modules' are included dynamically on singleton_classes
|
46
46
|
def process_base_modules
|
47
47
|
return unless modules[:base].present?
|
48
|
+
|
48
49
|
Card.add_set_modules modules[:base]
|
49
50
|
modules[:base_format].each do |format_class, modules_list|
|
50
51
|
format_class.add_set_modules modules_list
|
@@ -0,0 +1,74 @@
|
|
1
|
+
class Card
|
2
|
+
module Set
|
3
|
+
class RequiredField
|
4
|
+
attr_reader :parent_set, :field_set, :field
|
5
|
+
|
6
|
+
def initialize parent_set, field
|
7
|
+
@parent_set = parent_set
|
8
|
+
@field_set = ensure_field_set parent_set, field
|
9
|
+
@field = field
|
10
|
+
end
|
11
|
+
|
12
|
+
def add
|
13
|
+
create_parent_event
|
14
|
+
create_field_events
|
15
|
+
end
|
16
|
+
|
17
|
+
def parent_event_name
|
18
|
+
[parent_set.underscore, "requires_field", field_set.underscore].join("__").to_sym
|
19
|
+
end
|
20
|
+
|
21
|
+
def field_event_name action
|
22
|
+
[field_set.underscore, "required_by", parent_set.underscore, "on", action].join("__").to_sym
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def create_field_events
|
28
|
+
create_field_delete_event
|
29
|
+
create_field_rename_event
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_field_delete_event
|
33
|
+
field_set.class_exec(self) do |required|
|
34
|
+
event required.field_event_name(:delete), :validate, on: :delete do
|
35
|
+
return if left&.singleton_class&.include?(required.parent_set)
|
36
|
+
|
37
|
+
errors.add required.field, "can't be deleted; required field of #{left.name}" # LOCALIZE
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def create_field_rename_event
|
43
|
+
field_set.class_exec(self) do |required|
|
44
|
+
event required.field_event_name(:update), :validate,
|
45
|
+
on: :update, changing: :name do
|
46
|
+
parent = Card.fetch(name_before_act.to_name.left)
|
47
|
+
return if !parent || parent&.singleton_class&.include?(required.parent_set)
|
48
|
+
|
49
|
+
errors.add :name, "can't be renamed; required field of #{parent.name}" # LOCALIZE
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def create_parent_event
|
55
|
+
parent_set.class_exec(self) do |required|
|
56
|
+
event required.parent_event_name, :validate, on: :save do
|
57
|
+
return if field? required.field
|
58
|
+
|
59
|
+
errors.add required.field, "required" # LOCALIZE
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def ensure_field_set some_set, field
|
65
|
+
field_set = some_set.ensure_set { "Right::#{field.to_s.capitalize}" }
|
66
|
+
Card::Set.register_set field_set
|
67
|
+
field_set
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
|
data/lib/card/set/trait.rb
CHANGED