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/format.rb
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
3
|
class Card
|
4
|
-
# _Views_ are the primary way users interact with cards. Card::Format and its subclasses
|
4
|
+
# _Views_ are the primary way users interact with cards. Card::Format and its subclasses
|
5
|
+
# ({Card::Format::HtmlFormat}, {Card::Format::JsonFormat}, {Card::Format::XmlFormat},
|
6
|
+
# etc) are responsible for defining and rendering _views_.
|
5
7
|
#
|
6
|
-
# However, Deck-coders (those who code in the Card/Decko framework) rarely write code
|
8
|
+
# However, Deck-coders (those who code in the Card/Decko framework) rarely write code
|
9
|
+
# directly in these classes. Instead they organize their code using {Card::Mods mods}.
|
10
|
+
# The {Card::Mod} docs explain how to set up a mod. Once you've done that, you're ready
|
11
|
+
# to define a view. These docs will introduce the basics of view definition and
|
7
12
|
#
|
8
13
|
# Here is a very simple view that just defines a label for the card – its name:
|
9
14
|
#
|
@@ -11,7 +16,8 @@ class Card
|
|
11
16
|
# card.name
|
12
17
|
# end
|
13
18
|
#
|
14
|
-
# If a format is not specified, the view is defined on the base format class,
|
19
|
+
# If a format is not specified, the view is defined on the base format class,
|
20
|
+
# Card::Format. The following two definitions are equivalent to the definition above:
|
15
21
|
#
|
16
22
|
# format do
|
17
23
|
# view(:label) { card.name }
|
@@ -19,7 +25,9 @@ class Card
|
|
19
25
|
#
|
20
26
|
# format(:base) { view(:label) { card.name } }
|
21
27
|
#
|
22
|
-
# But suppose you would like this view to appear differently in different output
|
28
|
+
# But suppose you would like this view to appear differently in different output
|
29
|
+
# formats. For example, you'd like this label to have a tag with a class attribute HTML
|
30
|
+
# so that you can style it with CSS.
|
23
31
|
#
|
24
32
|
# format :html do
|
25
33
|
# view :label do
|
@@ -27,14 +35,18 @@ class Card
|
|
27
35
|
# end
|
28
36
|
# end
|
29
37
|
#
|
30
|
-
# Note that in place of card.name, you could also use `super`, because this view is
|
38
|
+
# Note that in place of card.name, you could also use `super`, because this view is
|
39
|
+
# translated into a method on Card::Format::HtmlFormat, which inherits from
|
40
|
+
# Card::Format.
|
31
41
|
#
|
32
42
|
# ## Common arguments for view definitions
|
33
43
|
#
|
34
|
-
# * :perms - restricts view permissions. Value can be :create, :read, :update, :delete,
|
44
|
+
# * :perms - restricts view permissions. Value can be :create, :read, :update, :delete,
|
45
|
+
# or a Proc.
|
35
46
|
# * :tags - tag view as needed.
|
36
47
|
#
|
37
|
-
# The most commmon tag is "unknown_ok," which indicates that a view can be rendered even
|
48
|
+
# The most commmon tag is "unknown_ok," which indicates that a view can be rendered even
|
49
|
+
# if the card is "unknown" (not real or virtual).
|
38
50
|
#
|
39
51
|
# ## Rendering views
|
40
52
|
#
|
@@ -63,8 +75,8 @@ class Card
|
|
63
75
|
send "#{accessor_name}=", {}
|
64
76
|
end
|
65
77
|
|
66
|
-
attr_reader :card, :parent, :main_opts
|
67
|
-
attr_accessor :form, :error_status
|
78
|
+
attr_reader :card, :parent, :main_opts, :modal_opts
|
79
|
+
attr_accessor :form, :error_status, :rendered
|
68
80
|
|
69
81
|
def self.view_caching?
|
70
82
|
true
|
@@ -80,6 +92,7 @@ class Card
|
|
80
92
|
|
81
93
|
def require_card_to_initialize!
|
82
94
|
return if @card
|
95
|
+
|
83
96
|
msg = I18n.t :exception_init_without_card, scope: "lib.card.format"
|
84
97
|
raise Card::Error, msg
|
85
98
|
end
|
data/lib/card/format/content.rb
CHANGED
@@ -14,9 +14,15 @@ class Card
|
|
14
14
|
# (as opposed to a direct API nest)
|
15
15
|
def content_nest opts={}
|
16
16
|
return opts[:comment] if opts.key? :comment # commented nest
|
17
|
+
|
17
18
|
nest_name = opts[:nest_name]
|
18
|
-
return
|
19
|
-
|
19
|
+
# return voo.render_layouts if main_nest?(nest_name)
|
20
|
+
# return main_nest(opts, &main_nest_block) if main_nest?(nest_name)
|
21
|
+
if main_nest?(nest_name) && @nest_mode != :template
|
22
|
+
wrap_main { main.rendered || main_nest(opts) }
|
23
|
+
else
|
24
|
+
nest nest_name, opts
|
25
|
+
end
|
20
26
|
end
|
21
27
|
|
22
28
|
def format_date date, include_time=true
|
@@ -35,6 +41,7 @@ class Card
|
|
35
41
|
|
36
42
|
def add_class options, klass
|
37
43
|
return if klass.blank?
|
44
|
+
|
38
45
|
options[:class] = css_classes options[:class], klass
|
39
46
|
end
|
40
47
|
|
@@ -50,6 +57,7 @@ class Card
|
|
50
57
|
|
51
58
|
def id_counter
|
52
59
|
return @parent.id_counter if @parent
|
60
|
+
|
53
61
|
@id_counter ||= 0
|
54
62
|
@id_counter += 1
|
55
63
|
end
|
@@ -13,18 +13,20 @@ class Card
|
|
13
13
|
|
14
14
|
def relevant_context_names
|
15
15
|
part_keys = @card.name.part_names.map(&:key)
|
16
|
-
yield.
|
16
|
+
yield.select { |n| part_keys.include? n.key }
|
17
17
|
end
|
18
18
|
|
19
19
|
# "slot[name_context]" param is a string;
|
20
20
|
# @context_names is an array
|
21
21
|
def context_names_from_params
|
22
22
|
return [] unless (name_list = Card::Env.slot_opts.delete(:name_context))
|
23
|
+
|
23
24
|
name_list.to_s.split(",").map(&:to_name)
|
24
25
|
end
|
25
26
|
|
26
27
|
def context_names_to_params
|
27
28
|
return if context_names.empty?
|
29
|
+
|
28
30
|
context_names.join(",")
|
29
31
|
end
|
30
32
|
|
@@ -36,7 +38,7 @@ class Card
|
|
36
38
|
def title_in_context title=nil
|
37
39
|
keep_safe = title&.html_safe?
|
38
40
|
title = title ? title.to_name.absolute_name(card.name) : card.name
|
39
|
-
newtitle = title.from
|
41
|
+
newtitle = title.from(*context_names)
|
40
42
|
keep_safe ? newtitle.html_safe : newtitle
|
41
43
|
end
|
42
44
|
end
|
data/lib/card/format/error.rb
CHANGED
@@ -33,7 +33,7 @@ class Card
|
|
33
33
|
if exception.is_a? Card::Error::UserError
|
34
34
|
exception.message
|
35
35
|
else
|
36
|
-
tr :error_rendering, scope: [
|
36
|
+
tr :error_rendering, scope: %i[lib card format error],
|
37
37
|
cardname: error_cardname(exception), view: view
|
38
38
|
end
|
39
39
|
end
|
data/lib/card/format/nest.rb
CHANGED
@@ -27,7 +27,7 @@ class Card
|
|
27
27
|
view_opts[:nest_name] ||= card.name
|
28
28
|
@view ||= prepare_view
|
29
29
|
# TODO: handle in closed / edit view definitions
|
30
|
-
view_opts[:home_view] ||= [
|
30
|
+
view_opts[:home_view] ||= %i[closed edit].member?(view) ? :open : view
|
31
31
|
end
|
32
32
|
|
33
33
|
def prepare_view
|
@@ -40,6 +40,7 @@ class Card
|
|
40
40
|
# @return [Format] subformat object
|
41
41
|
def prepare_subformat
|
42
42
|
return format if reuse_format?
|
43
|
+
|
43
44
|
sub = format.subformat card, format_opts
|
44
45
|
sub.main! if view_opts[:main]
|
45
46
|
sub
|
@@ -63,8 +64,8 @@ class Card
|
|
63
64
|
|
64
65
|
def content_view?
|
65
66
|
# TODO: this should be specified in view definition
|
66
|
-
[
|
67
|
-
|
67
|
+
%i[
|
68
|
+
core content titled open closed open_content
|
68
69
|
].member? @view.to_sym
|
69
70
|
end
|
70
71
|
end
|
data/lib/card/format/nesting.rb
CHANGED
@@ -11,6 +11,7 @@ class Card
|
|
11
11
|
# @param format_opts [Hash] opts will be passed on to subformat
|
12
12
|
def nest cardish, view_opts={}, format_opts={}
|
13
13
|
return "" if nest_invisible?
|
14
|
+
|
14
15
|
nest = Card::Format::Nest.new self, cardish, view_opts, format_opts
|
15
16
|
nest.prepare do |subformat, view|
|
16
17
|
rendered = count_chars { subformat.render view, view_opts }
|
@@ -53,6 +54,7 @@ class Card
|
|
53
54
|
def count_chars
|
54
55
|
result = yield
|
55
56
|
return result unless nest_mode == :closed && result
|
57
|
+
|
56
58
|
@char_count ||= 0
|
57
59
|
@char_count += result.length
|
58
60
|
result
|
@@ -7,20 +7,23 @@ class Card
|
|
7
7
|
yield # no wrapping in base format
|
8
8
|
end
|
9
9
|
|
10
|
-
def main_nest opts
|
11
|
-
|
12
|
-
|
10
|
+
def main_nest opts={}
|
11
|
+
with_nest_mode :normal do
|
12
|
+
if block_given?
|
13
|
+
block.call
|
14
|
+
else
|
13
15
|
nest root.card, opts.merge(main_view: true, main: true)
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
20
|
def main_nest? nest_name
|
19
|
-
nest_name == "_main" && !root.already_mained?
|
21
|
+
nest_name == "_main" # && !root.already_mained?
|
20
22
|
end
|
21
23
|
|
22
24
|
def already_mained?
|
23
25
|
return true if @main || @already_main
|
26
|
+
|
24
27
|
@already_main = true
|
25
28
|
false
|
26
29
|
end
|
@@ -29,8 +32,9 @@ class Card
|
|
29
32
|
@main = true
|
30
33
|
end
|
31
34
|
|
35
|
+
# view=edit&items=closed
|
32
36
|
def main_nest_options
|
33
|
-
opts =
|
37
|
+
opts = inherit(:main_opts) || {}
|
34
38
|
main_nest_size_opt opts
|
35
39
|
main_nest_items_opt opts
|
36
40
|
opts
|
@@ -41,12 +45,14 @@ class Card
|
|
41
45
|
def main_nest_size_opt opts
|
42
46
|
val = params[:size]
|
43
47
|
return unless val.present?
|
48
|
+
|
44
49
|
opts[:size] = val.to_sym
|
45
50
|
end
|
46
51
|
|
47
52
|
def main_nest_items_opt opts
|
48
53
|
val = params[:item]
|
49
54
|
return unless val.present?
|
55
|
+
|
50
56
|
opts[:items] ||= {}
|
51
57
|
opts[:items][:view] = val.to_sym
|
52
58
|
end
|
@@ -15,10 +15,22 @@ class Card
|
|
15
15
|
@root ||= parent ? parent.root : self
|
16
16
|
end
|
17
17
|
|
18
|
+
def main
|
19
|
+
if main?
|
20
|
+
self
|
21
|
+
elsif !root?
|
22
|
+
parent.main
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
18
26
|
def depth
|
19
27
|
@depth ||= parent ? (parent.depth + 1) : 0
|
20
28
|
end
|
21
29
|
|
30
|
+
def root?
|
31
|
+
depth.zero?
|
32
|
+
end
|
33
|
+
|
22
34
|
# is format's card the format of the main card on a page?
|
23
35
|
def main?
|
24
36
|
depth.zero?
|
@@ -3,6 +3,7 @@ class Card
|
|
3
3
|
module Permission
|
4
4
|
def ok_view view, skip_perms=false
|
5
5
|
raise Card::Error::UserError, tr(:too_deep) if subformats_nested_too_deeply?
|
6
|
+
|
6
7
|
approved_view = check_view view, skip_perms
|
7
8
|
handle_view_denial view, approved_view
|
8
9
|
approved_view
|
@@ -10,6 +11,7 @@ class Card
|
|
10
11
|
|
11
12
|
def handle_view_denial view, approved_view
|
12
13
|
return if approved_view == view
|
14
|
+
|
13
15
|
@denied_view = view
|
14
16
|
end
|
15
17
|
|
@@ -25,6 +27,7 @@ class Card
|
|
25
27
|
def unknown_disqualifies_view? view
|
26
28
|
# view can't handle unknown cards (and card is unknown)
|
27
29
|
return false if tagged view, :unknown_ok
|
30
|
+
|
28
31
|
card.unknown?
|
29
32
|
end
|
30
33
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
class Card
|
2
2
|
class Format
|
3
3
|
module Registration
|
4
|
-
|
5
4
|
def register format
|
6
5
|
registered << format.to_s
|
7
6
|
end
|
@@ -17,6 +16,7 @@ class Card
|
|
17
16
|
|
18
17
|
def format_class opts
|
19
18
|
return opts[:format_class] if opts[:format_class]
|
19
|
+
|
20
20
|
format = opts[:format] || :html
|
21
21
|
class_from_name format_class_name(format)
|
22
22
|
end
|
@@ -30,6 +30,7 @@ class Card
|
|
30
30
|
|
31
31
|
def format_sym format
|
32
32
|
return format if format.is_a? Symbol
|
33
|
+
|
33
34
|
match = format.to_s.match(/::(?<format>[^:]+)Format/)
|
34
35
|
match ? match[:format].underscore.to_sym : :base
|
35
36
|
end
|
@@ -42,20 +43,22 @@ class Card
|
|
42
43
|
def extract_class_vars view, opts
|
43
44
|
Card::Format::VIEW_VARS.each do |varname|
|
44
45
|
next unless (value = opts.delete varname)
|
46
|
+
|
45
47
|
send(varname)[view] = value
|
46
48
|
end
|
47
49
|
end
|
48
50
|
|
49
51
|
def extract_view_tags view, tags
|
50
52
|
return unless tags
|
53
|
+
|
51
54
|
Array.wrap(tags).each do |tag|
|
52
55
|
view_tags[view] ||= {}
|
53
56
|
view_tags[view][tag] = true
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
57
|
-
def
|
58
|
-
"view_#{view}
|
60
|
+
def view_setting_method_name view, setting_name
|
61
|
+
"view_#{view}_#{setting_name}_setting"
|
59
62
|
end
|
60
63
|
|
61
64
|
def class_from_name formatname
|
@@ -68,6 +71,7 @@ class Card
|
|
68
71
|
|
69
72
|
def tagged view, tag
|
70
73
|
return unless view && tag && (viewhash = view_tags[view.to_sym])
|
74
|
+
|
71
75
|
viewhash[tag.to_sym]
|
72
76
|
end
|
73
77
|
|
data/lib/card/format/render.rb
CHANGED
@@ -3,14 +3,15 @@ class Card
|
|
3
3
|
# View rendering methods.
|
4
4
|
#
|
5
5
|
module Render
|
6
|
-
|
7
|
-
|
6
|
+
# view=open&layout=simple
|
7
|
+
def render! view, view_options={}
|
8
|
+
voo = View.new self, view, view_options, @voo
|
8
9
|
with_voo voo do
|
9
10
|
voo.process do |final_view|
|
10
11
|
final_render final_view
|
11
12
|
end
|
12
13
|
end
|
13
|
-
rescue => e
|
14
|
+
rescue StandardError => e
|
14
15
|
rescue_view e, view
|
15
16
|
end
|
16
17
|
|
@@ -22,12 +23,55 @@ class Card
|
|
22
23
|
@voo = old_voo
|
23
24
|
end
|
24
25
|
|
26
|
+
def with_wrapper
|
27
|
+
if voo.layout.present?
|
28
|
+
voo.wrap ||= []
|
29
|
+
layout = voo.layout.to_name.key
|
30
|
+
# don't wrap twice with modals or overlays
|
31
|
+
# this can happen if the view is wrapped with modal
|
32
|
+
# and is requested with layout=modal param
|
33
|
+
voo.wrap.push layout unless voo.wrap.include? layout.to_sym
|
34
|
+
end
|
35
|
+
|
36
|
+
@rendered = yield
|
37
|
+
wrap_with_wrapper
|
38
|
+
end
|
39
|
+
|
40
|
+
def wrap_with_wrapper
|
41
|
+
return @rendered unless voo.wrap.present?
|
42
|
+
|
43
|
+
voo.wrap.reverse.each do |wrapper, opts|
|
44
|
+
@rendered = render_with_wrapper(wrapper, opts) ||
|
45
|
+
render_with_card_layout(wrapper) ||
|
46
|
+
raise_wrap_error(wrapper)
|
47
|
+
end
|
48
|
+
@rendered
|
49
|
+
end
|
50
|
+
|
51
|
+
def render_with_wrapper wrapper, opts
|
52
|
+
try("wrap_with_#{wrapper}", opts) { @rendered }
|
53
|
+
end
|
54
|
+
|
55
|
+
def render_with_card_layout mark
|
56
|
+
return unless Card::Layout.card_layout? mark
|
57
|
+
|
58
|
+
Card::Layout::CardLayout.new(mark, self).render
|
59
|
+
end
|
60
|
+
|
61
|
+
def raise_wrap_error wrapper
|
62
|
+
if wrapper.is_a? String
|
63
|
+
raise Card::Error::UserError, "unknown layout card: #{wrapper}"
|
64
|
+
else
|
65
|
+
raise ArgumentError, "unknown wrapper: #{wrapper}"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
25
69
|
def before_view view
|
26
70
|
try "_before_#{view}"
|
27
71
|
end
|
28
72
|
|
29
73
|
def voo
|
30
|
-
@voo
|
74
|
+
@voo ||= View.new self, nil, {}
|
31
75
|
end
|
32
76
|
|
33
77
|
def show_view? view, default_viz=:show
|
@@ -38,14 +82,21 @@ class Card
|
|
38
82
|
|
39
83
|
def final_render view
|
40
84
|
current_view(view) do
|
41
|
-
|
42
|
-
|
43
|
-
|
85
|
+
with_wrapper do
|
86
|
+
method = view_method view
|
87
|
+
rendered = final_render_call method
|
88
|
+
add_debug_info view, method, rendered
|
89
|
+
end
|
44
90
|
end
|
45
91
|
end
|
46
92
|
|
93
|
+
def final_render_call method
|
94
|
+
method.call
|
95
|
+
end
|
96
|
+
|
47
97
|
def add_debug_info view, method, rendered
|
48
98
|
return rendered unless show_debug_info?
|
99
|
+
|
49
100
|
<<-HTML
|
50
101
|
<view-debug view='#{safe_name}##{view}' src='#{pretty_path method.source_location}' module='#{method.owner}'/>
|
51
102
|
#{rendered}
|
@@ -57,17 +108,24 @@ class Card
|
|
57
108
|
end
|
58
109
|
|
59
110
|
def pretty_path source_location
|
60
|
-
source_location.first.gsub(%r{^.+mod\d+-([^/]+)}, '\1: ') +
|
111
|
+
source_location.first.gsub(%r{^.+mod\d+-([^/]+)}, '\1: ') + ":" +
|
61
112
|
source_location.second.to_s
|
62
113
|
end
|
63
114
|
|
64
115
|
# setting (:alway, :never, :nested) designated in view definition
|
65
116
|
def view_cache_setting view
|
66
|
-
|
67
|
-
|
117
|
+
coded_setting = view_setting(:cache, view) || :standard
|
118
|
+
# method = self.class.view_cache_setting_method view
|
119
|
+
# coded_setting = respond_to?(method) ? send(method) : :standard
|
68
120
|
return :never if coded_setting == :never
|
121
|
+
|
69
122
|
# seems unwise to override a hard-coded "never"
|
70
|
-
(voo
|
123
|
+
(voo&.cache) || coded_setting
|
124
|
+
end
|
125
|
+
|
126
|
+
def view_setting setting_name, view
|
127
|
+
method = self.class.view_setting_method_name view, setting_name
|
128
|
+
try method
|
71
129
|
end
|
72
130
|
|
73
131
|
def stub_render cached_content
|
@@ -86,6 +144,7 @@ class Card
|
|
86
144
|
def prepare_stub_nest stub_hash
|
87
145
|
stub_card = Card.fetch_from_cast stub_hash[:cast]
|
88
146
|
view_opts = stub_hash[:view_opts]
|
147
|
+
voo.normalize_special_options! view_opts
|
89
148
|
if stub_card&.key.present? && stub_card.key == card.key
|
90
149
|
view_opts[:nest_name] ||= "_self"
|
91
150
|
end
|
@@ -113,15 +172,12 @@ class Card
|
|
113
172
|
unless supports_view? view
|
114
173
|
raise Card::Error::UserError, unsupported_view_error_message(view)
|
115
174
|
end
|
116
|
-
method view_method_name(view)
|
117
|
-
end
|
118
175
|
|
119
|
-
|
120
|
-
respond_to? view_method_name(view)
|
176
|
+
method Card::Set::Format.view_method_name(view)
|
121
177
|
end
|
122
178
|
|
123
|
-
def
|
124
|
-
|
179
|
+
def supports_view? view
|
180
|
+
respond_to? Card::Set::Format.view_method_name(view)
|
125
181
|
end
|
126
182
|
|
127
183
|
def current_view view
|