biovision 0.0.200518.1 → 0.12.211124.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +105 -52
- data/app/assets/images/biovision/icons/back.svg +19 -0
- data/app/assets/images/biovision/icons/create.svg +19 -0
- data/app/assets/images/biovision/icons/destroy.svg +12 -0
- data/app/assets/images/biovision/icons/dropdown.svg +3 -0
- data/app/assets/images/biovision/icons/edit.svg +22 -0
- data/app/assets/images/biovision/icons/gear.svg +11 -0
- data/app/assets/images/biovision/icons/return.svg +25 -0
- data/app/assets/images/biovision/icons/world.svg +11 -0
- data/app/assets/stylesheets/biovision/admin/components/users.scss +20 -0
- data/app/assets/stylesheets/biovision/admin/components.scss +13 -1
- data/app/assets/stylesheets/biovision/admin/layout.scss +27 -12
- data/app/assets/stylesheets/biovision/biovision.scss +105 -26
- data/app/assets/stylesheets/biovision/components/breadcrumbs.scss +13 -0
- data/app/assets/stylesheets/biovision/components/buttons.scss +130 -0
- data/app/assets/stylesheets/biovision/components/filters.scss +39 -0
- data/app/assets/stylesheets/biovision/components/forms.scss +208 -1
- data/app/assets/stylesheets/biovision/components/lists.scss +6 -7
- data/app/assets/stylesheets/biovision/{biovision → components}/messages.scss +9 -0
- data/app/assets/stylesheets/biovision/components/pagination.scss +34 -0
- data/app/assets/stylesheets/biovision/components/quick_search.scss +24 -0
- data/app/assets/stylesheets/biovision/components/simple_image.scss +112 -0
- data/app/assets/stylesheets/biovision/components/toggleable.scss +71 -0
- data/app/assets/stylesheets/biovision/components.scss +7 -0
- data/app/assets/stylesheets/biovision/default.scss +4 -4
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users/dashboard.scss +4 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users/form_tabs.scss +101 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users/profile.scss +77 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users.scss +3 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components.scss +2 -3
- data/app/assets/stylesheets/biovision/themes/default_theme/layout/footer.scss +3 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout/header.scss +12 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout.scss +8 -19
- data/app/assets/stylesheets/biovision/themes/default_theme.scss +0 -1
- data/app/assets/stylesheets/biovision/vars.scss +5 -0
- data/app/controllers/admin/biovision_components_controller.rb +10 -0
- data/app/controllers/admin/components_controller.rb +37 -97
- data/app/controllers/admin/dynamic_blocks_controller.rb +15 -0
- data/app/controllers/admin/dynamic_pages_controller.rb +15 -0
- data/app/controllers/admin/index_controller.rb +8 -2
- data/app/controllers/admin/navigation_groups_controller.rb +45 -0
- data/app/controllers/admin/tokens_controller.rb +15 -0
- data/app/controllers/admin/users_controller.rb +101 -0
- data/app/controllers/admin_controller.rb +2 -8
- data/app/controllers/authentication_controller.rb +6 -34
- data/app/controllers/concerns/authentication.rb +12 -12
- data/app/controllers/concerns/component_stories.rb +22 -0
- data/app/controllers/concerns/crud_entities.rb +140 -0
- data/app/controllers/concerns/entity_priority.rb +10 -0
- data/app/controllers/concerns/my_crud_entities.rb +146 -0
- data/app/controllers/concerns/processed_forms.rb +28 -0
- data/app/controllers/concerns/restricted_access.rb +37 -0
- data/app/controllers/concerns/toggleable_entity.rb +31 -0
- data/app/controllers/contact_controller.rb +49 -0
- data/app/controllers/errors_controller.rb +37 -0
- data/app/controllers/fallback_controller.rb +12 -0
- data/app/controllers/index_controller.rb +1 -0
- data/app/controllers/legal_controller.rb +14 -0
- data/app/controllers/my/components_controller.rb +26 -0
- data/app/controllers/my/confirmations_controller.rb +44 -0
- data/app/controllers/my/index_controller.rb +7 -1
- data/app/controllers/my/profiles_controller.rb +33 -16
- data/app/controllers/oembed_controller.rb +12 -0
- data/app/controllers/profile_controller.rb +14 -0
- data/app/controllers/users_controller.rb +63 -0
- data/app/helpers/biovision_components_helper.rb +7 -3
- data/app/helpers/biovision_helper.rb +170 -0
- data/app/helpers/entity_helper.rb +77 -0
- data/app/helpers/my_helper.rb +34 -0
- data/app/helpers/simple_image_helper.rb +125 -0
- data/app/jobs/application_job.rb +7 -0
- data/app/jobs/send_phone_confirmation_job.rb +16 -0
- data/app/lib/biovision/components/base/component_parameters.rb +55 -0
- data/app/lib/biovision/components/base/component_privileges.rb +75 -0
- data/app/lib/biovision/components/base/component_settings.rb +40 -0
- data/app/lib/biovision/components/base/component_stories.rb +30 -0
- data/app/lib/biovision/components/base/entity_links.rb +38 -0
- data/app/lib/biovision/components/base/image_handling.rb +33 -0
- data/app/lib/biovision/components/base_component.rb +63 -95
- data/app/lib/biovision/components/contact_component.rb +26 -0
- data/app/lib/biovision/components/content/oembed/receiver.rb +98 -0
- data/app/lib/biovision/components/content/oembed/twitter_receiver.rb +20 -0
- data/app/lib/biovision/components/content/oembed/vimeo_receiver.rb +20 -0
- data/app/lib/biovision/components/content/oembed/youtube_receiver.rb +20 -0
- data/app/lib/biovision/components/content_component.rb +65 -0
- data/app/lib/biovision/components/track_component.rb +3 -0
- data/app/lib/biovision/components/users/authentication.rb +15 -7
- data/app/lib/biovision/components/users/codes.rb +104 -0
- data/app/lib/biovision/components/users/flag_helpers.rb +72 -0
- data/app/lib/biovision/components/users/profile_handler.rb +111 -1
- data/app/lib/biovision/components/users/registration_handler.rb +40 -52
- data/app/lib/biovision/components/users/validation.rb +83 -0
- data/app/lib/biovision/components/users_component.rb +114 -19
- data/app/lib/biovision/helpers/data_helper.rb +70 -0
- data/app/lib/biovision/helpers/export_helper.rb +97 -0
- data/app/lib/biovision/migrations/component_migration.rb +56 -0
- data/app/lib/biovision/notifiers/base_notifier.rb +2 -2
- data/app/lib/biovision/notifiers/contact_notifier.rb +15 -0
- data/app/lib/biovision/stories/component_story.rb +55 -0
- data/app/lib/canonizer.rb +38 -0
- data/app/lib/carrier_wave/image_optim.rb +32 -0
- data/app/mailers/code_sender.rb +29 -0
- data/app/mailers/feedback_mailer.rb +14 -0
- data/app/models/agent.rb +4 -0
- data/app/models/biovision_component.rb +39 -3
- data/app/models/code.rb +31 -8
- data/app/models/concerns/checkable.rb +2 -1
- data/app/models/concerns/has_simple_image.rb +9 -0
- data/app/models/concerns/has_uploaded_file.rb +26 -0
- data/app/models/concerns/meta_texts.rb +25 -5
- data/app/models/concerns/simple_tag.rb +30 -0
- data/app/models/concerns/toggleable.rb +2 -1
- data/app/models/concerns/tree_structure.rb +75 -0
- data/app/models/contact_method.rb +47 -0
- data/app/models/contact_type.rb +27 -0
- data/app/models/dynamic_block.rb +43 -0
- data/app/models/dynamic_page.rb +73 -0
- data/app/models/feedback_message.rb +65 -0
- data/app/models/feedback_response.rb +50 -0
- data/app/models/group.rb +48 -0
- data/app/models/language.rb +4 -0
- data/app/models/metric.rb +4 -0
- data/app/models/navigation_group.rb +43 -0
- data/app/models/navigation_group_page.rb +23 -0
- data/app/models/oembed_domain.rb +25 -0
- data/app/models/oembed_link.rb +19 -0
- data/app/models/oembed_receiver.rb +15 -0
- data/app/models/role.rb +86 -0
- data/app/models/role_group.rb +13 -0
- data/app/models/simple_image.rb +49 -8
- data/app/models/simple_image_tag.rb +1 -16
- data/app/models/token.rb +6 -2
- data/app/models/uploaded_file.rb +62 -0
- data/app/models/uploaded_file_tag.rb +15 -0
- data/app/models/uploaded_file_tag_file.rb +13 -0
- data/app/models/user.rb +122 -29
- data/app/models/user_group.rb +20 -0
- data/app/models/user_role.rb +18 -0
- data/app/uploaders/simple_file_uploader.rb +23 -0
- data/app/uploaders/simple_image_uploader.rb +29 -20
- data/app/uploaders/uploaders/path_slug.rb +22 -0
- data/app/views/admin/agents/index.html.erb +1 -3
- data/app/views/admin/biovision_components/_nav_item.html.erb +6 -0
- data/app/views/admin/biovision_components/entity/_in_list.html.erb +12 -0
- data/app/views/admin/biovision_components/index.html.erb +11 -0
- data/app/views/admin/components/_image.jbuilder +18 -0
- data/app/views/admin/components/_list.html.erb +1 -1
- data/app/views/admin/components/entity/_links.html.erb +31 -21
- data/app/views/admin/components/image.jbuilder +1 -0
- data/app/views/admin/components/images.jbuilder +4 -0
- data/app/views/admin/components/links/_base.html.erb +1 -0
- data/app/views/admin/components/settings/_new_parameter.html.erb +4 -2
- data/app/views/admin/components/settings/_parameters.html.erb +8 -2
- data/app/views/admin/components/settings/_settings.html.erb +4 -4
- data/app/views/admin/components/settings.html.erb +2 -1
- data/app/views/admin/components/update_privileges.jbuilder +21 -0
- data/app/views/admin/dynamic_blocks/_form.html.erb +16 -0
- data/app/views/admin/dynamic_blocks/_nav_item.html.erb +6 -0
- data/app/views/admin/dynamic_blocks/entity/_in_list.html.erb +12 -0
- data/app/views/admin/dynamic_blocks/index.html.erb +17 -0
- data/app/views/admin/dynamic_blocks/show.html.erb +25 -0
- data/app/views/admin/dynamic_pages/_dynamic_page.jbuilder +18 -0
- data/app/views/admin/dynamic_pages/_form.html.erb +21 -0
- data/app/views/admin/dynamic_pages/_nav_item.html.erb +6 -0
- data/app/views/admin/dynamic_pages/entity/_in_list.html.erb +17 -0
- data/app/views/admin/dynamic_pages/entity/_in_search.html.erb +7 -0
- data/app/views/admin/dynamic_pages/index.html.erb +17 -0
- data/app/views/admin/dynamic_pages/search.jbuilder +4 -0
- data/app/views/admin/dynamic_pages/show.html.erb +28 -0
- data/app/views/admin/index/index.html.erb +7 -5
- data/app/views/admin/ip_addresses/index.html.erb +2 -4
- data/app/views/admin/navigation_group_pages/entity/_in_list.html.erb +26 -0
- data/app/views/admin/navigation_groups/_form.html.erb +15 -0
- data/app/views/admin/navigation_groups/_nav_item.html.erb +6 -0
- data/app/views/admin/navigation_groups/entity/_dynamic_pages.html.erb +38 -0
- data/app/views/admin/navigation_groups/entity/_in_list.html.erb +14 -0
- data/app/views/admin/navigation_groups/index.html.erb +17 -0
- data/app/views/admin/navigation_groups/show.html.erb +33 -0
- data/app/views/admin/tokens/_form.html.erb +31 -0
- data/app/views/admin/tokens/_nav_item.html.erb +6 -0
- data/app/views/admin/tokens/entity/_in_list.html.erb +27 -0
- data/app/views/admin/tokens/index.html.erb +11 -0
- data/app/views/admin/tokens/show.html.erb +26 -0
- data/app/views/admin/unauthorized.html.erb +2 -5
- data/app/views/admin/users/_form.html.erb +81 -0
- data/app/views/admin/users/_nav_item.html.erb +6 -0
- data/app/views/admin/users/_user.jbuilder +18 -0
- data/app/views/admin/users/entity/_fields.html.erb +53 -0
- data/app/views/admin/users/entity/_in_list.html.erb +38 -0
- data/app/views/admin/users/entity/_in_search.html.erb +18 -0
- data/app/views/admin/users/entity/_profile.html.erb +26 -0
- data/app/views/admin/users/entity/in_list/_additional_data.html.erb +0 -0
- data/app/views/admin/users/index.html.erb +24 -0
- data/app/views/admin/users/roles/_component.html.erb +22 -0
- data/app/views/admin/users/roles.html.erb +23 -0
- data/app/views/admin/users/search.jbuilder +4 -0
- data/app/views/admin/users/show.html.erb +62 -0
- data/app/views/admin/widgets/_filters.html.erb +20 -0
- data/app/views/admin/widgets/_quick_search.html.erb +13 -0
- data/app/views/admin/widgets/filters/_flag.html.erb +15 -0
- data/app/views/admin/widgets/filters/_text.html.erb +7 -0
- data/app/views/application/forbidden.html.erb +9 -0
- data/app/views/application/forbidden.jbuilder +4 -0
- data/app/views/application/not_found.html.erb +9 -0
- data/app/views/application/not_found.jbuilder +4 -0
- data/app/views/application/unauthorized.html.erb +19 -0
- data/app/views/application/unauthorized.jbuilder +4 -0
- data/app/views/authentication/new.html.erb +2 -8
- data/app/views/components/content/_dynamic_page.html.erb +17 -0
- data/app/views/components/content/_dynamic_page_content.html.erb +14 -0
- data/app/views/components/users/_form_tabs.html.erb +31 -0
- data/app/views/components/users/_join_form.html.erb +192 -0
- data/app/views/components/users/_login_form.html.erb +46 -0
- data/app/views/components/users/form/_image.html.erb +17 -0
- data/app/views/components/users/form/_profile_data.html.erb +54 -0
- data/app/views/contact/_form.html.erb +108 -0
- data/app/views/contact/create_feedback_message.js.erb +1 -0
- data/app/views/contact/feedback.html.erb +13 -0
- data/app/views/contact/index.html.erb +16 -0
- data/app/views/errors/error.html.erb +1 -0
- data/app/views/fallback/show.html.erb +6 -0
- data/app/views/feedback_mailer/new_feedback_request.html.erb +11 -0
- data/app/views/feedback_mailer/new_feedback_request.text.erb +6 -0
- data/app/views/index/index.html.erb +14 -0
- data/app/views/layouts/admin/_footer.html.erb +1 -1
- data/app/views/layouts/admin/_header.html.erb +7 -2
- data/app/views/layouts/admin.html.erb +0 -1
- data/app/views/layouts/application/_footer.html.erb +1 -1
- data/app/views/layouts/application/header/_authentication.html.erb +4 -1
- data/app/views/legal/privacy.html.erb +5 -0
- data/app/views/legal/tos.html.erb +5 -0
- data/app/views/my/components/index.html.erb +25 -0
- data/app/views/my/components/show.html.erb +21 -0
- data/app/views/my/confirmations/show.html.erb +62 -0
- data/app/views/my/index/_cards.html.erb +15 -0
- data/app/views/my/index/_email.html.erb +14 -0
- data/app/views/my/index/_navigation.html.erb +33 -0
- data/app/views/my/index/index.html.erb +12 -0
- data/app/views/my/profiles/_form.html.erb +10 -0
- data/app/views/my/profiles/check.jbuilder +4 -0
- data/app/views/my/profiles/edit.html.erb +14 -0
- data/app/views/my/profiles/form/_basic_parameters.html.erb +9 -0
- data/app/views/my/profiles/form/_sensitive_parameters.html.erb +68 -0
- data/app/views/my/profiles/new.html.erb +6 -8
- data/app/views/my/profiles/show.html.erb +36 -0
- data/app/views/my/recoveries/show.html.erb +0 -0
- data/app/views/shared/_flash_messages.html.erb +1 -1
- data/app/views/shared/_list_of_errors.html.erb +7 -0
- data/app/views/shared/admin/_breadcrumbs.html.erb +8 -0
- data/app/views/shared/admin/_list.html.erb +10 -19
- data/app/views/shared/admin/_list_with_priority.html.erb +10 -19
- data/app/views/shared/admin/_priority.html.erb +6 -0
- data/app/views/shared/admin/_toggle.html.erb +6 -0
- data/app/views/shared/entity/_date_field.html.erb +6 -0
- data/app/views/shared/entity/_formatted_text_field.html.erb +10 -0
- data/app/views/shared/entity/_image.html.erb +31 -0
- data/app/views/shared/entity/_language.html.erb +6 -0
- data/app/views/shared/entity/_linked_entity.html.erb +6 -0
- data/app/views/shared/entity/_list.html.erb +22 -0
- data/app/views/shared/entity/_list_with_priority.html.erb +22 -0
- data/app/views/shared/entity/_meta_texts.html.erb +16 -0
- data/app/views/shared/entity/_metadata.html.erb +18 -0
- data/app/views/shared/entity/_parent.html.erb +6 -0
- data/app/views/shared/entity/_priority.html.erb +4 -0
- data/app/views/shared/entity/_priority_icons.html.erb +8 -0
- data/app/views/shared/entity/_raw_text_field.html.erb +10 -0
- data/app/views/shared/entity/_simple_image.html.erb +10 -0
- data/app/views/shared/entity/_slug.html.erb +6 -0
- data/app/views/shared/entity/_text_field.html.erb +6 -0
- data/app/views/shared/entity/_text_fields.html.erb +9 -0
- data/app/views/shared/entity/_time_field.html.erb +6 -0
- data/app/views/shared/entity/_timestamps.html.erb +13 -0
- data/app/views/shared/entity/_toggle.html.erb +12 -0
- data/app/views/shared/entity/_track.html.erb +12 -0
- data/app/views/shared/entity/_tree_caches.html.erb +19 -0
- data/app/views/shared/entity/_uuid.html.erb +4 -0
- data/app/views/shared/entity/edit.html.erb +23 -0
- data/app/views/shared/entity/new.html.erb +16 -0
- data/app/views/shared/forms/_entity_flags.html.erb +15 -0
- data/app/views/shared/forms/_field.html.erb +50 -0
- data/app/views/shared/forms/_field_with_search.html.erb +17 -0
- data/app/views/shared/forms/_fields.html.erb +3 -0
- data/app/views/shared/forms/_language.html.erb +40 -0
- data/app/views/shared/forms/_meta_texts.html.erb +27 -0
- data/app/views/shared/forms/_priority.html.erb +13 -0
- data/app/views/shared/forms/_simple_entity_link.html.erb +14 -0
- data/app/views/shared/forms/_simple_image.html.erb +47 -0
- data/app/views/shared/forms/_state_container.html.erb +7 -0
- data/app/views/shared/forms/_text_area.html.erb +25 -0
- data/app/views/shared/forms/_text_field.html.erb +24 -0
- data/app/views/shared/forms/_text_fields.html.erb +3 -0
- data/app/views/shared/forms/check.jbuilder +4 -0
- data/app/views/shared/forms/errors.jbuilder +3 -0
- data/app/views/shared/forms/simple_image/_browse.html.erb +14 -0
- data/app/views/shared/forms/simple_image/_load_image.html.erb +38 -0
- data/app/views/shared/my/_list.html.erb +10 -0
- data/app/views/shared/my/_list_with_priority.html.erb +10 -0
- data/app/views/shared/my/entity/edit.html.erb +25 -0
- data/app/views/shared/my/entity/new.html.erb +18 -0
- data/app/views/simple_images/_simple_image.jbuilder +13 -0
- data/app/views/users/_profile.html.erb +30 -0
- data/app/views/users/profile/_data.html.erb +20 -0
- data/app/views/users/show.html.erb +21 -0
- data/config/locales/biovision-ru.yml +76 -1
- data/config/locales/components-ru.yml +55 -4
- data/config/locales/contact-ru.yml +110 -0
- data/config/locales/content-ru.yml +115 -0
- data/config/locales/users-ru.yml +142 -3
- data/config/routes.rb +99 -48
- data/db/migrate/20191228000000_create_biovision_components.rb +6 -5
- data/db/migrate/20200224000000_create_track_component.rb +9 -14
- data/db/migrate/20200224000010_create_users_component.rb +14 -83
- data/db/migrate/20200404000000_create_simple_images.rb +4 -3
- data/db/migrate/20210405000000_create_acl.rb +88 -0
- data/db/migrate/20210421000000_create_content_component.rb +80 -0
- data/db/migrate/20210421000010_create_contact_component.rb +74 -0
- data/db/migrate/20210616000000_create_uploaded_files.rb +52 -0
- data/db/migrate/amends/20210816060606_create_oembed_receivers.rb +21 -0
- data/db/migrate/amends/20210907070707_add_checksum_to_simple_images.rb +13 -0
- data/lib/biovision/base_methods.rb +17 -29
- data/lib/biovision/engine.rb +8 -13
- data/lib/biovision/version.rb +1 -1
- data/lib/tasks/components.rake +51 -0
- metadata +266 -27
- data/app/assets/images/biovision/placeholders/user.svg +0 -15
- data/app/helpers/users_helper.rb +0 -11
- data/app/lib/biovision/components/component_settings.rb +0 -30
- data/app/lib/biovision/components/privilege_handler.rb +0 -77
- data/app/lib/biovision/components/users/code_handler.rb +0 -23
- data/app/models/biovision_component_user.rb +0 -21
- data/app/models/foreign_site.rb +0 -34
- data/app/models/foreign_user.rb +0 -21
- data/app/uploaders/user_image_uploader.rb +0 -58
- data/app/views/admin/components/links/_track.html.erb +0 -2
- data/app/views/admin/components/links/_users.html.erb +0 -11
- data/app/views/admin/components/privileges/_component_user.html.erb +0 -17
- data/app/views/admin/components/privileges/_links.html.erb +0 -35
- data/app/views/admin/components/privileges/_privilege_flag.html.erb +0 -28
- data/app/views/admin/components/privileges/_users.html.erb +0 -23
- data/app/views/admin/components/privileges.html.erb +0 -20
- data/app/views/authentication/_form.html.erb +0 -40
- data/app/views/authentication/failed.js.erb +0 -3
- data/app/views/my/profiles/new/_form.html.erb +0 -147
- data/app/views/shared/admin/_toggleable.html.erb +0 -8
@@ -0,0 +1,62 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Uploaded file
|
4
|
+
#
|
5
|
+
# Attributes:
|
6
|
+
# attachment [SimpleFileUploader]
|
7
|
+
# agent_id [Agent], optional
|
8
|
+
# biovision_component_id [BiovisionComponent]
|
9
|
+
# checksum [String]
|
10
|
+
# created_at [DateTime]
|
11
|
+
# data [jsonb]
|
12
|
+
# description [String], optional
|
13
|
+
# ip_address_id [IpAddress], optional
|
14
|
+
# object_count [Integer]
|
15
|
+
# updated_at [DateTime]
|
16
|
+
# user_id [User], optional
|
17
|
+
# uuid [uuid]
|
18
|
+
class UploadedFile < ApplicationRecord
|
19
|
+
include Checkable
|
20
|
+
include HasOwner
|
21
|
+
include HasTrack
|
22
|
+
include HasUuid
|
23
|
+
|
24
|
+
META_LIMIT = 255
|
25
|
+
|
26
|
+
mount_uploader :attachment, SimpleFileUploader
|
27
|
+
|
28
|
+
belongs_to :agent, optional: true
|
29
|
+
belongs_to :biovision_component
|
30
|
+
belongs_to :user, optional: true
|
31
|
+
has_many :uploaded_file_tag_files, dependent: :destroy
|
32
|
+
has_many :uploaded_file_tags, through: :uploaded_file_tag_files
|
33
|
+
|
34
|
+
before_save :calculate_checksum
|
35
|
+
|
36
|
+
validates_presence_of :attachment
|
37
|
+
validates_length_of :description, maximum: META_LIMIT
|
38
|
+
|
39
|
+
scope :in_component, ->(v) { where(biovision_component: v) }
|
40
|
+
scope :filtered, ->(v) { where('description ilike ? or attachment ilike ?', "%#{v}%", "%#{v}%") unless v.blank? }
|
41
|
+
scope :list_for_administration, -> { order('attachment asc') }
|
42
|
+
|
43
|
+
def self.entity_parameters
|
44
|
+
%i[attachment description]
|
45
|
+
end
|
46
|
+
|
47
|
+
def name
|
48
|
+
File.basename(attachment.path)
|
49
|
+
end
|
50
|
+
|
51
|
+
def file_size
|
52
|
+
File.size(attachment.path)
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def calculate_checksum
|
58
|
+
return if attachment&.path.blank?
|
59
|
+
|
60
|
+
self.checksum = Digest::SHA256.file(attachment.path).hexdigest
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Tag for uploaded file
|
4
|
+
#
|
5
|
+
# Attributes:
|
6
|
+
# created_at [DateTime]
|
7
|
+
# name [string]
|
8
|
+
# uploaded_files_count [integer]
|
9
|
+
# updated_at [DateTime]
|
10
|
+
class UploadedFileTag < ApplicationRecord
|
11
|
+
include Checkable
|
12
|
+
include SimpleTag
|
13
|
+
|
14
|
+
has_many :uploaded_file_tag_files, dependent: :delete_all
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Link between simple image and tag
|
4
|
+
#
|
5
|
+
# Attributes:
|
6
|
+
# uploaded_file_id [UploadedFile]
|
7
|
+
# uploaded_file_tag_id [UploadedFileTag]
|
8
|
+
class UploadedFileTagFile < ApplicationRecord
|
9
|
+
belongs_to :uploaded_file
|
10
|
+
belongs_to :uploaded_file_tag, counter_cache: :uploaded_files_count
|
11
|
+
|
12
|
+
validates_uniqueness_of :uploaded_file_tag_id, scope: :uploaded_file_id
|
13
|
+
end
|
data/app/models/user.rb
CHANGED
@@ -1,98 +1,126 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# User
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Attributes:
|
6
6
|
# agent_id [Agent], optional
|
7
7
|
# allow_mail [boolean]
|
8
|
-
# balance [integer]
|
9
8
|
# banned [boolean]
|
10
9
|
# birthday [date], optional
|
11
10
|
# bot [boolean]
|
12
|
-
# consent [boolean]
|
13
11
|
# created_at [DateTime]
|
14
12
|
# data [jsonb]
|
15
13
|
# deleted [boolean]
|
16
14
|
# email [string], optional
|
17
15
|
# email_confirmed [boolean]
|
18
|
-
# image [
|
16
|
+
# image [SimpleImageUploader], optional
|
19
17
|
# inviter_id [User], optional
|
20
18
|
# ip_address_id [IpAddress], optional
|
21
19
|
# language_id [Language], optional
|
22
20
|
# last_seen [datetime], optional
|
23
21
|
# notice [string], optional
|
24
22
|
# password_digest [string]
|
23
|
+
# phone [string], optional
|
25
24
|
# phone_confirmed [boolean]
|
26
25
|
# primary_id [User], optional
|
26
|
+
# profile [Jsonb]
|
27
|
+
# referral_link [string]
|
27
28
|
# screen_name [string]
|
28
29
|
# slug [string]
|
29
30
|
# super_user [boolean]
|
30
|
-
# phone [string], optional
|
31
|
-
# referral_link [string]
|
32
31
|
# updated_at [DateTime]
|
33
32
|
# uuid [uuid]
|
34
33
|
class User < ApplicationRecord
|
35
34
|
include Checkable
|
36
35
|
include HasLanguage
|
37
|
-
include HasSimpleImage
|
38
36
|
include HasTrack
|
39
37
|
include HasUuid
|
40
38
|
include Toggleable
|
41
39
|
|
42
40
|
EMAIL_LIMIT = 250
|
43
41
|
EMAIL_PATTERN = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z0-9][-a-z0-9]+)\z/i.freeze
|
42
|
+
FLAG_SKIP_SCREEN_NAME = 'skip_screen_name_validation'
|
44
43
|
NOTICE_LIMIT = 255
|
45
44
|
PHONE_LIMIT = 50
|
46
|
-
SLUG_LIMIT =
|
45
|
+
SLUG_LIMIT = 36
|
46
|
+
SLUG_PATTERN = /\A[_a-z0-9][-_a-z0-9]{0,34}[_a-z0-9]\z/i.freeze
|
47
|
+
SLUG_PATTERN_HTML = '^[_a-zA-Z0-9][-_a-zA-Z0-9]{0,34}[_a-zA-Z0-9]$'
|
48
|
+
|
49
|
+
attr_accessor :code
|
47
50
|
|
48
|
-
toggleable :
|
51
|
+
toggleable :email_confirmed, :allow_mail, :phone_confirmed
|
49
52
|
|
50
53
|
has_secure_password
|
51
|
-
mount_uploader :image,
|
54
|
+
mount_uploader :image, SimpleImageUploader
|
52
55
|
|
53
56
|
belongs_to :inviter, class_name: User.to_s, optional: true
|
54
57
|
has_many :invitees, class_name: User.to_s, foreign_key: :inviter_id, dependent: :nullify
|
55
58
|
has_many :tokens, dependent: :delete_all
|
56
59
|
has_many :codes, dependent: :delete_all
|
57
|
-
has_many :foreign_users, dependent: :delete_all
|
60
|
+
has_many :foreign_users, dependent: :delete_all if Gem.loaded_specs.key?('biovision-oauth')
|
58
61
|
has_many :login_attempts, dependent: :delete_all
|
59
62
|
has_many :user_languages, dependent: :delete_all
|
63
|
+
has_many :user_roles, dependent: :destroy
|
64
|
+
has_many :user_groups, dependent: :destroy
|
60
65
|
|
61
|
-
|
66
|
+
after_initialize :prepare_referral_link
|
62
67
|
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
68
|
+
before_validation { self.email = nil if email.blank? }
|
69
|
+
before_validation { self.phone = nil if phone.blank? }
|
70
|
+
after_validation :normalize_slug
|
71
|
+
|
72
|
+
validate do |entity|
|
73
|
+
Biovision::Components::UsersComponent[entity].validate
|
74
|
+
end
|
75
|
+
|
76
|
+
validates :screen_name, presence: true, uniqueness: { case_sensitive: false }
|
67
77
|
validates :email, uniqueness: { case_sensitive: false }, allow_nil: true
|
68
|
-
|
69
|
-
validates_length_of :screen_name, maximum: SLUG_LIMIT
|
70
|
-
validates_length_of :email, maximum: EMAIL_LIMIT
|
78
|
+
validates :phone, uniqueness: { case_sensitive: false }, allow_nil: true
|
71
79
|
validates_length_of :phone, maximum: PHONE_LIMIT
|
72
80
|
validates_length_of :notice, maximum: NOTICE_LIMIT
|
73
81
|
|
74
82
|
scope :bots, ->(f) { where(bot: f.to_i.positive?) unless f.blank? }
|
75
83
|
scope :email_like, ->(v) { where('email ilike ?', "%#{v}%") unless v.blank? }
|
76
|
-
scope :with_email, ->(v) { where('lower(email) = lower(?)', v) }
|
84
|
+
scope :with_email, ->(v) { where('lower(email) = lower(?)', v.to_s) }
|
85
|
+
scope :list_for_administration, -> { order('id desc') }
|
86
|
+
scope :search, ->(q) { where('screen_name ilike ?', "%#{q}%") unless q.blank? }
|
87
|
+
|
88
|
+
def self.[](login)
|
89
|
+
find_by(slug: login) || find_by_contact(login)
|
90
|
+
end
|
91
|
+
|
92
|
+
# @param [Integer] page
|
93
|
+
def self.page_for_administration(page = 1)
|
94
|
+
list_for_administration.page(page)
|
95
|
+
end
|
77
96
|
|
78
97
|
def self.profile_parameters
|
79
|
-
%i[image allow_mail birthday
|
98
|
+
%i[image allow_mail birthday]
|
80
99
|
end
|
81
100
|
|
82
101
|
def self.sensitive_parameters
|
83
102
|
%i[email phone password password_confirmation]
|
84
103
|
end
|
85
104
|
|
86
|
-
#
|
105
|
+
# @param [String] login
|
106
|
+
def self.find_by_contact(login)
|
107
|
+
if login.index('@').to_i.positive?
|
108
|
+
User.with_email(login).first
|
109
|
+
elsif login[0] == '+'
|
110
|
+
User.find_by(phone: login)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# Parameters for registration
|
87
115
|
def self.new_profile_parameters
|
88
116
|
profile_parameters + sensitive_parameters + %i[screen_name]
|
89
117
|
end
|
90
118
|
|
91
119
|
# Administrative parameters
|
92
120
|
def self.entity_parameters
|
93
|
-
flags = %i[banned bot email_confirmed phone_confirmed
|
121
|
+
flags = %i[banned bot email_confirmed phone_confirmed]
|
94
122
|
|
95
|
-
new_profile_parameters + flags + %i[screen_name
|
123
|
+
new_profile_parameters + flags + %i[notice screen_name slug]
|
96
124
|
end
|
97
125
|
|
98
126
|
def self.ids_range
|
@@ -101,6 +129,28 @@ class User < ApplicationRecord
|
|
101
129
|
(min..max)
|
102
130
|
end
|
103
131
|
|
132
|
+
# @param [String] role_name
|
133
|
+
def role?(role_name)
|
134
|
+
return true if super_user?
|
135
|
+
|
136
|
+
role = Role[role_name]
|
137
|
+
role_ids.include?(role&.id)
|
138
|
+
end
|
139
|
+
|
140
|
+
def role_ids
|
141
|
+
Array(data[Role::CACHE_KEY]).map(&:to_i)
|
142
|
+
end
|
143
|
+
|
144
|
+
# @param [Role] role
|
145
|
+
def add_role(role)
|
146
|
+
role&.add_user(self)
|
147
|
+
end
|
148
|
+
|
149
|
+
# @param [Role] role
|
150
|
+
def remove_role(role)
|
151
|
+
role&.remove_user(self)
|
152
|
+
end
|
153
|
+
|
104
154
|
# Name to be shown as profile
|
105
155
|
#
|
106
156
|
# This can be redefined for cases when something other than screen name should
|
@@ -108,18 +158,22 @@ class User < ApplicationRecord
|
|
108
158
|
#
|
109
159
|
# @return [String]
|
110
160
|
def profile_name
|
111
|
-
screen_name
|
161
|
+
email_as_login? ? email.to_s.split('@').first : screen_name
|
162
|
+
end
|
163
|
+
|
164
|
+
def text_for_link
|
165
|
+
profile_name
|
112
166
|
end
|
113
167
|
|
114
168
|
def name_for_letter
|
115
|
-
|
169
|
+
profile['name'].blank? ? profile_name : profile['name']
|
116
170
|
end
|
117
171
|
|
118
172
|
# @param [TrueClass|FalseClass] include_patronymic
|
119
173
|
def full_name(include_patronymic = false)
|
120
174
|
result = [name_for_letter]
|
121
|
-
result <<
|
122
|
-
result <<
|
175
|
+
result << profile['patronymic'].to_s.strip if include_patronymic
|
176
|
+
result << profile['surname'].to_s.strip
|
123
177
|
result.compact.join(' ')
|
124
178
|
end
|
125
179
|
|
@@ -127,10 +181,49 @@ class User < ApplicationRecord
|
|
127
181
|
allow_mail? && !email.blank?
|
128
182
|
end
|
129
183
|
|
184
|
+
def email_as_login?
|
185
|
+
!data[Biovision::Components::UsersComponent::SETTING_EMAIL_AS_LOGIN].blank?
|
186
|
+
end
|
187
|
+
|
188
|
+
def phone_as_login?
|
189
|
+
!data[Biovision::Components::UsersComponent::SETTING_PHONE_AS_LOGIN].blank?
|
190
|
+
end
|
191
|
+
|
192
|
+
# @param [String|Symbol] component_slug
|
193
|
+
def component_data(component_slug)
|
194
|
+
data.dig('components', component_slug.to_s).to_h
|
195
|
+
end
|
196
|
+
|
197
|
+
# @param [String|Symbol] component_slug
|
198
|
+
# @param [Hash] component_data
|
199
|
+
def new_component_data(component_slug, component_data)
|
200
|
+
data['components'] ||= {}
|
201
|
+
data['components'][component_slug.to_s] = component_data.to_h
|
202
|
+
end
|
203
|
+
|
204
|
+
def world_url
|
205
|
+
key = screen_name.downcase == slug ? screen_name : slug
|
206
|
+
"/u/#{CGI.escape(key)}"
|
207
|
+
end
|
208
|
+
|
209
|
+
def age
|
210
|
+
return if birthday.blank?
|
211
|
+
|
212
|
+
now = Time.now.utc.to_date
|
213
|
+
next_month = now.month > birthday.month
|
214
|
+
next_day = (now.month == birthday.month && now.day >= birthday.day)
|
215
|
+
delta = next_month || next_day ? 0 : 1
|
216
|
+
now.year - birthday.year - delta
|
217
|
+
end
|
218
|
+
|
130
219
|
private
|
131
220
|
|
221
|
+
def prepare_referral_link
|
222
|
+
self.referral_link = SecureRandom.alphanumeric(12) if referral_link.blank?
|
223
|
+
end
|
224
|
+
|
132
225
|
def normalize_slug
|
133
|
-
self.slug = screen_name.to_s if slug.
|
226
|
+
self.slug = screen_name.to_s if slug.blank?
|
134
227
|
self.slug = slug.to_s.downcase
|
135
228
|
end
|
136
229
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# User in ACL group
|
4
|
+
#
|
5
|
+
# Attributes:
|
6
|
+
# created_at [DateTime]
|
7
|
+
# group_id [Group]
|
8
|
+
# updated_at [DateTime]
|
9
|
+
# user_id [User]
|
10
|
+
class UserGroup < ApplicationRecord
|
11
|
+
include HasOwner
|
12
|
+
|
13
|
+
belongs_to :user
|
14
|
+
belongs_to :group, counter_cache: :user_count
|
15
|
+
|
16
|
+
validates_uniqueness_of :group_id, scope: :user_id
|
17
|
+
|
18
|
+
after_create { group.users_changed! }
|
19
|
+
after_destroy { group.users_changed! }
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# ACL role for user
|
4
|
+
#
|
5
|
+
# Attributes:
|
6
|
+
# created_at [DateTime]
|
7
|
+
# role_id [Role]
|
8
|
+
# updated_at [DateTime]
|
9
|
+
# user_id [User]
|
10
|
+
class UserRole < ApplicationRecord
|
11
|
+
belongs_to :user
|
12
|
+
belongs_to :role
|
13
|
+
|
14
|
+
validates_uniqueness_of :role_id, scope: :user_id
|
15
|
+
|
16
|
+
after_create { role.count_users! }
|
17
|
+
after_destroy { role.count_users! }
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Simple file uploader without any processing
|
4
|
+
class SimpleFileUploader < CarrierWave::Uploader::Base
|
5
|
+
include Uploaders::PathSlug
|
6
|
+
|
7
|
+
storage :file
|
8
|
+
|
9
|
+
def extension_blacklist
|
10
|
+
%w[
|
11
|
+
htm html action apk app bat bin cmd com command cpl csh exe gadget inf ins
|
12
|
+
inx ipa isu job jse ksh lnk msc msi msp mst osx out paf pif prg ps1 reg
|
13
|
+
rgs run scr sct shb shs u3p vb vbe vbs vbscript workflow ws wsf wsh 0xe
|
14
|
+
73k 89k a6p ac acc acr actm ahk air app arscript as asb awk azw2 beam btm
|
15
|
+
cel celx chm cof crt dek dld dmc docm dotm dxl ear ebm ebs ebs2 ecf eham
|
16
|
+
elf es ex4 exopc ezs fas fky fpi frs fxp gs ham hms hpf hta iim ipf isp
|
17
|
+
jar js jsx kix lo ls mam mcr mel mpx mrc ms ms mxe nexe obs ore otm pex
|
18
|
+
plx potm ppam ppsm pptm prc pvd pwc pyc pyo qpx rbx rox rpj s2a sbs sca
|
19
|
+
scar scb script smm spr tcp thm tlb tms udf upx url vlx vpm wcm widget wiz
|
20
|
+
wpk wpm xap xbap xlam xlm xlsm xltm xqt xys zl9 dmg pkg php rb
|
21
|
+
]
|
22
|
+
end
|
23
|
+
end
|
@@ -2,18 +2,27 @@
|
|
2
2
|
|
3
3
|
# Uploader for universal simple images
|
4
4
|
class SimpleImageUploader < CarrierWave::Uploader::Base
|
5
|
+
include Uploaders::PathSlug
|
6
|
+
include CarrierWave::ImageOptim
|
5
7
|
include CarrierWave::MiniMagick
|
6
8
|
|
7
9
|
storage :file
|
8
10
|
|
9
|
-
def store_dir
|
10
|
-
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{path_slug}"
|
11
|
-
end
|
12
|
-
|
13
11
|
def default_url(*)
|
14
12
|
ActionController::Base.helpers.asset_path('biovision/placeholders/1x1.svg')
|
15
13
|
end
|
16
14
|
|
15
|
+
process :auto_orient
|
16
|
+
process optimize: [{ jpegoptim: true, optipng: true, svgo: true }], if: :optimize_images?
|
17
|
+
|
18
|
+
def auto_orient
|
19
|
+
return unless raster?
|
20
|
+
|
21
|
+
manipulate! do |image|
|
22
|
+
image.tap(&:auto_orient)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
17
26
|
version :hd, if: :raster_image? do
|
18
27
|
resize_to_fit(1920, 1920)
|
19
28
|
end
|
@@ -34,10 +43,12 @@ class SimpleImageUploader < CarrierWave::Uploader::Base
|
|
34
43
|
resize_to_fit(160, 160)
|
35
44
|
end
|
36
45
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
46
|
+
version :tiny, from_version: :preview, if: :raster_image? do
|
47
|
+
resize_to_fit(48, 48)
|
48
|
+
end
|
49
|
+
|
50
|
+
def extension_allowlist
|
51
|
+
[/jpe?g/, 'png', /svgz?/]
|
41
52
|
end
|
42
53
|
|
43
54
|
# Text for image alt attribute
|
@@ -58,10 +69,20 @@ class SimpleImageUploader < CarrierWave::Uploader::Base
|
|
58
69
|
!new_file.extension.match?(/svgz?\z/i)
|
59
70
|
end
|
60
71
|
|
72
|
+
def optimize_images?(*)
|
73
|
+
return false unless Rails.application.config.respond_to? :optimize_images
|
74
|
+
|
75
|
+
Rails.application.config.optimize_images
|
76
|
+
end
|
77
|
+
|
61
78
|
def raster?
|
62
79
|
!File.extname(path).match?(/\.svgz?\z/i)
|
63
80
|
end
|
64
81
|
|
82
|
+
def tiny_url
|
83
|
+
raster? ? tiny.url : url
|
84
|
+
end
|
85
|
+
|
65
86
|
def preview_url
|
66
87
|
raster? ? preview.url : url
|
67
88
|
end
|
@@ -81,16 +102,4 @@ class SimpleImageUploader < CarrierWave::Uploader::Base
|
|
81
102
|
def hd_url
|
82
103
|
raster? ? hd.url : url
|
83
104
|
end
|
84
|
-
|
85
|
-
private
|
86
|
-
|
87
|
-
def path_slug
|
88
|
-
if model.respond_to?(:uuid)
|
89
|
-
uuid = model&.uuid.to_s
|
90
|
-
"#{uuid[0..2]}/#{uuid[3..5]}/#{uuid[6..7]}/#{uuid}"
|
91
|
-
else
|
92
|
-
id = model&.id.to_i
|
93
|
-
"#{id / 1000}/#{id}"
|
94
|
-
end
|
95
|
-
end
|
96
105
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Uploaders
|
4
|
+
# Using UUID in file path when available
|
5
|
+
module PathSlug
|
6
|
+
def store_dir
|
7
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{path_slug}"
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def path_slug
|
13
|
+
if model.respond_to?(:uuid)
|
14
|
+
uuid = model.uuid.to_s
|
15
|
+
"#{uuid[0..2]}/#{uuid[3..5]}/#{uuid[6..7]}/#{uuid}"
|
16
|
+
else
|
17
|
+
id = model&.id.to_i
|
18
|
+
"#{id / 1000}/#{id}"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<div class="data">
|
2
|
+
<div><%= admin_entity_link(entity) %></div>
|
3
|
+
<div class="info"><%= entity.slug %></div>
|
4
|
+
|
5
|
+
<% if local_assigns[:handler]&.permit?('edit', entity) %>
|
6
|
+
<%= entity_toggle(entity) %>
|
7
|
+
|
8
|
+
<div class="entity-actions">
|
9
|
+
<%= entity_priority_icons(entity) %>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= admin_biovision_component_link(component_handler.component) %>
|
4
|
+
<span><%= t('admin.biovision_components.nav_item.text') %></span>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<article>
|
8
|
+
<h1><%= t('.heading') %></h1>
|
9
|
+
|
10
|
+
<%= entity_list(@collection, with_priority: true) %>
|
11
|
+
</article>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
json.data do
|
2
|
+
json.id entity.id
|
3
|
+
json.type entity.class.table_name
|
4
|
+
json.attributes do
|
5
|
+
json.call(entity, :uuid, :caption, :image_alt_text, :source_name, :source_link, :object_count)
|
6
|
+
end
|
7
|
+
json.meta do
|
8
|
+
json.name entity.name
|
9
|
+
json.size number_to_human_size(entity.file_size)
|
10
|
+
json.object_count t(:object_count, count: entity.object_count)
|
11
|
+
json.url do
|
12
|
+
json.preview entity.image.preview_url
|
13
|
+
json.small entity.image.small_url
|
14
|
+
json.medium entity.image.medium_url
|
15
|
+
json.hd entity.image.hd_url
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,35 +1,45 @@
|
|
1
1
|
<nav class="biovision-component-nav">
|
2
|
-
<% if handler.
|
3
|
-
<% if handler.use_parameters? || handler.component.settings.any? %>
|
4
|
-
<%=
|
5
|
-
link_to(
|
6
|
-
t('admin.components.settings.nav_text'),
|
7
|
-
admin_component_settings_path(slug: handler.slug),
|
8
|
-
class: 'settings'
|
9
|
-
)
|
10
|
-
%>
|
11
|
-
<% end %>
|
12
|
-
<% end %>
|
13
|
-
|
14
|
-
<% if handler.administrator? %>
|
2
|
+
<% if handler.manage_settings? && handler.permit?('settings.view') %>
|
15
3
|
<%=
|
16
4
|
link_to(
|
17
|
-
|
18
|
-
|
19
|
-
|
5
|
+
t('admin.components.settings.nav_text'),
|
6
|
+
admin_component_settings_path(slug: handler.slug),
|
7
|
+
class: 'settings'
|
20
8
|
)
|
21
9
|
%>
|
22
10
|
<% end %>
|
23
11
|
|
24
12
|
<% prefix = 'admin/components/links/' %>
|
25
|
-
|
26
|
-
|
13
|
+
<ul class="biovision-component-links">
|
14
|
+
<% if lookup_context.exists?("#{prefix}_#{handler.slug}") %>
|
15
|
+
<%=
|
16
|
+
render(
|
17
|
+
partial: "#{prefix}#{handler.slug}",
|
18
|
+
locals: { handler: handler }
|
19
|
+
)
|
20
|
+
%>
|
21
|
+
<% else %>
|
22
|
+
<% handler.administrative_parts.each do |part| %>
|
23
|
+
<% context = "admin/#{part}/_nav_item" %>
|
24
|
+
<% if handler.permit?("#{part}.view") && lookup_context.exists?(context) %>
|
25
|
+
<li>
|
26
|
+
<%=
|
27
|
+
render(
|
28
|
+
partial: "admin/#{part}/nav_item",
|
29
|
+
locals: { handler: handler }
|
30
|
+
)
|
31
|
+
%>
|
32
|
+
</li>
|
33
|
+
<% end %>
|
34
|
+
<% end %>
|
35
|
+
<% end %>
|
36
|
+
<% if lookup_context.exists?("admin/components/links/extra/_#{handler.slug}") %>
|
27
37
|
<%=
|
28
38
|
render(
|
29
|
-
|
30
|
-
|
39
|
+
partial: "admin/components/links/extra/#{handler.slug}",
|
40
|
+
locals: { handler: handler }
|
31
41
|
)
|
32
42
|
%>
|
33
|
-
</ul>
|
34
43
|
<% end %>
|
44
|
+
</ul>
|
35
45
|
</nav>
|
@@ -0,0 +1 @@
|
|
1
|
+
json.partial! 'image', locals: { entity: @entity }
|
@@ -0,0 +1 @@
|
|
1
|
+
<li><%= render 'admin/biovision_components/nav_item' %></li>
|