card 1.98.3 → 1.99.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/locales/de.yml +7 -7
- data/config/locales/en.yml +7 -7
- data/config/locales/es.yml +7 -7
- data/db/migrate_core_cards/20150610180019_add_recaptcha_key_and_admin_info_cards.rb +3 -3
- data/db/migrate_core_cards/20160801143221_change_bootstrap_card_type_to_scss.rb +1 -1
- data/db/migrate_core_cards/20160804112510_reorganize_scripts.rb +1 -1
- data/db/migrate_core_cards/20160908154210_add_trash_card.rb +1 -1
- data/db/migrate_core_cards/20180508210903_add_json_type.rb +3 -3
- data/db/migrate_core_cards/20180712042655_head_rule.rb +1 -1
- data/db/migrate_core_cards/{20180905061536_migrate_layouts.rb → 20180905061537_migrate_layouts.rb} +12 -1
- data/db/migrate_core_cards/20190204195039_add_rule_card.rb +3 -0
- data/db/migrate_core_cards/20190320091257_upgrade_recaptcha_to_v3.rb +5 -6
- data/db/migrate_core_cards/20190417142612_reorganize_scripts_2.rb +3 -3
- data/db/migrate_core_cards/20190502130029_add_shark_and_help_desk_role.rb +4 -5
- data/db/migrate_core_cards/20190618110446_add_dropdown_divider.rb +1 -1
- data/db/migrate_core_cards/20190710090209_homepage_tweaks.rb +17 -0
- data/db/migrate_core_cards/20190820155833_update_cardtype_type_structure.rb +7 -0
- data/db/migrate_core_cards/20190822093633_move_help_text_to_code.rb +38 -0
- data/db/migrate_core_cards/20190823220018_cleanup_for_decko_1_0.rb +21 -0
- data/db/migrate_core_cards/20190826132738_add_more_guides.rb +7 -0
- data/db/migrate_core_cards/20190829093961_cardtype_grouping.rb +16 -0
- data/db/migrate_core_cards/20190829205148_remove_add_help.rb +14 -0
- data/db/migrate_core_cards/20190830131820_setting_settings_aside.rb +17 -0
- data/db/migrate_core_cards/20190902161223_add_style_media.rb +7 -0
- data/db/migrate_core_cards/20190902193208_input_type.rb +22 -0
- data/db/migrate_core_cards/20190904174403_token_upgrade.rb +14 -0
- data/db/migrate_core_cards/20190909104250_add_cardtype_input_types.rb +10 -0
- data/db/migrate_core_cards/20190918200115_ensure_description_card.rb +13 -0
- data/db/migrate_core_cards/data/cards.yml +12 -8
- data/db/migrate_core_cards/data/cards/Xaccount +22 -0
- data/db/migrate_core_cards/data/cards/Xgetting_started +5 -5
- data/db/migrate_core_cards/data/cards/{Xgetting_started-link → Xgetting_started_link} +0 -0
- data/db/migrate_core_cards/data/cards/Xmain_menu +1 -1
- data/db/migrate_core_cards/data/cards/Xstructure-Xright-Xguide +12 -0
- data/db/migrate_core_cards/data/cards/administrator-dashboard +5 -0
- data/db/migrate_core_cards/data/cards/cardtype-Xtype-Xguide +24 -0
- data/db/migrate_core_cards/data/cards/cardtype-Xtype-Xstructure +3 -3
- data/db/migrate_core_cards/data/cards/shark-dashboard +2 -2
- data/db/migrate_core_cards/data/mailer/password_reset_email.html +6 -3
- data/db/migrate_core_cards/data/mailer/password_reset_email.txt +1 -1
- data/db/migrate_core_cards/data/mailer/verification_email.html +5 -2
- data/db/migrate_core_cards/data/mailer/verification_email.txt +2 -1
- data/db/seed/README.md +1 -1
- data/db/seed/new/card_actions.yml +2118 -2534
- data/db/seed/new/card_acts.yml +2 -2
- data/db/seed/new/card_references.yml +2326 -2466
- data/db/seed/new/cards.yml +2654 -3713
- data/db/seed/new/schema_migrations_core_cards.yml +77 -39
- data/db/seed/test/fixtures/card_actions.yml +3225 -3681
- data/db/seed/test/fixtures/card_acts.yml +503 -509
- data/db/seed/test/fixtures/card_changes.yml +66 -66
- data/db/seed/test/fixtures/card_references.yml +3135 -3275
- data/db/seed/test/fixtures/cards.yml +4187 -5516
- data/db/seed/test/fixtures/schema_migrations_core_cards.yml +77 -39
- data/db/{seed/test/seed.rb → test_seed.rb} +13 -11
- data/lib/card/auth.rb +1 -0
- data/lib/card/auth/current.rb +25 -27
- data/lib/card/auth/setup.rb +13 -12
- data/lib/card/auth/token.rb +38 -0
- data/lib/card/content.rb +34 -7
- data/lib/card/content/clean.rb +2 -1
- data/lib/card/content/truncate.rb +2 -0
- data/lib/card/env/success.rb +1 -14
- data/lib/card/error.rb +1 -0
- data/lib/card/format/content.rb +2 -2
- data/lib/card/format/error.rb +1 -1
- data/lib/card/format/nest.rb +1 -1
- data/lib/card/format/nesting.rb +2 -2
- data/lib/card/format/nesting/mode.rb +15 -15
- data/lib/card/mod/loader.rb +5 -0
- data/lib/card/model/save_helper.rb +2 -0
- data/lib/card/query.rb +1 -0
- data/lib/card/query/card_query/reference_attributes.rb +4 -2
- data/lib/card/seed_consts.rb +1 -1
- data/lib/card/set/format/abstract_format.rb +3 -5
- data/lib/card/set/format/abstract_format/view_opts.rb +1 -1
- data/lib/card/set/required_field.rb +8 -3
- data/lib/card/set_pattern.rb +10 -0
- data/lib/card/view/cache/stub.rb +3 -20
- data/lib/card/view/options.rb +4 -3
- data/lib/card/view/options/voo_api.rb +1 -1
- data/lib/cardio.rb +7 -1
- data/mod/Modfile +1 -0
- data/mod/account/set/abstract/account_field.rb +15 -0
- data/mod/account/set/abstract/accounted.rb +15 -0
- data/mod/account/set/all/account.rb +0 -4
- data/mod/account/set/right/account.rb +23 -151
- data/mod/account/set/right/account/events.rb +98 -0
- data/mod/account/set/right/account/views.rb +65 -0
- data/mod/account/set/right/api_key.rb +48 -0
- data/mod/account/set/right/email.rb +2 -2
- data/mod/account/set/right/password.rb +6 -9
- data/mod/account/set/right/salt.rb +5 -1
- data/mod/account/set/right/status.rb +10 -1
- data/mod/account/set/self/signin.rb +3 -3
- data/mod/account/set/type/role.rb +4 -0
- data/mod/account/set/type/signup.rb +31 -158
- data/mod/account/{template → set}/type/signup/core.haml +0 -0
- data/mod/account/set/type/signup/views.rb +93 -0
- data/mod/account/set/type/user.rb +16 -27
- data/mod/account/set/type/user/setup_help.haml +10 -0
- data/mod/account/spec/set/all/account_spec.rb +84 -98
- data/mod/account/spec/set/right/account_spec.rb +40 -33
- data/mod/account/spec/set/self/signin_spec.rb +2 -2
- data/mod/account/spec/set/type/signup_spec.rb +40 -78
- data/mod/ace_editor/db/migrate_core_cards/{20160805112548_delete_ace_help_card.rb → 20180805112548_delete_ace_help_card.rb} +1 -1
- data/mod/admin/set/self/debugger.rb +3 -0
- data/mod/admin/set/self/trash.rb +1 -1
- data/mod/basic_formats/set/all/all_css.rb +1 -1
- data/mod/basic_formats/set/all/all_csv.rb +1 -1
- data/mod/basic_formats/set/all/base.rb +19 -60
- data/mod/basic_formats/set/self/head.rb +1 -1
- data/mod/basic_types/set/type/html.rb +7 -3
- data/mod/basic_types/set/type/json.rb +1 -1
- data/mod/basic_types/set/type/plain_text.rb +1 -1
- data/mod/{standard → basic_types}/spec/set/type/html_spec.rb +6 -6
- data/mod/basic_types/spec/set/type/plain_text_spec.rb +7 -2
- data/mod/bootstrap/db/migrate_core_cards/20170719163733_update_bootswatch_themes_to_4_beta.rb +3 -3
- data/mod/bootstrap/db/migrate_core_cards/20180423160231_migrate_customized_bootstrap_skin.rb +2 -2
- data/mod/bootstrap/db/migrate_core_cards/20180423170283_add_type_bootswatch_skin.rb +1 -1
- data/mod/bootstrap/db/migrate_core_cards/lib/skin.rb +1 -1
- data/mod/bootstrap/lib/javascript/script_load_select2.js.coffee +26 -18
- data/mod/bootstrap/lib/stylesheets/style_bootstrap_cards.scss +18 -3
- data/mod/bootstrap/set/abstract/bootswatch_theme/html_views.rb +1 -1
- data/mod/bootstrap/set/all/bootstrap/helper.rb +9 -4
- data/mod/bootstrap/set/type/customized_bootswatch_skin.rb +1 -1
- data/mod/bootstrap/set/type_plus_right/customized_bootswatch_skin/colors.rb +1 -1
- data/mod/bootstrap/set/type_plus_right/customized_bootswatch_skin/colors/{editor.haml → input.haml} +0 -0
- data/mod/bootstrap/spec/set/all/bootstrap/form_spec.rb +2 -2
- data/mod/carrierwave/set/self/favicon.rb +5 -0
- data/mod/carrierwave/set/self/new_file.rb +1 -1
- data/mod/carrierwave/set/self/new_image.rb +1 -1
- data/mod/carrierwave/set/type/file.rb +1 -1
- data/mod/carrierwave/set/type/image.rb +2 -2
- data/mod/carrierwave/set/type/image/html_views.rb +0 -35
- data/mod/carrierwave/spec/set/type/image_spec.rb +1 -1
- data/mod/core/chunk/link.rb +4 -2
- data/mod/core/chunk/view_stub.rb +5 -4
- data/mod/core/set/abstract/code_file.rb +1 -1
- data/mod/core/set/all/codename.rb +2 -1
- data/mod/core/set/all/content.rb +59 -0
- data/mod/core/set/all/event_conditions.rb +17 -2
- data/mod/core/set/all/location_history.rb +1 -1
- data/mod/core/set/all/name.rb +1 -1
- data/mod/core/set/all/permissions.rb +6 -36
- data/mod/core/set/all/references.rb +9 -2
- data/mod/core/set/all/rules.rb +0 -5
- data/mod/core/set_pattern/03_type.rb +4 -0
- data/mod/core/set_pattern/07_right.rb +4 -0
- data/mod/core/set_pattern/08_type_plus_right.rb +4 -0
- data/mod/core/set_pattern/09_self.rb +4 -0
- data/mod/core/spec/chunk/link_spec.rb +6 -0
- data/mod/core/spec/chunk/nest_spec.rb +2 -2
- data/mod/core/spec/set/all/permissions_spec.rb +0 -10
- data/mod/core/spec/set/all/rules_spec.rb +6 -16
- data/mod/date/set/self/datepicker.rb +6 -0
- data/mod/date/set/type/date.rb +1 -1
- data/mod/date/spec/set/type/date_spec.rb +1 -1
- data/mod/edit/set/all/bridge/account_section.rb +16 -0
- data/mod/edit/set/all/bridge/bridge_pills.rb +47 -0
- data/mod/edit/set/all/bridge/related_section.rb +34 -0
- data/mod/edit/set/all/bridge/tab_views.rb +9 -40
- data/mod/edit/set/all/bridge/tab_visibility.rb +2 -2
- data/mod/edit/set/all/edit_content.rb +3 -3
- data/mod/edit/set/all/edit_inline.rb +15 -4
- data/mod/edit/set/all/edit_name.rb +5 -7
- data/mod/edit/set/all/edit_type.rb +25 -23
- data/mod/edit/set/all/editing.rb +5 -1
- data/mod/edit/set/all/editor.rb +28 -15
- data/mod/edit/set/all/form.rb +38 -17
- data/mod/edit/set/all/form_buttons.rb +11 -2
- data/mod/edit/set/all/formgroup.rb +5 -5
- data/mod/edit/set/all/nest_editor.rb +20 -4
- data/mod/edit/set/all/nest_editor/_help.haml +7 -0
- data/mod/edit/set/all/nest_editor/nest_editor.haml +3 -2
- data/mod/edit/set/all/new.rb +40 -23
- data/mod/edit/set/all/overlay_guide.haml +7 -0
- data/mod/edit/set/all/overlay_guide.rb +9 -0
- data/mod/edit/set/all/template_nest.rb +42 -0
- data/mod/edit/set/type/list.rb +15 -0
- data/mod/edit/set/type/plain_text.rb +13 -0
- data/mod/edit/set/type/pointer.rb +11 -0
- data/mod/edit/spec/set/all/bridge/tab_views_spec.rb +1 -1
- data/mod/email/set/all/email_html.rb +2 -2
- data/mod/email/set/all/email_text.rb +2 -2
- data/mod/follow/lib/card/follower_stash.rb +1 -1
- data/mod/follow/set/all/follow/followed_by.rb +1 -1
- data/mod/follow/set/all/notify/base_views.rb +3 -3
- data/mod/follow/set/right/following.rb +1 -1
- data/mod/follow/set/self/follow_defaults.rb +1 -1
- data/mod/follow/set/type/cardtype.rb +6 -0
- data/mod/follow/set/type_plus_right/user/follow.rb +1 -1
- data/mod/history/lib/card/act/act_renderer.rb +1 -1
- data/mod/history/lib/card/action.rb +2 -1
- data/mod/history/set/all/history_bridge.rb +0 -1
- data/mod/item/set/all/bar.rb +15 -7
- data/mod/machines/file/all_script_machine_output/file.js +38245 -69
- data/mod/machines/file/all_style_machine_output/file.css +4 -4
- data/mod/machines/file/script_html5shiv_printshiv_machine_output/file.js +1 -1
- data/mod/machines/lib/javascript/decko/bridge.js.coffee +4 -0
- data/mod/machines/lib/javascript/decko/card_menu.js.coffee +11 -0
- data/mod/machines/lib/javascript/decko/name_editor.js.coffee +1 -1
- data/mod/machines/lib/javascript/decko/nest_editor.js.coffee +3 -1
- data/mod/machines/lib/javascript/decko/nest_editor_name.js.coffee +29 -6
- data/mod/machines/lib/javascript/decko/overlay.js.coffee +3 -2
- data/mod/machines/lib/javascript/decko/slot.js.coffee +12 -2
- data/mod/machines/lib/stylesheets/style_cards.scss +43 -53
- data/mod/machines/lib/stylesheets/style_jquery_ui_smoothness.css +13 -13
- data/mod/machines/set/abstract/script.rb +1 -1
- data/mod/machines/set/type/css.rb +1 -1
- data/mod/media/lib/stylesheets/style_image_box.scss +79 -0
- data/mod/{utility → media}/set/abstract/media.rb +0 -0
- data/mod/{utility → media}/set/abstract/media/media_snippet.haml +0 -0
- data/mod/media/set/self/style_media.rb +6 -0
- data/mod/media/set/type/image.rb +38 -0
- data/mod/{utility → media}/spec/set/abstract/media_spec.rb +0 -0
- data/mod/navbar/set/right/enabled_roles.rb +1 -1
- data/mod/pointer/lib/javascript/script_pointer_config.js.coffee +13 -0
- data/mod/pointer/lib/javascript/script_pointer_list_editor.js.coffee +7 -2
- data/mod/pointer/set/abstract/02_pointer/html_views.rb +15 -6
- data/mod/pointer/set/abstract/02_pointer/html_views/checkbox_input.haml +1 -2
- data/mod/pointer/set/abstract/02_pointer/html_views/list_input.haml +1 -2
- data/mod/pointer/set/abstract/02_pointer/html_views/list_item.haml +2 -0
- data/mod/pointer/set/abstract/02_pointer/html_views/radio_input.haml +1 -2
- data/mod/pointer/set/abstract/02_pointer/options_api.rb +6 -13
- data/mod/pointer/set/right/{options.rb → content_options.rb} +0 -0
- data/mod/pointer/set/type/link_list.rb +23 -6
- data/mod/pointer/set/type/link_list/link_list_input.haml +24 -0
- data/mod/pointer/set/type/mirrored_list.rb +1 -1
- data/mod/pointer/spec/set/abstract/pointer/html_views_spec.rb +20 -18
- data/mod/pointer/spec/set/abstract/pointer/options_api_spec.rb +2 -1
- data/mod/pointer/spec/set/self/input_options_spec.rb +1 -1
- data/mod/rules/set/right/self.rb +3 -0
- data/mod/rules/set/rule/bar_view.rb +88 -0
- data/mod/rules/set/rule/bridge_rules_editor.rb +5 -10
- data/mod/rules/set/rule/editor.rb +40 -113
- data/mod/rules/set/rule/html_views.rb +13 -0
- data/mod/rules/set/rule/quick_editor.rb +39 -0
- data/mod/rules/set/rule/{editor → quick_editor}/quick_edit.haml +0 -0
- data/mod/rules/set/rule/{editor → quick_editor}/set_info.haml +1 -1
- data/mod/rules/set/rule/rule_form/buttons.rb +3 -1
- data/mod/rules/set/rule/rule_form/form_elements.rb +2 -2
- data/mod/rules/set/rule/rule_form/rule_set_radio.rb +3 -6
- data/mod/rules/set/rule/rule_form/set_selection.rb +3 -10
- data/mod/rules/set/rule/rules.rb +10 -1
- data/mod/rules/set/type/set.rb +37 -20
- data/mod/rules/set/type/set/html_views.rb +17 -35
- data/mod/rules/set/type/set/html_views/group_panel.haml +1 -1
- data/mod/rules/set/type/set/html_views/rule_lists.rb +42 -0
- data/mod/rules/set/type/set/html_views/template.rb +1 -32
- data/mod/rules/set/type/set/rules_filter.rb +24 -10
- data/mod/rules/set/type/set/setting_lists.rb +17 -24
- data/mod/rules/spec/set/rule/bar_view_spec.rb +15 -0
- data/mod/rules/spec/set/rule/editor_spec.rb +15 -1
- data/mod/rules/spec/set/type/set/html_views_spec.rb +0 -13
- data/mod/rules/spec/set/type/set/setting_lists_spec.rb +17 -0
- data/mod/rules/spec/set/type/set_spec.rb +3 -8
- data/mod/search/set/abstract/03_filter/form_helper.rb +9 -7
- data/mod/search/set/abstract/search/views.rb +2 -2
- data/mod/search/set/right/children.rb +4 -0
- data/mod/search/set/right/created.rb +3 -0
- data/mod/search/set/right/edited.rb +3 -0
- data/mod/search/set/right/editors.rb +3 -0
- data/mod/search/set/right/follow.rb +3 -0
- data/mod/search/set/right/linked_to_by.rb +3 -0
- data/mod/search/set/right/links_to.rb +3 -0
- data/mod/search/set/right/mates.rb +3 -0
- data/mod/search/set/right/nested_by.rb +3 -0
- data/mod/search/set/right/nests.rb +3 -0
- data/mod/search/set/right/referred_to_by.rb +3 -0
- data/mod/search/set/right/refers_to.rb +3 -0
- data/mod/search/set/self/search.rb +1 -1
- data/mod/search/set/type/search_type.rb +6 -5
- data/mod/settings/lib/card/setting.rb +17 -4
- data/mod/settings/set/abstract/permission.rb +6 -2
- data/mod/settings/set/all/supports_content_options.rb +7 -0
- data/mod/settings/set/right/content_option_view.rb +10 -0
- data/mod/settings/set/right/content_options.rb +18 -0
- data/mod/settings/set/right/default.rb +18 -2
- data/mod/settings/set/right/help.rb +2 -1
- data/mod/settings/set/right/input_type.rb +35 -0
- data/mod/settings/set/right/script.rb +6 -0
- data/mod/settings/set/right/structure.rb +7 -1
- data/mod/settings/set/right/style.rb +2 -2
- data/mod/settings/set/right/style/{editor.haml → input.haml} +0 -0
- data/mod/settings/set/self/autoname.rb +3 -1
- data/mod/settings/set/self/captcha.rb +4 -1
- data/mod/settings/set/self/content_option_view.rb +10 -0
- data/mod/settings/set/self/content_options.rb +10 -0
- data/mod/settings/set/self/create.rb +2 -1
- data/mod/settings/set/self/default.rb +1 -1
- data/mod/settings/set/self/delete.rb +2 -1
- data/mod/settings/set/self/guide.rb +1 -1
- data/mod/settings/set/self/head.rb +3 -1
- data/mod/settings/set/self/help.rb +3 -1
- data/mod/settings/set/self/input_type.rb +13 -0
- data/mod/settings/set/self/layout.rb +3 -1
- data/mod/settings/set/self/on_create.rb +2 -1
- data/mod/settings/set/self/on_delete.rb +2 -1
- data/mod/settings/set/self/on_update.rb +2 -1
- data/mod/settings/set/self/read.rb +2 -1
- data/mod/settings/set/self/structure.rb +3 -1
- data/mod/settings/set/self/style.rb +3 -1
- data/mod/settings/set/self/table_of_contents.rb +4 -1
- data/mod/settings/set/self/thanks.rb +3 -1
- data/mod/settings/set/self/update.rb +2 -1
- data/mod/settings/set/type/setting.rb +15 -37
- data/mod/settings/spec/set/right/comment_spec.rb +0 -27
- data/mod/settings/spec/set/right/create_spec.rb +1 -1
- data/mod/settings/spec/set/right/structure_spec.rb +13 -10
- data/mod/settings/spec/set/type/setting_spec.rb +1 -8
- data/mod/solid_cache/set/right/solid_cache.rb +3 -3
- data/mod/standard/set/all/comment.rb +1 -1
- data/mod/standard/set/all/error.rb +2 -2
- data/mod/standard/set/all/path.rb +7 -7
- data/mod/standard/set/all/rich_html/content.rb +41 -11
- data/mod/standard/set/all/rich_html/error.rb +14 -22
- data/mod/standard/set/all/rich_html/html_views/guide.rb +1 -1
- data/mod/standard/set/all/rich_html/html_views/help.rb +19 -7
- data/mod/standard/set/all/rich_html/html_views/info.rb +1 -1
- data/mod/standard/set/all/rich_html/menu.rb +50 -2
- data/mod/standard/set/all/rich_html/overlay.rb +23 -1
- data/mod/standard/set/all/rich_html/title.rb +3 -3
- data/mod/standard/set/right/discussion.rb +8 -2
- data/mod/standard/set/right/head.rb +4 -0
- data/mod/standard/set/right/type_plus_right.rb +4 -0
- data/mod/standard/set/self/cardtype.rb +42 -0
- data/mod/standard/set/self/sidebar.rb +5 -0
- data/mod/standard/set/type/basic.rb +1 -1
- data/mod/standard/set/type/cardtype.rb +25 -11
- data/mod/standard/set/type/number.rb +1 -1
- data/mod/standard/set/type/phrase.rb +1 -1
- data/mod/standard/set/type/toggle.rb +9 -1
- data/mod/standard/set/type/uri.rb +1 -1
- data/mod/standard/spec/set/all/error_spec.rb +1 -1
- data/mod/standard/spec/set/type/cardtype_spec.rb +4 -3
- data/mod/standard/spec/set/type/number_spec.rb +1 -1
- data/mod/standard/spec/set/type/phrase_spec.rb +1 -1
- data/mod/standard/spec/set/type/toggle_spec.rb +3 -4
- data/mod/standard/spec/set/type/uri_spec.rb +1 -1
- data/mod/tinymce_editor/set/self/tiny_mce.rb +7 -0
- metadata +116 -52
- data/db/migrate_core_cards/20190710090207_homepage_tweaks.rb +0 -12
- data/db/migrate_core_cards/data/cards/eagle-description +0 -1
- data/mod/account/set/right/token.rb +0 -55
- data/mod/account/spec/set/right/token_spec.rb +0 -23
- data/mod/bootstrap/set/abstract/bootswatch_theme/thumbnail.haml +0 -10
- data/mod/rules/set/rule/table.rb +0 -27
- data/mod/rules/set/rule/table_row.rb +0 -63
- data/mod/rules/set/type/set/html_views/nest_rules.rb +0 -14
- data/mod/rules/set/type/set/html_views/rules_bridge.rb +0 -21
- data/mod/rules/set/type/set/html_views/rules_table.haml +0 -11
- data/mod/rules/set/type/set/html_views/template/template_editor.haml +0 -6
- data/mod/rules/spec/set/rule/table_row_spec.rb +0 -9
- data/mod/rules/spec/set/rule/table_spec.rb +0 -15
- data/mod/settings/set/right/add_help.rb +0 -1
- data/mod/settings/set/self/accountable.rb +0 -3
- data/mod/settings/set/self/add_help.rb +0 -2
- data/mod/settings/set/self/input.rb +0 -3
- data/mod/settings/set/self/options.rb +0 -4
- data/mod/settings/set/self/options_label.rb +0 -4
- data/mod/settings/spec/set/right/add_help_spec.rb +0 -5
@@ -0,0 +1,15 @@
|
|
1
|
+
def account
|
2
|
+
fetch trait: :account, new: {}
|
3
|
+
end
|
4
|
+
|
5
|
+
def default_account_status
|
6
|
+
"active"
|
7
|
+
end
|
8
|
+
|
9
|
+
format :html do
|
10
|
+
def account_formgroups
|
11
|
+
Auth.as_bot do
|
12
|
+
subformat(card.account)._render :content_formgroups, structure: true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,140 +1,32 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
|
3
|
-
include All::Permissions::Accounts
|
4
|
-
|
5
3
|
card_accessor :email
|
6
4
|
card_accessor :password
|
7
5
|
card_accessor :salt
|
8
6
|
card_accessor :status
|
9
|
-
card_accessor :
|
10
|
-
|
11
|
-
#### ON CREATE
|
12
|
-
|
13
|
-
# legal to add +*account card
|
14
|
-
event :validate_accountability, :prepare_to_validate, on: :create do
|
15
|
-
errors.add :content, tr(:error_not_allowed) unless left&.accountable?
|
16
|
-
end
|
7
|
+
card_accessor :api_key
|
17
8
|
|
18
|
-
|
19
|
-
after: :validate_accountability, on: :create do
|
20
|
-
errors.add :email, "required" unless subfield(:email)
|
21
|
-
end
|
22
|
-
|
23
|
-
event :set_default_salt, :prepare_to_validate, on: :create do
|
24
|
-
salt = Digest::SHA1.hexdigest "--#{Time.zone.now}--"
|
25
|
-
Env[:salt] = salt # HACK!!! need viable mechanism to get this to password
|
26
|
-
add_subfield :salt, content: salt
|
27
|
-
end
|
28
|
-
|
29
|
-
event :set_default_status, :prepare_to_validate, on: :create do
|
30
|
-
default_status = left&.try(:default_account_status) || "active"
|
31
|
-
add_subfield :status, content: default_status
|
32
|
-
end
|
33
|
-
|
34
|
-
event :generate_confirmation_token,
|
35
|
-
:prepare_to_store, on: :create, when: :can_approve? do
|
36
|
-
add_subfield :token, content: generate_token
|
37
|
-
end
|
38
|
-
|
39
|
-
event :send_account_verification_email, :integrate,
|
40
|
-
on: :create, when: proc { |c| c.token.present? } do
|
41
|
-
Card[:verification_email].deliver self, to: email
|
42
|
-
end
|
43
|
-
|
44
|
-
# ON UPDATE
|
45
|
-
|
46
|
-
# reset password emails contain a link to update the +*account card
|
47
|
-
# and trigger this event
|
48
|
-
event :reset_password, :prepare_to_validate, on: :update, trigger: :required do
|
49
|
-
reset_password_with_token Env.params[:token]
|
50
|
-
end
|
51
|
-
|
52
|
-
# STANDALONE EVENTS
|
53
|
-
# only triggered when called directly (as methods)
|
54
|
-
|
55
|
-
event :reset_token do
|
56
|
-
token = generate_token
|
57
|
-
Auth.as_bot { token_card.update! content: token }
|
58
|
-
token
|
59
|
-
end
|
60
|
-
|
61
|
-
event :send_welcome_email do
|
62
|
-
welcome = Card[:welcome_email]
|
63
|
-
welcome.deliver self, to: email if welcome&.type_code == :email_template
|
64
|
-
end
|
65
|
-
|
66
|
-
event :send_reset_password_token do
|
67
|
-
reset_token
|
68
|
-
Card[:password_reset_email].deliver self, to: email
|
69
|
-
end
|
70
|
-
|
71
|
-
def active?
|
72
|
-
status == "active"
|
73
|
-
end
|
9
|
+
require_field :email
|
74
10
|
|
75
|
-
def
|
76
|
-
|
11
|
+
def accounted
|
12
|
+
left
|
77
13
|
end
|
78
14
|
|
79
|
-
def
|
80
|
-
|
81
|
-
end
|
82
|
-
|
83
|
-
def pending?
|
84
|
-
status == "pending"
|
85
|
-
end
|
86
|
-
|
87
|
-
def validate_token! test_token
|
88
|
-
token_card.validate! test_token
|
89
|
-
end
|
90
|
-
|
91
|
-
def reset_password_with_token token
|
92
|
-
aborting do
|
93
|
-
if !token
|
94
|
-
errors.add :token, "is required"
|
95
|
-
elsif !validate_token!(token)
|
96
|
-
# FIXME: This should be an error.
|
97
|
-
# However, an error abort will trigger a rollback, so the
|
98
|
-
# token reset won't work. That may be an argument for
|
99
|
-
# handling the token update in a separate request?
|
100
|
-
success << reset_password_try_again
|
101
|
-
else
|
102
|
-
success << reset_password_success
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
def refreshed_token
|
108
|
-
if token_card.id
|
109
|
-
token_card.refresh(true).db_content # TODO: explain why refresh is needed
|
110
|
-
else # eg when viewing email template
|
111
|
-
"[token]"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
def can_approve?
|
116
|
-
Card.new(type_id: Card.default_accounted_type_id).ok? :create
|
15
|
+
def accounted_id
|
16
|
+
left_id
|
117
17
|
end
|
118
18
|
|
119
19
|
def ok_to_read
|
120
20
|
own_account? ? true : super
|
121
21
|
end
|
122
22
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
{ id: name, view: :edit }
|
127
|
-
end
|
23
|
+
# allow account owner to update account field content
|
24
|
+
def ok_to_update
|
25
|
+
return true if own_account? && !name_changed? && !type_id_changed?
|
128
26
|
|
129
|
-
|
130
|
-
message = tr :sorry_email_reset, error_msg: token_card.errors.first.last
|
131
|
-
send_reset_password_token
|
132
|
-
{ id: "_self", view: "message", message: message }
|
27
|
+
super
|
133
28
|
end
|
134
29
|
|
135
|
-
# FIXME: explain or remove.
|
136
|
-
def edit_password_success_args; end
|
137
|
-
|
138
30
|
def changes_visible? act
|
139
31
|
act.actions_affecting(act.card).each do |action|
|
140
32
|
return true if action.card.ok? :read
|
@@ -142,45 +34,25 @@ def changes_visible? act
|
|
142
34
|
false
|
143
35
|
end
|
144
36
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
view :verify_days, cache: :never do
|
151
|
-
(Card.config.token_expiry / 1.day).to_s
|
152
|
-
end
|
153
|
-
|
154
|
-
view :reset_password_url do
|
155
|
-
card_url path(token_path_opts.merge(card: { trigger: :reset_password }))
|
37
|
+
def send_account_email email_template
|
38
|
+
ecard = Card[email_template]
|
39
|
+
unless ecard&.type_id == EmailTemplateID
|
40
|
+
raise Card::Error, "invalid email template: #{email_template}"
|
156
41
|
end
|
157
42
|
|
158
|
-
|
159
|
-
|
160
|
-
end
|
43
|
+
ecard.deliver self, to: email
|
44
|
+
end
|
161
45
|
|
162
|
-
|
163
|
-
|
164
|
-
end
|
46
|
+
def validate_api_key! api_key
|
47
|
+
api_key_card.validate! api_key
|
165
48
|
end
|
166
49
|
|
167
|
-
|
168
|
-
|
169
|
-
# FIXME: use field_nest instead of parsing content
|
170
|
-
# Problem: when you do that then the fields are missing in the sign up form:
|
171
|
-
# output( [field_nest(:email, view: :titled, title: "email"),
|
172
|
-
# field_nest(:password, view: :titled, title: "password")])
|
173
|
-
%({{+#{:email.cardname}|labeled;title:email;edit:inline}}
|
174
|
-
{{+#{:password.cardname}|labeled;title:password;edit:inline}})
|
175
|
-
end
|
50
|
+
def method_missing method, *args
|
51
|
+
super unless args.empty? && (matches = method.match(/^(?<status>.*)\?$/))
|
176
52
|
|
177
|
-
|
178
|
-
voo.edit_structure = [[:email, "email"], [:password, "password"]]
|
179
|
-
end
|
53
|
+
status == matches[:status]
|
180
54
|
end
|
181
55
|
|
182
|
-
|
183
|
-
|
184
|
-
super context, fields.reverse_merge(to: card.email)
|
185
|
-
end
|
56
|
+
def respond_to_missing? method, _include_private=false
|
57
|
+
method.match?(/\?/) ? true : super
|
186
58
|
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
#### ON CREATE
|
2
|
+
|
3
|
+
event :set_default_salt, :prepare_to_validate, on: :create do
|
4
|
+
add_subfield(:salt).generate
|
5
|
+
end
|
6
|
+
|
7
|
+
event :set_default_status, :prepare_to_validate, on: :create do
|
8
|
+
add_subfield :status, content: (accounted&.try(:default_account_status) || "active")
|
9
|
+
end
|
10
|
+
|
11
|
+
# ON UPDATE
|
12
|
+
|
13
|
+
# reset password emails contain a link to update the +*account card
|
14
|
+
# and trigger this event
|
15
|
+
event :reset_password, :prepare_to_validate, on: :update, trigger: :required do
|
16
|
+
verifying_token :reset_password_success, :reset_password_failure
|
17
|
+
end
|
18
|
+
|
19
|
+
event :verify_and_activate, :prepare_to_validate, on: :update, trigger: :required do
|
20
|
+
activatable do
|
21
|
+
verifying_token :verify_and_activate_success, :verify_and_activate_failure
|
22
|
+
add_subcard(accounted)&.try :activate_accounted
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
event :password_redirect, :finalize, on: :update, when: :password_redirect? do
|
27
|
+
success << { id: name, view: "edit" }
|
28
|
+
end
|
29
|
+
|
30
|
+
# INTEGRATION
|
31
|
+
|
32
|
+
%i[password_reset_email verification_email welcome_email].each do |email|
|
33
|
+
event "send_#{email}".to_sym, :integrate, trigger: :required do
|
34
|
+
send_account_email email
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
## EVENT HELPERS
|
39
|
+
|
40
|
+
def activatable
|
41
|
+
abort :failure, "no field manipulation mid-activation" if subcards.present?
|
42
|
+
# above is necessary because activation uses super user (Decko Bot),
|
43
|
+
# so allowing subcards would be unsafe
|
44
|
+
yield
|
45
|
+
end
|
46
|
+
|
47
|
+
# note: this only works in the context of an action.
|
48
|
+
# if run independently, it will not activate an account
|
49
|
+
event :activate_account do
|
50
|
+
add_subfield :status, content: "active"
|
51
|
+
trigger_event! :send_welcome_email
|
52
|
+
end
|
53
|
+
|
54
|
+
def verifying_token success, failure
|
55
|
+
requiring_token do |token|
|
56
|
+
result = Auth::Token.decode token
|
57
|
+
if result.is_a?(String)
|
58
|
+
aborting { send failure, result }
|
59
|
+
else
|
60
|
+
send success
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def requiring_token
|
66
|
+
if !(token = Env.params[:token])
|
67
|
+
aborting { errors.add :token, "is required" }
|
68
|
+
else
|
69
|
+
yield token
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def password_redirect?
|
74
|
+
Auth.current_id == accounted_id && password.blank?
|
75
|
+
end
|
76
|
+
|
77
|
+
def verify_and_activate_success
|
78
|
+
Auth.signin accounted_id
|
79
|
+
Auth.as_bot # use admin permissions for rest of action
|
80
|
+
activate_account
|
81
|
+
success << ""
|
82
|
+
end
|
83
|
+
|
84
|
+
def verify_and_activate_failure error_message
|
85
|
+
send_verification_email
|
86
|
+
errors.add "Sorry, #{error_message}. Please check your email for a new activation link."
|
87
|
+
end
|
88
|
+
|
89
|
+
def reset_password_success
|
90
|
+
Auth.signin accounted_id
|
91
|
+
success << { id: name, view: :edit }
|
92
|
+
abort :success
|
93
|
+
end
|
94
|
+
|
95
|
+
def reset_password_failure error_message
|
96
|
+
Auth.as_bot { send_password_reset_email }
|
97
|
+
errors.add tr(:sorry_email_reset, error_msg: error_message)
|
98
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
format do
|
2
|
+
view :verify_url, cache: :never do
|
3
|
+
raise Error::PermissionDenied unless card.ok?(:create) || card.action
|
4
|
+
|
5
|
+
token_url :verify_and_activate, anonymous: true
|
6
|
+
end
|
7
|
+
|
8
|
+
view :reset_password_url do
|
9
|
+
raise Error::PermissionDenied unless card.password_card.ok? :update
|
10
|
+
|
11
|
+
token_url :reset_password
|
12
|
+
end
|
13
|
+
|
14
|
+
view :token_expiry do
|
15
|
+
"(#{token_expiry_sentence}"
|
16
|
+
end
|
17
|
+
|
18
|
+
view :token_days do
|
19
|
+
Card.config.token_expiry / 1.day
|
20
|
+
end
|
21
|
+
|
22
|
+
# DEPRECATED
|
23
|
+
view :verify_days, :token_days
|
24
|
+
view :reset_password_days, :token_days
|
25
|
+
|
26
|
+
def token_url trigger, extra_payload={}
|
27
|
+
card_url path(action: :update,
|
28
|
+
card: { trigger: trigger },
|
29
|
+
token: new_token(extra_payload))
|
30
|
+
end
|
31
|
+
|
32
|
+
def token_expiry_sentence
|
33
|
+
"Link will expire in #{render_token_days} days"
|
34
|
+
end
|
35
|
+
|
36
|
+
def new_token extra_payload
|
37
|
+
Auth::Token.encode card.accounted_id, extra_payload
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
format :html do
|
42
|
+
view :core do
|
43
|
+
[account_field_nest(:email, "email"),
|
44
|
+
account_field_nest(:password, "password")]
|
45
|
+
end
|
46
|
+
|
47
|
+
def account_field_nest field, title
|
48
|
+
field_nest field, title: title, view: :labeled
|
49
|
+
# edit: :inline, hide: [:help_link, :bridge_link]
|
50
|
+
end
|
51
|
+
|
52
|
+
before :content_formgroups do
|
53
|
+
voo.edit_structure = [[:email, "email"], [:password, "password"]]
|
54
|
+
end
|
55
|
+
|
56
|
+
view :token_expiry do
|
57
|
+
"<p><em>#{token_expiry_sentence}</em></p>"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
format :email do
|
62
|
+
def mail context, fields
|
63
|
+
super context, fields.reverse_merge(to: card.email)
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
include_set Abstract::AccountField
|
2
|
+
|
3
|
+
# DURATIONS = "second|minute|hour|day|week|month|year".freeze
|
4
|
+
|
5
|
+
def history?
|
6
|
+
false
|
7
|
+
end
|
8
|
+
|
9
|
+
view :raw do
|
10
|
+
tr :private_data
|
11
|
+
end
|
12
|
+
|
13
|
+
def validate! api_key
|
14
|
+
error =
|
15
|
+
case
|
16
|
+
when !real? then [:token_not_found, tr(:error_token_not_found)]
|
17
|
+
# when expired? then [:token_expired, tr(:error_token_expired)]
|
18
|
+
when content != api_key then [:incorrect_token, tr(:error_incorrect_token)]
|
19
|
+
end
|
20
|
+
errors.add(*error) if error
|
21
|
+
error.nil?
|
22
|
+
end
|
23
|
+
|
24
|
+
# def expired?
|
25
|
+
# !permanent? && updated_at <= term.ago
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# def permanent?
|
29
|
+
# term == "permanent"
|
30
|
+
# end
|
31
|
+
|
32
|
+
# def term
|
33
|
+
# @term ||=
|
34
|
+
# if expiration.present?
|
35
|
+
# term_from_string expiration
|
36
|
+
# else
|
37
|
+
# Card.config.token_expiry
|
38
|
+
# end
|
39
|
+
# end
|
40
|
+
|
41
|
+
# def term_from_string string
|
42
|
+
# string.strip!
|
43
|
+
# return "permanent" if string == "none"
|
44
|
+
# re_match = /^(\d+)[\.\s]*(#{DURATIONS})s?$/.match(string)
|
45
|
+
# number, unit = re_match.captures if re_match
|
46
|
+
# raise Card::Open::Error, tr(:exception_bad_expiration, example: '2 days') unless unit
|
47
|
+
# number.to_i.send unit
|
48
|
+
# end
|