biovision 0.0.200518.1 → 0.1.210414.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 +60 -18
- 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.scss +3 -1
- data/app/assets/stylesheets/biovision/admin/components/users.scss +16 -0
- data/app/assets/stylesheets/biovision/admin/layout.scss +6 -17
- data/app/assets/stylesheets/biovision/biovision.scss +42 -1
- data/app/assets/stylesheets/biovision/components.scss +6 -0
- 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/forms.scss +162 -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/simple_image.scss +112 -0
- data/app/assets/stylesheets/biovision/components/toggleable.scss +71 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components.scss +2 -3
- data/app/assets/stylesheets/biovision/themes/default_theme/components/users.scss +2 -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/layout.scss +2 -16
- data/app/controllers/admin/components_controller.rb +9 -19
- data/app/controllers/admin/dynamic_blocks_controller.rb +15 -0
- data/app/controllers/admin/dynamic_pages_controller.rb +15 -0
- data/app/controllers/admin/navigation_groups_controller.rb +14 -0
- data/app/controllers/admin/users_controller.rb +70 -0
- data/app/controllers/admin_controller.rb +3 -2
- data/app/controllers/authentication_controller.rb +6 -34
- data/app/controllers/concerns/authentication.rb +12 -12
- data/app/controllers/concerns/crud_entities.rb +132 -0
- data/app/controllers/concerns/entity_priority.rb +10 -0
- data/app/controllers/concerns/toggleable_entity.rb +31 -0
- data/app/controllers/contact_controller.rb +49 -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 +5 -0
- data/app/controllers/my/confirmations_controller.rb +44 -0
- data/app/controllers/my/index_controller.rb +8 -0
- data/app/controllers/my/profiles_controller.rb +31 -16
- data/app/controllers/profile_controller.rb +12 -0
- data/app/controllers/users_controller.rb +61 -0
- data/app/helpers/biovision_helper.rb +171 -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 +44 -0
- data/app/lib/biovision/components/base/component_privileges.rb +65 -0
- data/app/lib/biovision/components/base/component_settings.rb +32 -0
- data/app/lib/biovision/components/base/privilege_handler.rb +79 -0
- data/app/lib/biovision/components/base_component.rb +51 -54
- data/app/lib/biovision/components/contact_component.rb +22 -0
- data/app/lib/biovision/components/content_component.rb +28 -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 +82 -19
- data/app/lib/biovision/notifiers/base_notifier.rb +2 -2
- data/app/lib/biovision/notifiers/contact_notifier.rb +15 -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/models/agent.rb +4 -0
- data/app/models/biovision_component.rb +22 -2
- data/app/models/browser.rb +1 -1
- data/app/models/code.rb +32 -9
- data/app/models/concerns/has_simple_image.rb +9 -0
- data/app/models/concerns/meta_texts.rb +25 -5
- data/app/models/concerns/tree_structure.rb +72 -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 +71 -0
- data/app/models/feedback_message.rb +59 -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/navigation_group.rb +33 -0
- data/app/models/navigation_group_page.rb +23 -0
- data/app/models/role.rb +56 -0
- data/app/models/role_group.rb +13 -0
- data/app/models/simple_image.rb +22 -8
- data/app/models/simple_image_tag.rb +1 -1
- data/app/models/token.rb +4 -4
- data/app/models/user.rb +94 -26
- data/app/models/user_group.rb +20 -0
- data/app/models/user_role.rb +19 -0
- data/app/uploaders/simple_file_uploader.rb +27 -0
- data/app/uploaders/simple_image_uploader.rb +20 -0
- data/app/views/admin/agents/index.html.erb +0 -2
- 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 +1 -1
- data/app/views/admin/components/image.jbuilder +1 -0
- data/app/views/admin/components/images.jbuilder +4 -0
- data/app/views/admin/components/links/_content.html.erb +9 -0
- data/app/views/admin/components/links/_users.html.erb +1 -8
- data/app/views/admin/components/links/extra/_content.html.erb +0 -0
- data/app/views/admin/components/privileges/_links.html.erb +0 -18
- 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 +1 -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 +10 -0
- data/app/views/admin/dynamic_blocks/index.html.erb +15 -0
- data/app/views/admin/dynamic_blocks/show.html.erb +23 -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 +15 -0
- data/app/views/admin/dynamic_pages/index.html.erb +15 -0
- data/app/views/admin/dynamic_pages/show.html.erb +28 -0
- data/app/views/admin/ip_addresses/index.html.erb +0 -2
- 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/_in_list.html.erb +12 -0
- data/app/views/admin/navigation_groups/index.html.erb +15 -0
- data/app/views/admin/navigation_groups/show.html.erb +20 -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/entity/_fields.html.erb +53 -0
- data/app/views/admin/users/entity/_in_list.html.erb +38 -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 +15 -0
- data/app/views/admin/users/show.html.erb +44 -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 +16 -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 +21 -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 +45 -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/fallback/show.html.erb +6 -0
- data/app/views/layouts/admin.html.erb +1 -1
- data/app/views/layouts/admin/_footer.html.erb +1 -1
- data/app/views/layouts/application/header/_authentication.html.erb +1 -1
- data/app/views/legal/privacy.html.erb +5 -0
- data/app/views/legal/tos.html.erb +5 -0
- data/app/views/my/confirmations/show.html.erb +62 -0
- data/app/views/my/index/index.html.erb +33 -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 +23 -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 +4 -4
- data/app/views/shared/admin/_list_with_priority.html.erb +4 -4
- data/app/views/shared/admin/_priority.html.erb +5 -0
- data/app/views/shared/admin/_toggle.html.erb +11 -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/_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/_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/_timestamps.html.erb +13 -0
- data/app/views/shared/entity/_tree_caches.html.erb +12 -0
- data/app/views/shared/entity/_uuid.html.erb +4 -0
- data/app/views/shared/entity/edit.html.erb +21 -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 +46 -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_image.html.erb +39 -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 +19 -0
- data/app/views/shared/my/_list_with_priority.html.erb +19 -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 +58 -0
- data/config/locales/components-ru.yml +30 -2
- data/config/locales/contact-ru.yml +106 -0
- data/config/locales/content-ru.yml +103 -0
- data/config/locales/users-ru.yml +117 -3
- data/config/routes.rb +70 -50
- data/db/migrate/20191228000000_create_biovision_components.rb +4 -5
- data/db/migrate/20200224000000_create_track_component.rb +7 -8
- data/db/migrate/20200224000010_create_users_component.rb +15 -43
- data/db/migrate/20200404000000_create_simple_images.rb +3 -3
- data/db/migrate/20200529000000_create_content_component.rb +74 -0
- data/db/migrate/20210401000000_create_contact_component.rb +95 -0
- data/db/migrate/20210405000000_create_acl.rb +74 -0
- data/lib/biovision/base_methods.rb +18 -10
- data/lib/biovision/engine.rb +8 -13
- data/lib/biovision/version.rb +1 -1
- metadata +186 -20
- 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/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/privileges/_privilege_flag.html.erb +0 -28
- 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,31 @@
|
|
1
|
+
<% unless entity.image.blank? %>
|
2
|
+
<% figure_id = "#{entity.class.table_name}-image" %>
|
3
|
+
<div>
|
4
|
+
<dt><%= t('attributes.image') %></dt>
|
5
|
+
<dd>
|
6
|
+
<figure role="group" class="preview" id="<%= figure_id %>">
|
7
|
+
<%= link_to(simple_image_medium(entity), entity.image.url) %>
|
8
|
+
<% if entity.respond_to?(:image_alt_text) %>
|
9
|
+
<figcaption><%= entity.image_alt_text %></figcaption>
|
10
|
+
<% end %>
|
11
|
+
</figure>
|
12
|
+
<% if local_assigns[:image_removal_url] %>
|
13
|
+
<div>
|
14
|
+
<%=
|
15
|
+
button_tag(
|
16
|
+
t('.remove_image'),
|
17
|
+
class: 'button button-danger js-image-remover',
|
18
|
+
data: {
|
19
|
+
url: image_removal_url,
|
20
|
+
text: t(:are_you_sure),
|
21
|
+
blank_url: image_path('biovision/placeholders/1x1.svg'),
|
22
|
+
container: figure_id
|
23
|
+
},
|
24
|
+
type: :button
|
25
|
+
)
|
26
|
+
%>
|
27
|
+
</div>
|
28
|
+
<% end %>
|
29
|
+
</dd>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<% list = entity.meta! %>
|
2
|
+
<% unless list.blank? %>
|
3
|
+
<div>
|
4
|
+
<dt><%= t('shared.forms.meta_texts.name') %></dt>
|
5
|
+
<dd>
|
6
|
+
<% list.each do |key, value| %>
|
7
|
+
<div class="meta-text">
|
8
|
+
<dfn title="<%= key %>">
|
9
|
+
<%= t("attributes.meta.#{key}", default: key) %>
|
10
|
+
</dfn>
|
11
|
+
<div class="text"><%= value %></div>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
</dd>
|
15
|
+
</div>
|
16
|
+
<% end %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% unless entity.nil? %>
|
2
|
+
<%
|
3
|
+
content_for :meta_title, entity.meta('title')
|
4
|
+
content_for :meta_description, entity.meta('description')
|
5
|
+
content_for :meta_keywords, entity.meta('keywords')
|
6
|
+
if entity.respond_to?(:image_metadata)
|
7
|
+
image = entity.image_metadata
|
8
|
+
unless image[:url].blank?
|
9
|
+
content_for :meta_image, request.protocol + request.host_with_port + image[:url]
|
10
|
+
content_for :meta_image_alt, image[:alt]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
%>
|
14
|
+
<% content_for :meta_twitter do %>
|
15
|
+
<meta name="twitter:card" content="summary_large_image"/>
|
16
|
+
<meta name="twitter:description" content="<%= entity.meta('description') %>"/>
|
17
|
+
<% end %>
|
18
|
+
<% end %>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% unless entity.created_at.nil? %>
|
2
|
+
<div>
|
3
|
+
<dt><%= t('attributes.created_at') %></dt>
|
4
|
+
<dd><%= time_tag(entity.created_at) %></dd>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<% unless entity.updated_at.nil? %>
|
9
|
+
<div>
|
10
|
+
<dt><%= t('attributes.updated_at') %></dt>
|
11
|
+
<dd><%= time_tag(entity.updated_at) %></dd>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% unless entity.parents_cache.blank? %>
|
2
|
+
<div>
|
3
|
+
<dt><%= entity.class.human_attribute_name(:parents_cache) %></dt>
|
4
|
+
<dd><%= entity.parents_cache %></dd>
|
5
|
+
</div>
|
6
|
+
<% end %>
|
7
|
+
<% unless entity.children_cache.blank? %>
|
8
|
+
<div>
|
9
|
+
<dt><%= entity.class.human_attribute_name(:children_cache) %></dt>
|
10
|
+
<dd><%= entity.children_cache.join(', ') %></dd>
|
11
|
+
</div>
|
12
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<%
|
2
|
+
prefix = controller_path.gsub('/', '.')
|
3
|
+
default_title = "#{@entity.class.model_name.human}: #{t('.nav_text')}"
|
4
|
+
%>
|
5
|
+
<% content_for :meta_title, t("#{prefix}.edit.title", default: default_title) %>
|
6
|
+
<% content_for :breadcrumbs do %>
|
7
|
+
<%= admin_biovision_component_link(component_handler.component) %>
|
8
|
+
<%= link_to(t("#{prefix}.nav_item.text"), "/#{controller_path}") %>
|
9
|
+
<%= admin_entity_link(@entity) %>
|
10
|
+
<span><%= t('.nav_text') %></span>
|
11
|
+
<% end %>
|
12
|
+
|
13
|
+
<article>
|
14
|
+
<h1><%= t("#{prefix}.edit.heading", default: default_title) %></h1>
|
15
|
+
|
16
|
+
<nav class="entity-actions">
|
17
|
+
<%= destroy_icon(@entity) %>
|
18
|
+
</nav>
|
19
|
+
|
20
|
+
<%= render partial: "#{controller_path}/form", locals: { entity: @entity } %>
|
21
|
+
</article>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<%
|
2
|
+
prefix = controller_path.gsub('/', '.')
|
3
|
+
default_title = "#{@entity.class.model_name.human}: #{t('.nav_text')}"
|
4
|
+
%>
|
5
|
+
<% content_for :meta_title, t("#{prefix}.new.title", default: default_title) %>
|
6
|
+
<% content_for :breadcrumbs do %>
|
7
|
+
<%= admin_biovision_component_link(component_handler.component) %>
|
8
|
+
<%= link_to(t("#{prefix}.nav_item.text"), "/#{controller_path}") %>
|
9
|
+
<span><%= t('.nav_text') %></span>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<article>
|
13
|
+
<h1><%= t("#{prefix}.new.heading", default: default_title) %></h1>
|
14
|
+
|
15
|
+
<%= render partial: "#{controller_path}/form", locals: { entity: @entity } %>
|
16
|
+
</article>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div>
|
2
|
+
<dt><%= t(:flags) %></dt>
|
3
|
+
<dd>
|
4
|
+
<ul class="flags">
|
5
|
+
<% f.object.class.toggleable_attributes.each do |flag| %>
|
6
|
+
<li>
|
7
|
+
<label class="flag-label">
|
8
|
+
<%= f.check_box flag %>
|
9
|
+
<span><%= f.object.class.human_attribute_name(flag) %></span>
|
10
|
+
</label>
|
11
|
+
</li>
|
12
|
+
<% end %>
|
13
|
+
</ul>
|
14
|
+
</dd>
|
15
|
+
</div>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<%
|
2
|
+
# smelly WIP
|
3
|
+
model = f.object.class
|
4
|
+
type ||= model.type_for_attribute(field).type
|
5
|
+
validators = model.validators_on(field)
|
6
|
+
length_options = validators.select { |v| v.kind == :length }.first&.options.to_h
|
7
|
+
range_option = validators.select { |v| v.kind == :inclusion }.first&.options.to_h
|
8
|
+
options = {
|
9
|
+
class: 'input-text',
|
10
|
+
data: { check: field }.merge(local_assigns[:data].to_h),
|
11
|
+
maxlength: length_options[:maximum],
|
12
|
+
minlength: length_options[:minimum],
|
13
|
+
required: validators.select { |v| v.kind == :presence }.any?,
|
14
|
+
size: nil
|
15
|
+
}
|
16
|
+
guide_key = "#{controller_path.gsub('/', '.')}.form.guidelines.#{field}"
|
17
|
+
%>
|
18
|
+
<div>
|
19
|
+
<dt><%= f.label field %></dt>
|
20
|
+
<dd>
|
21
|
+
<% case type %>
|
22
|
+
<% when :integer %>
|
23
|
+
<%= f.number_field(field, options.merge(in: range_option[:in]).merge(local_assigns[:options].to_h)) %>
|
24
|
+
<% when :float %>
|
25
|
+
<%= f.number_field(field, options.merge(step: :any, in: range_option[:in]).merge(local_assigns[:options].to_h)) %>
|
26
|
+
<% when :text %>
|
27
|
+
<%= f.text_area(field, options.merge(rows: 20, cols: 80).merge(local_assigns[:options].to_h)) %>
|
28
|
+
<% when :date %>
|
29
|
+
<%= f.date_field(field, options.merge(local_assigns[:options].to_h)) %>
|
30
|
+
<% when :datetime %>
|
31
|
+
<%= f.datetime_field(field, options.merge(local_assigns[:options].to_h)) %>
|
32
|
+
<% when :url %>
|
33
|
+
<%= f.url_field(field, options.merge(local_assigns[:options].to_h)) %>
|
34
|
+
<% when :email %>
|
35
|
+
<%= f.email_field(field, options.merge(local_assigns[:options].to_h)) %>
|
36
|
+
<% when :phone %>
|
37
|
+
<%= f.phone_field(field, options.merge(local_assigns[:options].to_h)) %>
|
38
|
+
<% else %>
|
39
|
+
<%= f.text_field(field, options.merge(local_assigns[:options].to_h)) %>
|
40
|
+
<% end %>
|
41
|
+
<div class="check-result-error" data-field="<%= field %>"></div>
|
42
|
+
<% if I18n.exists?(guide_key) %>
|
43
|
+
<div class="guideline"><%= t(guide_key) %></div>
|
44
|
+
<% end %>
|
45
|
+
</dd>
|
46
|
+
</div>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<%
|
2
|
+
collection = Language.active.ordered_by_priority
|
3
|
+
entity = f.object
|
4
|
+
model_name = entity.class.to_s.underscore
|
5
|
+
%>
|
6
|
+
<% if collection.count > 1 %>
|
7
|
+
<div>
|
8
|
+
<dt><%= f.label :language_id %></dt>
|
9
|
+
<dd>
|
10
|
+
<ul>
|
11
|
+
<li>
|
12
|
+
<label>
|
13
|
+
<%=
|
14
|
+
radio_button_tag(
|
15
|
+
"#{model_name}[language_id]",
|
16
|
+
'',
|
17
|
+
entity.language.nil?,
|
18
|
+
)
|
19
|
+
%>
|
20
|
+
<span><%= t(:not_set) %></span>
|
21
|
+
</label>
|
22
|
+
</li>
|
23
|
+
<% collection.each do |language| %>
|
24
|
+
<li>
|
25
|
+
<label>
|
26
|
+
<%=
|
27
|
+
radio_button_tag(
|
28
|
+
"#{model_name}[language_id]",
|
29
|
+
language.id,
|
30
|
+
entity.language == language,
|
31
|
+
)
|
32
|
+
%>
|
33
|
+
<span><%= language.name %></span>
|
34
|
+
</label>
|
35
|
+
</li>
|
36
|
+
<% end %>
|
37
|
+
</ul>
|
38
|
+
</dd>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<% entity = f.object %>
|
2
|
+
<div>
|
3
|
+
<dt><%= t('.name') %></dt>
|
4
|
+
<dd>
|
5
|
+
<ul class="flags">
|
6
|
+
<% entity.class.meta_keys.each do |key| %>
|
7
|
+
<li>
|
8
|
+
<label class="floating-label" title="<%= key %>">
|
9
|
+
<% placeholder = t("attributes.meta.#{key}", default: key) %>
|
10
|
+
<%=
|
11
|
+
text_field_tag(
|
12
|
+
"meta[#{key}",
|
13
|
+
entity.meta(key),
|
14
|
+
class: 'input-text',
|
15
|
+
id: nil,
|
16
|
+
maxlength: 250,
|
17
|
+
placeholder: placeholder,
|
18
|
+
size: nil
|
19
|
+
)
|
20
|
+
%>
|
21
|
+
<span><%= placeholder %></span>
|
22
|
+
</label>
|
23
|
+
</li>
|
24
|
+
<% end %>
|
25
|
+
</ul>
|
26
|
+
</dd>
|
27
|
+
</div>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%
|
2
|
+
entity = f.object
|
3
|
+
model_name = entity.class.to_s.underscore
|
4
|
+
img = entity.simple_image
|
5
|
+
src = img&.image.blank? ? 'biovision/placeholders/3x2.svg' : img.image.medium_url
|
6
|
+
handler_url ||= admin_component_images_path(slug: component_handler.class.slug)
|
7
|
+
%>
|
8
|
+
<div>
|
9
|
+
<dt><%= f.label :simple_image_id %></dt>
|
10
|
+
<dd>
|
11
|
+
<div class="js-simple-image-upload simple-image-upload">
|
12
|
+
<figure class="image-preview" id="<%= model_name %>-image">
|
13
|
+
<%=
|
14
|
+
label_tag(
|
15
|
+
"#{model_name}_image",
|
16
|
+
image_tag(src, alt: ''),
|
17
|
+
class: 'current-image'
|
18
|
+
)
|
19
|
+
%>
|
20
|
+
<figcaption>
|
21
|
+
<div class="guideline"><%= t('.guideline') %></div>
|
22
|
+
</figcaption>
|
23
|
+
</figure>
|
24
|
+
<div class="js-change" data-url="<%= handler_url %>">
|
25
|
+
<div class="buttons">
|
26
|
+
<button class="button button-ghost js-new-image" type="button">
|
27
|
+
<%= t('.new_image') %>
|
28
|
+
</button>
|
29
|
+
<button class="button button-ghost js-select-image" type="button">
|
30
|
+
<%= t('.select') %>
|
31
|
+
</button>
|
32
|
+
</div>
|
33
|
+
<%= render 'shared/forms/simple_image/browse' %>
|
34
|
+
<%= render 'shared/forms/simple_image/load_image' %>
|
35
|
+
</div>
|
36
|
+
<%= f.hidden_field(:simple_image_id) %>
|
37
|
+
</div>
|
38
|
+
</dd>
|
39
|
+
</div>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%
|
2
|
+
model = f.object.class
|
3
|
+
validators = model.validators_on(field)
|
4
|
+
length_options = validators.select { |v| v.kind == :length }.first&.options.to_h
|
5
|
+
options = {
|
6
|
+
class: 'input-text',
|
7
|
+
data: { check: field }.merge(local_assigns[:data].to_h),
|
8
|
+
manlength: length_options[:maximum],
|
9
|
+
minlength: length_options[:minimum],
|
10
|
+
required: validators.select { |v| v.kind == :presence }.any?,
|
11
|
+
rows: 10,
|
12
|
+
size: nil
|
13
|
+
}.merge(local_assigns[:options].to_h)
|
14
|
+
guide_key = "#{model.table_name}.form.guidelines.#{field}"
|
15
|
+
%>
|
16
|
+
<div>
|
17
|
+
<dt><%= f.label field %></dt>
|
18
|
+
<dd>
|
19
|
+
<%= f.text_area(field, options) %>
|
20
|
+
<div class="check-result-error" data-field="<%= field %>"></div>
|
21
|
+
<% if I18n.exists?(guide_key) %>
|
22
|
+
<div class="guideline"><%= t(guide_key) %></div>
|
23
|
+
<% end %>
|
24
|
+
</dd>
|
25
|
+
</div>
|