biovision 0.0.200518.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +214 -0
- data/Rakefile +22 -0
- data/app/assets/config/biovision_manifest.js +1 -0
- data/app/assets/images/biovision/components/carousel/arrow-left.svg +4 -0
- data/app/assets/images/biovision/components/carousel/arrow-right.svg +4 -0
- data/app/assets/images/biovision/icons/breadcrumb-hover.svg +1 -0
- data/app/assets/images/biovision/icons/breadcrumb.svg +1 -0
- data/app/assets/images/biovision/icons/components/contact.svg +26 -0
- data/app/assets/images/biovision/icons/components/content.svg +20 -0
- data/app/assets/images/biovision/icons/components/users.svg +21 -0
- data/app/assets/images/biovision/icons/key.svg +16 -0
- data/app/assets/images/biovision/icons/log_in.svg +15 -0
- data/app/assets/images/biovision/icons/log_out.svg +15 -0
- data/app/assets/images/biovision/icons/messages/error.svg +14 -0
- data/app/assets/images/biovision/icons/messages/info.svg +8 -0
- data/app/assets/images/biovision/icons/messages/success.svg +12 -0
- data/app/assets/images/biovision/icons/messages/warning.svg +13 -0
- data/app/assets/images/biovision/icons/settings.svg +41 -0
- data/app/assets/images/biovision/placeholders/16x9.svg +11 -0
- data/app/assets/images/biovision/placeholders/1x1.svg +11 -0
- data/app/assets/images/biovision/placeholders/3x2.svg +11 -0
- data/app/assets/images/biovision/placeholders/user.svg +15 -0
- data/app/assets/stylesheets/biovision/admin.scss +6 -0
- data/app/assets/stylesheets/biovision/admin/components.scss +59 -0
- data/app/assets/stylesheets/biovision/admin/default.scss +57 -0
- data/app/assets/stylesheets/biovision/admin/layout.scss +95 -0
- data/app/assets/stylesheets/biovision/admin/vars.scss +56 -0
- data/app/assets/stylesheets/biovision/biovision.scss +134 -0
- data/app/assets/stylesheets/biovision/biovision/messages.scss +41 -0
- data/app/assets/stylesheets/biovision/components/carousel.scss +53 -0
- data/app/assets/stylesheets/biovision/components/forms.scss +85 -0
- data/app/assets/stylesheets/biovision/components/hamburger.scss +56 -0
- data/app/assets/stylesheets/biovision/components/lists.scss +91 -0
- data/app/assets/stylesheets/biovision/default.scss +57 -0
- data/app/assets/stylesheets/biovision/themes/default_theme.scss +2 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/components.scss +3 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout.scss +44 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout/footer.scss +0 -0
- data/app/assets/stylesheets/biovision/themes/default_theme/layout/header.scss +39 -0
- data/app/assets/stylesheets/biovision/vars.scss +53 -0
- data/app/controllers/admin/agents_controller.rb +15 -0
- data/app/controllers/admin/components_controller.rb +174 -0
- data/app/controllers/admin/index_controller.rb +11 -0
- data/app/controllers/admin/ip_addresses_controller.rb +15 -0
- data/app/controllers/admin_controller.rb +14 -0
- data/app/controllers/authentication_controller.rb +79 -0
- data/app/controllers/concerns/authentication.rb +45 -0
- data/app/controllers/index_controller.rb +8 -0
- data/app/controllers/my/confirmations_controller.rb +2 -0
- data/app/controllers/my/index_controller.rb +8 -0
- data/app/controllers/my/profiles_controller.rb +128 -0
- data/app/controllers/my/recoveries_controller.rb +2 -0
- data/app/helpers/biovision_components_helper.rb +14 -0
- data/app/helpers/users_helper.rb +11 -0
- data/app/lib/biovision/components/base_component.rb +177 -0
- data/app/lib/biovision/components/component_settings.rb +30 -0
- data/app/lib/biovision/components/privilege_handler.rb +77 -0
- data/app/lib/biovision/components/track_component.rb +9 -0
- data/app/lib/biovision/components/users/authentication.rb +47 -0
- data/app/lib/biovision/components/users/code_handler.rb +23 -0
- data/app/lib/biovision/components/users/profile_handler.rb +12 -0
- data/app/lib/biovision/components/users/registration_handler.rb +99 -0
- data/app/lib/biovision/components/users_component.rb +47 -0
- data/app/lib/biovision/notifiers/base_notifier.rb +69 -0
- data/app/lib/biovision/notifiers/socialization_notifier.rb +31 -0
- data/app/lib/biovision/notifiers/users_notifier.rb +15 -0
- data/app/models/agent.rb +35 -0
- data/app/models/biovision_component.rb +45 -0
- data/app/models/biovision_component_user.rb +21 -0
- data/app/models/browser.rb +34 -0
- data/app/models/code.rb +71 -0
- data/app/models/concerns/checkable.rb +22 -0
- data/app/models/concerns/flat_priority.rb +50 -0
- data/app/models/concerns/has_language.rb +10 -0
- data/app/models/concerns/has_owner.rb +22 -0
- data/app/models/concerns/has_simple_image.rb +18 -0
- data/app/models/concerns/has_track.rb +10 -0
- data/app/models/concerns/has_uuid.rb +12 -0
- data/app/models/concerns/meta_texts.rb +16 -0
- data/app/models/concerns/nested_priority.rb +58 -0
- data/app/models/concerns/required_unique_name.rb +16 -0
- data/app/models/concerns/required_unique_slug.rb +15 -0
- data/app/models/concerns/toggleable.rb +33 -0
- data/app/models/foreign_site.rb +34 -0
- data/app/models/foreign_user.rb +21 -0
- data/app/models/ip_address.rb +31 -0
- data/app/models/language.rb +31 -0
- data/app/models/login_attempt.rb +35 -0
- data/app/models/metric.rb +48 -0
- data/app/models/metric_value.rb +11 -0
- data/app/models/notification.rb +37 -0
- data/app/models/simple_image.rb +47 -0
- data/app/models/simple_image_tag.rb +30 -0
- data/app/models/simple_image_tag_image.rb +13 -0
- data/app/models/token.rb +96 -0
- data/app/models/user.rb +136 -0
- data/app/models/user_language.rb +15 -0
- data/app/uploaders/simple_image_uploader.rb +96 -0
- data/app/uploaders/user_image_uploader.rb +58 -0
- data/app/views/admin/agents/_nav_item.html.erb +6 -0
- data/app/views/admin/agents/entity/_in_list.html.erb +6 -0
- data/app/views/admin/agents/index.html.erb +13 -0
- data/app/views/admin/components/_list.html.erb +12 -0
- data/app/views/admin/components/entity/_links.html.erb +35 -0
- data/app/views/admin/components/entity/_section.html.erb +12 -0
- data/app/views/admin/components/index.html.erb +12 -0
- data/app/views/admin/components/links/_track.html.erb +2 -0
- data/app/views/admin/components/links/_users.html.erb +11 -0
- data/app/views/admin/components/privileges.html.erb +20 -0
- data/app/views/admin/components/privileges/_component_user.html.erb +17 -0
- data/app/views/admin/components/privileges/_links.html.erb +35 -0
- data/app/views/admin/components/privileges/_privilege_flag.html.erb +28 -0
- data/app/views/admin/components/privileges/_users.html.erb +23 -0
- data/app/views/admin/components/settings.html.erb +39 -0
- data/app/views/admin/components/settings/_new_parameter.html.erb +46 -0
- data/app/views/admin/components/settings/_parameters.html.erb +20 -0
- data/app/views/admin/components/settings/_setting.html.erb +18 -0
- data/app/views/admin/components/settings/_settings.html.erb +31 -0
- data/app/views/admin/components/show.html.erb +14 -0
- data/app/views/admin/index/index.html.erb +14 -0
- data/app/views/admin/ip_addresses/_nav_item.html.erb +6 -0
- data/app/views/admin/ip_addresses/entity/_in_list.html.erb +6 -0
- data/app/views/admin/ip_addresses/index.html.erb +13 -0
- data/app/views/admin/unauthorized.html.erb +19 -0
- data/app/views/authentication/_form.html.erb +40 -0
- data/app/views/authentication/failed.js.erb +3 -0
- data/app/views/authentication/new.html.erb +21 -0
- data/app/views/index/index.html.erb +0 -0
- data/app/views/layouts/admin.html.erb +23 -0
- data/app/views/layouts/admin/_breadcrumbs.html.erb +8 -0
- data/app/views/layouts/admin/_footer.html.erb +10 -0
- data/app/views/layouts/admin/_header.html.erb +18 -0
- data/app/views/layouts/admin/header/_logo.html.erb +3 -0
- data/app/views/layouts/application/_footer.html.erb +8 -0
- data/app/views/layouts/application/_header.html.erb +9 -0
- data/app/views/layouts/application/header/_authentication.html.erb +13 -0
- data/app/views/my/index/index.html.erb +0 -0
- data/app/views/my/profiles/closed.html.erb +12 -0
- data/app/views/my/profiles/new.html.erb +17 -0
- data/app/views/my/profiles/new/_form.html.erb +147 -0
- data/app/views/shared/_breadcrumbs.html.erb +8 -0
- data/app/views/shared/_cookie_notification.html.erb +4 -0
- data/app/views/shared/_flash_messages.html.erb +7 -0
- data/app/views/shared/_meta_texts.html.erb +31 -0
- data/app/views/shared/_nothing_found.html.erb +1 -0
- data/app/views/shared/_pagination.jbuilder +15 -0
- data/app/views/shared/admin/_list.html.erb +19 -0
- data/app/views/shared/admin/_list_with_priority.html.erb +19 -0
- data/app/views/shared/admin/_toggleable.html.erb +8 -0
- data/app/views/shared/entity/_list_of_errors.html.erb +7 -0
- data/app/views/shared/forms/errors.js.erb +5 -0
- data/config/initializers/carrierwave.rb +27 -0
- data/config/initializers/pluralization.rb +2 -0
- data/config/locales/biovision-ru.yml +90 -0
- data/config/locales/components-ru.yml +81 -0
- data/config/locales/track-ru.yml +40 -0
- data/config/locales/users-ru.yml +130 -0
- data/config/routes.rb +75 -0
- data/db/migrate/20191228000000_create_biovision_components.rb +72 -0
- data/db/migrate/20200224000000_create_track_component.rb +59 -0
- data/db/migrate/20200224000010_create_users_component.rb +189 -0
- data/db/migrate/20200404000000_create_simple_images.rb +54 -0
- data/lib/biovision.rb +9 -0
- data/lib/biovision/base_methods.rb +167 -0
- data/lib/biovision/engine.rb +40 -0
- data/lib/biovision/version.rb +5 -0
- data/lib/tasks/biovision_tasks.rake +4 -0
- metadata +392 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Uploader for user images
|
4
|
+
class UserImageUploader < CarrierWave::Uploader::Base
|
5
|
+
include CarrierWave::MiniMagick
|
6
|
+
include CarrierWave::BombShelter
|
7
|
+
|
8
|
+
storage :file
|
9
|
+
|
10
|
+
def max_pixel_dimensions
|
11
|
+
[4000, 4000]
|
12
|
+
end
|
13
|
+
|
14
|
+
# Override the directory where uploaded files will be stored.
|
15
|
+
# This is a sensible default for uploaders that are meant to be mounted:
|
16
|
+
def store_dir
|
17
|
+
uuid = model&.uuid.to_s
|
18
|
+
slug = "#{uuid[0..2]}/#{uuid[3..5]}/#{uuid[6..7]}/#{uuid}"
|
19
|
+
|
20
|
+
"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{slug}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def default_url(*)
|
24
|
+
ActionController::Base.helpers.asset_path('biovision/placeholders/user.svg')
|
25
|
+
end
|
26
|
+
|
27
|
+
process :auto_orient
|
28
|
+
|
29
|
+
def auto_orient
|
30
|
+
manipulate! do |image|
|
31
|
+
image.tap(&:auto_orient)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
version :hd do
|
36
|
+
resize_to_fit(1280, 1280)
|
37
|
+
end
|
38
|
+
|
39
|
+
version :large, from_version: :hd do
|
40
|
+
resize_to_fit(640, 640)
|
41
|
+
end
|
42
|
+
|
43
|
+
version :profile, from_version: :large do
|
44
|
+
resize_to_fit(320, 320)
|
45
|
+
end
|
46
|
+
|
47
|
+
version :preview, from_version: :profile do
|
48
|
+
resize_to_fit(160, 160)
|
49
|
+
end
|
50
|
+
|
51
|
+
version :tiny, from_version: :preview do
|
52
|
+
resize_to_fit(48, 48)
|
53
|
+
end
|
54
|
+
|
55
|
+
def extension_whitelist
|
56
|
+
%w[jpg jpeg png]
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', page: current_page) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= admin_biovision_component_link(component_handler.component) %>
|
4
|
+
<span><%= t('admin.agents.nav_item.text') %></span>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<article>
|
8
|
+
<h1><%= t('.heading') %></h1>
|
9
|
+
|
10
|
+
<%= paginate @collection %>
|
11
|
+
<%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
|
12
|
+
<%= paginate @collection %>
|
13
|
+
</article>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% collection.each do |component| %>
|
2
|
+
<%
|
3
|
+
handler = Biovision::Components::BaseComponent.handler(component, current_user)
|
4
|
+
next if handler.component.nil? || !handler.allow?
|
5
|
+
%>
|
6
|
+
<%=
|
7
|
+
render(
|
8
|
+
partial: 'admin/components/entity/section',
|
9
|
+
locals: { component: component, handler: handler }
|
10
|
+
)
|
11
|
+
%>
|
12
|
+
<% end %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<nav class="biovision-component-nav">
|
2
|
+
<% if handler.allow?('settings') %>
|
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? %>
|
15
|
+
<%=
|
16
|
+
link_to(
|
17
|
+
t('admin.components.privileges.nav_text'),
|
18
|
+
admin_component_privileges_path(slug: handler.slug),
|
19
|
+
class: 'privileges'
|
20
|
+
)
|
21
|
+
%>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<% prefix = 'admin/components/links/' %>
|
25
|
+
<% if lookup_context.exists?("#{prefix}_#{handler.slug}") %>
|
26
|
+
<ul class="biovision-component-links">
|
27
|
+
<%=
|
28
|
+
render(
|
29
|
+
partial: "#{prefix}#{handler.slug}",
|
30
|
+
locals: { handler: handler }
|
31
|
+
)
|
32
|
+
%>
|
33
|
+
</ul>
|
34
|
+
<% end %>
|
35
|
+
</nav>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% content_for :meta_title, t('.title') %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<span><%= t('.nav_text') %></span>
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<article>
|
7
|
+
<h1><%= t('.heading') %></h1>
|
8
|
+
|
9
|
+
<%=
|
10
|
+
render partial: 'admin/components/list', locals: { collection: @collection }
|
11
|
+
%>
|
12
|
+
</article>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<% if handler.allow?('view', 'edit') %>
|
2
|
+
<!-- <li><%#= render 'admin/users/nav_item' %></li>-->
|
3
|
+
<!-- <li><%#= render 'admin/foreign_users/nav_item' %></li>-->
|
4
|
+
<% end %>
|
5
|
+
<% if handler.administrator? %>
|
6
|
+
<!-- <li><%#= render 'admin/login_attempts/nav_item' %></li>-->
|
7
|
+
<!-- <li><%#= render 'admin/tokens/nav_item' %></li>-->
|
8
|
+
<% end %>
|
9
|
+
<% if handler.allow?('manage_codes') %>
|
10
|
+
<!-- <li><%#= render 'admin/codes/nav_item' %></li>-->
|
11
|
+
<% end %>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', slug: @handler.slug) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.components.index.nav_text'), admin_components_path) %>
|
4
|
+
<%= admin_biovision_component_link(@handler.component, @handler.name) %>
|
5
|
+
<span><%= t('.nav_text') %></span>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<article>
|
9
|
+
<h1><%= @handler.name %></h1>
|
10
|
+
|
11
|
+
<%=
|
12
|
+
render(
|
13
|
+
partial: 'admin/components/privileges/users',
|
14
|
+
locals: {
|
15
|
+
collection: @handler.component.privileges,
|
16
|
+
handler: @handler
|
17
|
+
}
|
18
|
+
)
|
19
|
+
%>
|
20
|
+
</article>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<figure class="image">
|
2
|
+
<%= user_image_small(entity.user) %>
|
3
|
+
</figure>
|
4
|
+
<div class="data">
|
5
|
+
<div><%= admin_user_link(entity.user) %></div>
|
6
|
+
<div>
|
7
|
+
<%=
|
8
|
+
render(
|
9
|
+
partial: 'admin/components/privileges/links',
|
10
|
+
locals: {
|
11
|
+
handler: handler,
|
12
|
+
entity: entity
|
13
|
+
}
|
14
|
+
)
|
15
|
+
%>
|
16
|
+
</div>
|
17
|
+
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<ul class="entity-links">
|
2
|
+
<li>
|
3
|
+
<% element_id = "component_administrator_#{handler.slug}_#{entity.user_id}" %>
|
4
|
+
<%=
|
5
|
+
check_box_tag(
|
6
|
+
'user_id',
|
7
|
+
entity.user_id,
|
8
|
+
entity.administrator?,
|
9
|
+
data: {
|
10
|
+
url: admin_component_administrators_path(slug: handler.slug, user_id: entity.user_id)
|
11
|
+
},
|
12
|
+
id: element_id
|
13
|
+
)
|
14
|
+
%>
|
15
|
+
<%= label_tag(element_id, t('activerecord.attributes.biovision_component_user.administrator')) %>
|
16
|
+
</li>
|
17
|
+
<%
|
18
|
+
privilege_names = handler.class.privilege_names
|
19
|
+
privilege_names.unshift('settings') if handler.use_settings?
|
20
|
+
%>
|
21
|
+
<% privilege_names.each do |privilege_slug| %>
|
22
|
+
<li>
|
23
|
+
<%=
|
24
|
+
render(
|
25
|
+
partial: 'admin/components/privileges/privilege_flag',
|
26
|
+
locals: {
|
27
|
+
entity: entity,
|
28
|
+
handler: handler,
|
29
|
+
slug: privilege_slug
|
30
|
+
}
|
31
|
+
)
|
32
|
+
%>
|
33
|
+
</li>
|
34
|
+
<% end %>
|
35
|
+
</ul>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<% element_id = "component_privilege_#{slug}_#{entity.user_id}" %>
|
2
|
+
<%=
|
3
|
+
check_box_tag(
|
4
|
+
'user_id',
|
5
|
+
entity.user_id,
|
6
|
+
Array(entity.data['privileges']).include?(slug),
|
7
|
+
data: {
|
8
|
+
url: admin_component_privilege_path(
|
9
|
+
privilege_slug: slug,
|
10
|
+
slug: handler.slug,
|
11
|
+
user_id: entity.user_id
|
12
|
+
)
|
13
|
+
},
|
14
|
+
id: element_id
|
15
|
+
)
|
16
|
+
%>
|
17
|
+
<%=
|
18
|
+
label_tag(
|
19
|
+
element_id,
|
20
|
+
t(
|
21
|
+
"biovision.components.#{handler.slug}.privileges.#{slug}",
|
22
|
+
default: [
|
23
|
+
"biovision.components.common.privileges.#{slug}".to_sym,
|
24
|
+
slug
|
25
|
+
]
|
26
|
+
)
|
27
|
+
)
|
28
|
+
%>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<section>
|
2
|
+
<h2><%= t('.heading') %></h2>
|
3
|
+
|
4
|
+
<% if collection.any? %>
|
5
|
+
<ul class="list-of-entities">
|
6
|
+
<% collection.each do |entity| %>
|
7
|
+
<li data-id="<%= entity.id %>">
|
8
|
+
<%=
|
9
|
+
render(
|
10
|
+
partial: 'admin/components/privileges/component_user',
|
11
|
+
locals: {
|
12
|
+
handler: handler,
|
13
|
+
entity: entity
|
14
|
+
}
|
15
|
+
)
|
16
|
+
%>
|
17
|
+
</li>
|
18
|
+
<% end %>
|
19
|
+
</ul>
|
20
|
+
<% else %>
|
21
|
+
<%= render 'shared/nothing_found' %>
|
22
|
+
<% end %>
|
23
|
+
</section>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<% content_for :meta_title, t('.title', slug: @handler.slug) %>
|
2
|
+
<% content_for :breadcrumbs do %>
|
3
|
+
<%= link_to(t('admin.components.index.nav_text'), admin_components_path) %>
|
4
|
+
<%= admin_biovision_component_link(@handler.component, @handler.name) %>
|
5
|
+
<span><%= t('.nav_text') %></span>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<article>
|
9
|
+
<h1><%= @handler.name %></h1>
|
10
|
+
|
11
|
+
<%=
|
12
|
+
render(
|
13
|
+
partial: 'admin/components/settings/settings',
|
14
|
+
locals: {
|
15
|
+
handler: @handler,
|
16
|
+
settings: @handler.component.settings
|
17
|
+
}
|
18
|
+
)
|
19
|
+
%>
|
20
|
+
|
21
|
+
<% if @handler.use_parameters? %>
|
22
|
+
<%=
|
23
|
+
render(
|
24
|
+
partial: 'admin/components/settings/parameters',
|
25
|
+
locals: {
|
26
|
+
handler: @handler,
|
27
|
+
parameters: @handler.component.parameters
|
28
|
+
}
|
29
|
+
)
|
30
|
+
%>
|
31
|
+
|
32
|
+
<%=
|
33
|
+
render(
|
34
|
+
partial: 'admin/components/settings/new_parameter',
|
35
|
+
locals: { handler: @handler }
|
36
|
+
)
|
37
|
+
%>
|
38
|
+
<% end %>
|
39
|
+
</article>
|
@@ -0,0 +1,46 @@
|
|
1
|
+
<section
|
2
|
+
id="biovision-component-new-parameter"
|
3
|
+
data-url="<%= admin_component_parameters_path(slug: handler.slug) %>"
|
4
|
+
>
|
5
|
+
<h2><%= t('.heading') %></h2>
|
6
|
+
|
7
|
+
<dl>
|
8
|
+
<div>
|
9
|
+
<dt><%= label_tag(:new_parameter_slug, t('.parameter_slug')) %></dt>
|
10
|
+
<dd>
|
11
|
+
<%=
|
12
|
+
text_field_tag(
|
13
|
+
:slug,
|
14
|
+
'',
|
15
|
+
autocomplete: :off,
|
16
|
+
id: :new_parameter_slug,
|
17
|
+
maxlength: 50,
|
18
|
+
pattern: BiovisionComponent::SLUG_PATTERN_HTML,
|
19
|
+
required: true,
|
20
|
+
size: nil
|
21
|
+
)
|
22
|
+
%>
|
23
|
+
<div class="guideline"><%= t('.guidelines.slug') %></div>
|
24
|
+
</dd>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div>
|
28
|
+
<dt><%= label_tag(:new_parameter_value, t('.parameter_value')) %></dt>
|
29
|
+
<dd>
|
30
|
+
<%=
|
31
|
+
text_field_tag(
|
32
|
+
:value,
|
33
|
+
'',
|
34
|
+
autocomplete: :off,
|
35
|
+
id: :new_parameter_value,
|
36
|
+
maxlength: 255,
|
37
|
+
size: nil
|
38
|
+
)
|
39
|
+
%>
|
40
|
+
<div class="guideline"><%= t('.guidelines.value') %></div>
|
41
|
+
</dd>
|
42
|
+
</div>
|
43
|
+
</dl>
|
44
|
+
|
45
|
+
<%= button_tag(t(:save), class: 'button-save', type: :button) %>
|
46
|
+
</section>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<section
|
2
|
+
id="biovision-component-parameters"
|
3
|
+
data-url="<%= admin_component_parameters_path(slug: handler.slug) %>"
|
4
|
+
>
|
5
|
+
<h2><%= t('.heading') %></h2>
|
6
|
+
|
7
|
+
<dl>
|
8
|
+
<% parameters.each do |parameter, value| %>
|
9
|
+
<% element_id = "parameter-#{parameter}" %>
|
10
|
+
<div>
|
11
|
+
<dt><%= label_tag(element_id, parameter) %></dt>
|
12
|
+
<dd>
|
13
|
+
<%=
|
14
|
+
text_field_tag(parameter, value, autocomplete: :off, id: element_id)
|
15
|
+
%>
|
16
|
+
</dd>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
</dl>
|
20
|
+
</section>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<%
|
2
|
+
element_id = "setting-#{key}"
|
3
|
+
element_name = "component[settings][#{key}]"
|
4
|
+
key_name = t("biovision.components.#{slug}.settings.#{key}", default: key)
|
5
|
+
%>
|
6
|
+
<div>
|
7
|
+
<% if value.is_a?(Numeric) %>
|
8
|
+
<%= label_tag(element_id, key_name) %>
|
9
|
+
<%= number_field_tag(element_name, value, class: 'input-text', id: element_id) %>
|
10
|
+
<% elsif [true, false].include?(value) %>
|
11
|
+
<%= hidden_field_tag(element_name, '0', id: nil) %>
|
12
|
+
<%= check_box_tag(element_name, '1', value, id: element_id) %>
|
13
|
+
<%= label_tag(element_id, key_name) %>
|
14
|
+
<% else %>
|
15
|
+
<%= label_tag(element_id, key_name) %>
|
16
|
+
<%= text_field_tag(element_name, value, class: 'input-text', id: element_id) %>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<% if settings.any? %>
|
2
|
+
<section class="biovision-component-settings">
|
3
|
+
<h2><%= t('.heading') %></h2>
|
4
|
+
|
5
|
+
<%=
|
6
|
+
form_with(
|
7
|
+
url: admin_component_settings_path(slug: handler.slug),
|
8
|
+
method: :patch,
|
9
|
+
local: true
|
10
|
+
) do
|
11
|
+
%>
|
12
|
+
<div class="fields">
|
13
|
+
<% settings.each do |key, value| %>
|
14
|
+
<%=
|
15
|
+
render(
|
16
|
+
partial: 'admin/components/settings/setting',
|
17
|
+
locals: {
|
18
|
+
slug: handler.slug,
|
19
|
+
key: key,
|
20
|
+
value: value
|
21
|
+
}
|
22
|
+
)
|
23
|
+
%>
|
24
|
+
<% end %>
|
25
|
+
</div>
|
26
|
+
<div class="buttons">
|
27
|
+
<%= button_tag(t(:update), type: :submit, class: 'button-save') %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
</section>
|
31
|
+
<% end %>
|