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
@@ -0,0 +1,14 @@
|
|
1
|
+
class Card
|
2
|
+
class View
|
3
|
+
# method to render views with layouts
|
4
|
+
module Layout
|
5
|
+
# def with_layout &render_block
|
6
|
+
# binding.pry
|
7
|
+
# return yield unless layout.present?
|
8
|
+
#
|
9
|
+
# format.rendered_main_nest = format.wrap_main(&render_block)
|
10
|
+
# ::Card::Layout.render layout, self
|
11
|
+
# end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/card/view/options.rb
CHANGED
@@ -3,24 +3,26 @@ class Card
|
|
3
3
|
# Manages options for card views, including those used in nest syntax
|
4
4
|
module Options
|
5
5
|
# the keymap represents a 2x2 matrix, where the factors are
|
6
|
-
# (a) whether an option's value can be set by a
|
6
|
+
# (a) whether an option's value can be set by a shark via nests, and
|
7
7
|
# (b) whether nested views can inherit the option from a parent view.
|
8
8
|
#
|
9
|
-
# for
|
9
|
+
# for sharks | not for sharks
|
10
10
|
# ________________________________
|
11
11
|
# inherit | both | heir
|
12
|
-
# don't inherit |
|
12
|
+
# don't inherit | shark | none
|
13
13
|
#
|
14
14
|
# (note: each option will likely some day merit its own object)
|
15
15
|
@keymap = {
|
16
|
-
|
16
|
+
shark: [
|
17
17
|
:view, # view to render
|
18
18
|
:nest_name, # name as used in nest
|
19
19
|
:nest_syntax, # full nest syntax
|
20
20
|
:show, # render these views when optional
|
21
|
-
:hide # do not render these views when optional
|
21
|
+
:hide, # do not render these views when optional
|
22
|
+
:wrap, # wrap the nest with a wrapper
|
23
|
+
:edit
|
22
24
|
], # show/hide can be view (Symbol), list of views (Array),
|
23
|
-
|
25
|
+
# or comma separated views (String)
|
24
26
|
# NOTE: although show and hide are in this non-inheriting group, they are
|
25
27
|
# actually inherited, just not through the standard mechanism. Because, well,
|
26
28
|
# they're weird. (See process_visibility options)
|
@@ -37,7 +39,8 @@ class Card
|
|
37
39
|
:help, # cue text when editing
|
38
40
|
:structure, # overrides the content of the card
|
39
41
|
:title, # overrides the name of the card
|
40
|
-
:variant, # override the canonical version of the name with a different
|
42
|
+
:variant, # override the canonical version of the name with a different
|
43
|
+
# variant
|
41
44
|
:editor, # inline_nests makes a form within standard content (Symbol)
|
42
45
|
:type, # set the default type of new cards
|
43
46
|
:size, # set an image size
|
@@ -57,7 +60,8 @@ class Card
|
|
57
60
|
attr_reader :keymap
|
58
61
|
|
59
62
|
def add_option name, type
|
60
|
-
raise "invalid option type" unless @keymap.key?(type)
|
63
|
+
raise "invalid option type: #{type}" unless @keymap.key?(type)
|
64
|
+
|
61
65
|
@keymap[type] << name
|
62
66
|
reset_key_lists
|
63
67
|
end
|
@@ -10,8 +10,8 @@ class Card
|
|
10
10
|
|
11
11
|
# keys whose values can be set by Deckers in card nests
|
12
12
|
# @return [Array]
|
13
|
-
def
|
14
|
-
@
|
13
|
+
def shark_keys
|
14
|
+
@shark_keys ||= ::Set.new(keymap[:both]) + keymap[:shark]
|
15
15
|
end
|
16
16
|
|
17
17
|
# keys that follow simple standard inheritance pattern from parent views
|
@@ -25,14 +25,14 @@ class Card
|
|
25
25
|
def accessible_keys
|
26
26
|
all_keys - [ # (all but the following)
|
27
27
|
:view, # view is accessed as requested_view or ok_view and cannot be
|
28
|
-
|
28
|
+
# directly manipulated
|
29
29
|
:show, :hide # these have a more extensive API (see Card::View::Visibility)
|
30
30
|
]
|
31
31
|
end
|
32
32
|
|
33
33
|
def reset_key_lists
|
34
34
|
@all_keys = nil
|
35
|
-
@
|
35
|
+
@shark_keys = nil
|
36
36
|
@heir_keys = nil
|
37
37
|
end
|
38
38
|
end
|
@@ -25,15 +25,13 @@ class Card
|
|
25
25
|
|
26
26
|
def define_getter option_key
|
27
27
|
define_method option_key do
|
28
|
-
|
29
|
-
value = live_options[option_key]
|
30
|
-
try(norm_method, value) || value
|
28
|
+
live_options[option_key]
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
34
32
|
def define_setter option_key
|
35
33
|
define_method "#{option_key}=" do |value|
|
36
|
-
live_options[option_key] = value
|
34
|
+
live_options[option_key] = special_option_value(option_key, value) || value
|
37
35
|
end
|
38
36
|
end
|
39
37
|
end
|
@@ -69,6 +67,17 @@ class Card
|
|
69
67
|
# methods that follow the normalize_#{key} pattern are called by accessors
|
70
68
|
# (arguably that should be done during normalization!)
|
71
69
|
|
70
|
+
def normalize_special_options! opts
|
71
|
+
opts.each do |option_key, value|
|
72
|
+
new_value = special_option_value option_key, value
|
73
|
+
opts[option_key] = new_value if new_value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
def special_option_value option_key, value
|
78
|
+
try "normalize_#{option_key}", value
|
79
|
+
end
|
80
|
+
|
72
81
|
def normalize_editor value
|
73
82
|
value&.to_sym
|
74
83
|
end
|
@@ -77,6 +86,11 @@ class Card
|
|
77
86
|
value&.to_sym
|
78
87
|
end
|
79
88
|
|
89
|
+
def normalize_wrap value
|
90
|
+
value = value.split(",").map(&:strip) if value.is_a? String
|
91
|
+
Array.wrap(value).compact.flatten
|
92
|
+
end
|
93
|
+
|
80
94
|
protected
|
81
95
|
|
82
96
|
# - @live_options are dynamic and can be altered by the "voo" API at any time.
|
@@ -93,6 +107,7 @@ class Card
|
|
93
107
|
# handling for main_views.
|
94
108
|
def normalize_options
|
95
109
|
@normalized_options = opts = options_to_hash @raw_options.clone
|
110
|
+
normalize_special_options! opts
|
96
111
|
@optional = opts.delete(:optional) || false
|
97
112
|
add_implicit_options!
|
98
113
|
inherit_options_from_parent!
|
@@ -122,6 +137,7 @@ class Card
|
|
122
137
|
# standard inheritance from parent view object
|
123
138
|
def inherit_options_from_parent!
|
124
139
|
return unless parent
|
140
|
+
|
125
141
|
Options.heir_keys.each do |option_key|
|
126
142
|
inherit_from_parent! option_key
|
127
143
|
end
|
@@ -129,18 +145,16 @@ class Card
|
|
129
145
|
|
130
146
|
def inherit_from_parent! option_key
|
131
147
|
return unless (parent_value = parent.live_options[option_key])
|
148
|
+
|
132
149
|
@normalized_options[option_key] ||= parent_value
|
133
150
|
end
|
134
151
|
|
135
152
|
def process_live_options
|
136
153
|
@live_options = normalized_options.clone
|
137
|
-
|
138
|
-
@live_options.merge! format.main_nest_options
|
139
|
-
end
|
140
|
-
# main_nest_options are not processed in normalize_options so that
|
141
|
-
# they're NOT locked in the stub.
|
154
|
+
process_main_nest_options
|
142
155
|
process_before_view
|
143
156
|
process_visibility_options
|
157
|
+
process_view_wrappers
|
144
158
|
@live_options
|
145
159
|
end
|
146
160
|
|
@@ -150,8 +164,31 @@ class Card
|
|
150
164
|
format.before_view requested_view
|
151
165
|
end
|
152
166
|
|
167
|
+
# adds the wrappers that
|
168
|
+
def process_view_wrappers
|
169
|
+
view_wrappers = format.view_setting(:wrap, ok_view)
|
170
|
+
return unless view_wrappers.present?
|
171
|
+
|
172
|
+
@live_options[:wrap] = Array.wrap(@live_options[:wrap])
|
173
|
+
if view_wrappers.is_a? ::Hash
|
174
|
+
view_wrappers.each_pair do |name, opts|
|
175
|
+
@live_options[:wrap] << [name, opts]
|
176
|
+
end
|
177
|
+
else
|
178
|
+
@live_options[:wrap] += Array.wrap(view_wrappers)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# merge the options of the main nest into the @live_options
|
183
|
+
# They are not processed in normalize_options so that
|
184
|
+
# they're NOT locked in the stub.
|
185
|
+
def process_main_nest_options
|
186
|
+
@live_options.merge! format.main_nest_options if @live_options[:main_view]
|
187
|
+
end
|
188
|
+
|
153
189
|
def validate_options! opts
|
154
190
|
return unless (foreign_opts = foreign_options_in opts)
|
191
|
+
|
155
192
|
raise Card::Error, "illegal view options: #{foreign_opts}"
|
156
193
|
end
|
157
194
|
|
data/lib/card/view/stub.rb
CHANGED
@@ -9,7 +9,6 @@ class Card
|
|
9
9
|
# A stub must contain all the information necessary to produce the view as intended.
|
10
10
|
#
|
11
11
|
module Stub
|
12
|
-
|
13
12
|
class << self
|
14
13
|
def escape stub_json
|
15
14
|
stub_json.gsub "(", "_OParEN_"
|
@@ -36,7 +35,8 @@ class Card
|
|
36
35
|
view_opts: normalized_options,
|
37
36
|
format_opts: { nest_mode: format.nest_mode, override: root? } }
|
38
37
|
# nest mode handling:
|
39
|
-
# typically modes only override views on nests, but stubs create non-standard
|
38
|
+
# typically modes only override views on nests, but stubs create non-standard
|
39
|
+
# nests
|
40
40
|
# mode-based view overrides should NOT apply to standard render calls that have
|
41
41
|
# been replaced with stubs - only to standard nest calls. therefore modes are not
|
42
42
|
# stored in non-standard nest stubs
|
data/lib/card/view/visibility.rb
CHANGED
@@ -40,20 +40,19 @@ class Card
|
|
40
40
|
|
41
41
|
# advanced write method
|
42
42
|
VIZ_SETTING = { show: :show, true => :show,
|
43
|
-
hide: :hide, false => :hide, nil => :hide }
|
43
|
+
hide: :hide, false => :hide, nil => :hide }.freeze
|
44
44
|
|
45
45
|
def viz views, setting, force=false
|
46
46
|
Array.wrap(views).flatten.each do |view|
|
47
47
|
view = view.to_sym
|
48
48
|
next if !force && viz_hash[view]
|
49
|
+
|
49
50
|
viz_hash[view] = VIZ_SETTING[setting]
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
54
|
def visible? view
|
54
|
-
unless viz_hash[view]
|
55
|
-
viz view, yield
|
56
|
-
end
|
55
|
+
viz view, yield unless viz_hash[view]
|
57
56
|
show? view
|
58
57
|
end
|
59
58
|
|
@@ -74,7 +73,7 @@ class Card
|
|
74
73
|
|
75
74
|
# takes an options_hash and processes it to update viz_hash
|
76
75
|
def process_visibility options_hash
|
77
|
-
[
|
76
|
+
%i[hide show].each do |setting|
|
78
77
|
list = viz_view_list options_hash.delete(setting)
|
79
78
|
viz list, setting, true
|
80
79
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class Card
|
2
|
+
class View
|
3
|
+
# method to render views with layouts
|
4
|
+
module Wrapper
|
5
|
+
def with_wrapper
|
6
|
+
if layout.present?
|
7
|
+
self.wrap ||= []
|
8
|
+
wrap.push layout.to_name.key
|
9
|
+
end
|
10
|
+
|
11
|
+
format.rendered = yield
|
12
|
+
return format.rendered unless wrap.present?
|
13
|
+
|
14
|
+
wrap.reverse_each do |wrapper|
|
15
|
+
format.rendered = render_wrapper wrapper
|
16
|
+
end
|
17
|
+
format.rendered
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def render_wrapper wrapper
|
23
|
+
format.try("wrap_with_#{wrapper}") { format.rendered } ||
|
24
|
+
Card::Layout::CardLayout.new(wrapper, format).render
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/cardio.rb
CHANGED
data/mod/Modfile
CHANGED
@@ -125,10 +125,8 @@ end
|
|
125
125
|
def reset_password_success
|
126
126
|
token_card.used!
|
127
127
|
Auth.signin left_id
|
128
|
-
{ id:
|
129
|
-
view: :
|
130
|
-
slot: { items: { nest_name: :account.cardname.prepend_joint,
|
131
|
-
view: :edit } } }
|
128
|
+
{ id: name,
|
129
|
+
view: :edit }
|
132
130
|
end
|
133
131
|
|
134
132
|
def reset_password_try_again
|
@@ -176,8 +174,8 @@ format :html do
|
|
176
174
|
# Problem: when you do that then the fields are missing in the sign up form:
|
177
175
|
# output( [field_nest(:email, view: :titled, title: "email"),
|
178
176
|
# field_nest(:password, view: :titled, title: "password")])
|
179
|
-
%({{+#{:email.cardname}|
|
180
|
-
{{+#{:password.cardname}|
|
177
|
+
%({{+#{:email.cardname}|edit_row;title:email}}
|
178
|
+
{{+#{:password.cardname}|edit_row;title:password}})
|
181
179
|
end
|
182
180
|
|
183
181
|
before :content_formgroup do
|
@@ -31,8 +31,7 @@ end
|
|
31
31
|
# and aborts (does not sign in)
|
32
32
|
event :send_reset_password_token, before: :signin, on: :update, trigger: :required do
|
33
33
|
email = subfield(:email)&.content
|
34
|
-
|
35
|
-
send_reset_password_email_or_fail account
|
34
|
+
send_reset_password_email_or_fail email
|
36
35
|
end
|
37
36
|
|
38
37
|
def consider_recaptcha?
|
@@ -44,7 +43,8 @@ def i18n_signin key
|
|
44
43
|
end
|
45
44
|
|
46
45
|
def authenticate_or_abort email, pword
|
47
|
-
abort :failure, i18n_signin(:
|
46
|
+
abort :failure, i18n_signin(:email_missing) unless email
|
47
|
+
abort :failure, i18n_signin(:password_missing) unless pword
|
48
48
|
if (account = Auth.authenticate(email, pword))
|
49
49
|
Auth.signin account.left_id
|
50
50
|
else
|
@@ -62,9 +62,11 @@ def signin_error_message account
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
def send_reset_password_email_or_fail
|
65
|
+
def send_reset_password_email_or_fail email
|
66
66
|
aborting do
|
67
|
-
|
67
|
+
break errors.add :email, i18n_signin(:error_blank) if email.blank?
|
68
|
+
|
69
|
+
if (account = Auth.find_account_by_email(email))&.active?
|
68
70
|
account.send_reset_password_token
|
69
71
|
elsif account
|
70
72
|
errors.add :account, i18n_signin(:error_not_active)
|
@@ -121,15 +123,20 @@ format :html do
|
|
121
123
|
|
122
124
|
# FORGOT PASSWORD
|
123
125
|
view :edit do
|
126
|
+
reset_password_voo
|
127
|
+
Auth.as_bot { super() }
|
128
|
+
end
|
129
|
+
|
130
|
+
def reset_password_voo
|
124
131
|
voo.title ||= card.i18n_signin(:forgot_password)
|
125
132
|
voo.edit_structure = [signin_field(:email)]
|
126
133
|
voo.hide :help
|
127
|
-
Auth.as_bot { super() }
|
128
134
|
end
|
129
135
|
|
136
|
+
|
130
137
|
view :edit_buttons do
|
131
138
|
text = I18n.t :reset_my_password, scope: "mod.account.set.self.signin"
|
132
|
-
button_tag text, situation: "primary"
|
139
|
+
button_tag text, situation: "primary", class: "_close-modal-on-success"
|
133
140
|
end
|
134
141
|
|
135
142
|
def hidden_signin_fields
|
@@ -148,9 +155,9 @@ format :html do
|
|
148
155
|
|
149
156
|
def reset_password_link
|
150
157
|
text = I18n.t :reset_password, scope: "mod.account.set.self.signin"
|
151
|
-
|
158
|
+
link = link_to_view :edit, text, path: { slot: { hide: :bridge_link } }
|
152
159
|
# FIXME: inline styling
|
153
|
-
raw("<div style='float:right'>#{
|
160
|
+
raw("<div style='float:right'>#{link}</div>")
|
154
161
|
end
|
155
162
|
|
156
163
|
def edit_view_hidden
|
@@ -1,39 +1,46 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
describe Card::Set::Right::Password do
|
4
|
-
|
5
|
-
|
3
|
+
RSpec.describe Card::Set::Right::Password do
|
4
|
+
let(:account) { Card::Auth.find_account_by_email("joe@user.com") }
|
5
|
+
let(:password_card) { account.password_card }
|
6
|
+
let(:password) { account.password }
|
7
|
+
|
8
|
+
specify "view: core" do
|
9
|
+
expect(password_card.format.render_core).to have_tag :em, "encrypted"
|
10
|
+
end
|
11
|
+
|
12
|
+
def card_subject
|
13
|
+
password_card
|
6
14
|
end
|
7
15
|
|
16
|
+
check_html_views_for_errors
|
17
|
+
|
8
18
|
describe "#update" do
|
9
|
-
it "encrypts password" do
|
10
|
-
|
11
|
-
expect(
|
19
|
+
it "encrypts password", aggregate_failures: true do
|
20
|
+
password_card.update! content: "new password"
|
21
|
+
expect(password).not_to eq("new password")
|
12
22
|
authenticated = Card::Auth.authenticate "joe@user.com", "new password"
|
13
|
-
|
23
|
+
expect(account).to eq authenticated
|
14
24
|
end
|
15
25
|
|
16
26
|
it "validates password" do
|
17
|
-
password_card =
|
27
|
+
password_card = account.password_card
|
18
28
|
password_card.update content: "2b"
|
19
29
|
expect(password_card.errors[:password]).not_to be_empty
|
20
30
|
end
|
21
31
|
|
22
32
|
context "blank password" do
|
23
|
-
it "does not change the password" do
|
24
|
-
|
25
|
-
original_pw = acct.password
|
33
|
+
it "does not change the password", aggregate_failures: true do
|
34
|
+
original_pw = account.password
|
26
35
|
expect(original_pw.size).to be > 10
|
27
|
-
|
28
|
-
|
29
|
-
pw_card.save
|
30
|
-
expect(original_pw).to eq(pw_card.refresh(_force = true).db_content)
|
36
|
+
password_card.update! content: ""
|
37
|
+
expect(original_pw).to eq(password_card.refresh(_force = true).db_content)
|
31
38
|
end
|
32
39
|
|
33
|
-
it "does not break email editing" do
|
34
|
-
|
35
|
-
expect(
|
36
|
-
expect(
|
40
|
+
it "does not break email editing", aggregate_failures: true do
|
41
|
+
account.update! subcards: { "+*password" => "", "+*email" => "joe2@user.com" }
|
42
|
+
expect(account.email).to eq("joe2@user.com")
|
43
|
+
expect(account.password).not_to be_empty
|
37
44
|
end
|
38
45
|
end
|
39
46
|
end
|