biovision 0.4.210512.0 → 0.12.211124.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +7 -5
  3. data/app/assets/stylesheets/biovision/admin/layout.scss +34 -0
  4. data/app/assets/stylesheets/biovision/biovision.scss +56 -26
  5. data/app/assets/stylesheets/biovision/components/filters.scss +0 -2
  6. data/app/assets/stylesheets/biovision/components/forms.scss +40 -10
  7. data/app/assets/stylesheets/biovision/themes/default_theme/layout/header.scss +10 -0
  8. data/app/controllers/admin/biovision_components_controller.rb +10 -0
  9. data/app/controllers/admin/components_controller.rb +9 -5
  10. data/app/controllers/admin/users_controller.rb +2 -1
  11. data/app/controllers/admin_controller.rb +2 -22
  12. data/app/controllers/concerns/component_stories.rb +22 -0
  13. data/app/controllers/concerns/crud_entities.rb +12 -4
  14. data/app/controllers/concerns/my_crud_entities.rb +146 -0
  15. data/app/controllers/concerns/processed_forms.rb +28 -0
  16. data/app/controllers/concerns/restricted_access.rb +37 -0
  17. data/app/controllers/errors_controller.rb +37 -0
  18. data/app/controllers/my/components_controller.rb +21 -0
  19. data/app/controllers/my/index_controller.rb +1 -3
  20. data/app/controllers/my/profiles_controller.rb +2 -0
  21. data/app/controllers/oembed_controller.rb +12 -0
  22. data/app/controllers/profile_controller.rb +2 -0
  23. data/app/controllers/users_controller.rb +2 -0
  24. data/app/helpers/biovision_helper.rb +16 -1
  25. data/app/helpers/entity_helper.rb +77 -0
  26. data/app/helpers/my_helper.rb +34 -0
  27. data/app/lib/biovision/components/base/component_parameters.rb +6 -3
  28. data/app/lib/biovision/components/base/component_privileges.rb +4 -3
  29. data/app/lib/biovision/components/base/component_stories.rb +30 -0
  30. data/app/lib/biovision/components/base/entity_links.rb +16 -2
  31. data/app/lib/biovision/components/base/image_handling.rb +33 -0
  32. data/app/lib/biovision/components/base_component.rb +6 -27
  33. data/app/lib/biovision/components/content/oembed/receiver.rb +98 -0
  34. data/app/lib/biovision/components/content/oembed/twitter_receiver.rb +20 -0
  35. data/app/lib/biovision/components/content/oembed/vimeo_receiver.rb +20 -0
  36. data/app/lib/biovision/components/content/oembed/youtube_receiver.rb +20 -0
  37. data/app/lib/biovision/components/content_component.rb +14 -3
  38. data/app/lib/biovision/components/users_component.rb +6 -0
  39. data/app/lib/biovision/helpers/data_helper.rb +31 -4
  40. data/app/lib/biovision/helpers/export_helper.rb +97 -0
  41. data/app/lib/biovision/migrations/component_migration.rb +3 -1
  42. data/app/lib/biovision/stories/component_story.rb +55 -0
  43. data/app/models/biovision_component.rb +14 -1
  44. data/app/models/code.rb +3 -3
  45. data/app/models/concerns/checkable.rb +2 -1
  46. data/app/models/concerns/has_uploaded_file.rb +26 -0
  47. data/app/models/concerns/simple_tag.rb +30 -0
  48. data/app/models/concerns/toggleable.rb +2 -1
  49. data/app/models/concerns/tree_structure.rb +2 -0
  50. data/app/models/metric.rb +4 -0
  51. data/app/models/oembed_domain.rb +25 -0
  52. data/app/models/oembed_link.rb +19 -0
  53. data/app/models/oembed_receiver.rb +15 -0
  54. data/app/models/role.rb +4 -12
  55. data/app/models/simple_image.rb +29 -2
  56. data/app/models/simple_image_tag.rb +1 -16
  57. data/app/models/uploaded_file.rb +62 -0
  58. data/app/models/uploaded_file_tag.rb +15 -0
  59. data/app/models/uploaded_file_tag_file.rb +13 -0
  60. data/app/models/user.rb +10 -0
  61. data/app/models/user_role.rb +0 -1
  62. data/app/uploaders/simple_file_uploader.rb +2 -6
  63. data/app/uploaders/simple_image_uploader.rb +3 -20
  64. data/app/uploaders/uploaders/path_slug.rb +22 -0
  65. data/app/views/admin/agents/index.html.erb +1 -1
  66. data/app/views/admin/biovision_components/_nav_item.html.erb +6 -0
  67. data/app/views/admin/biovision_components/entity/_in_list.html.erb +12 -0
  68. data/app/views/admin/biovision_components/index.html.erb +11 -0
  69. data/app/views/admin/components/links/_base.html.erb +1 -1
  70. data/app/views/admin/dynamic_blocks/_form.html.erb +1 -1
  71. data/app/views/admin/dynamic_blocks/entity/_in_list.html.erb +1 -1
  72. data/app/views/admin/dynamic_blocks/index.html.erb +1 -1
  73. data/app/views/admin/dynamic_blocks/show.html.erb +3 -3
  74. data/app/views/admin/dynamic_pages/entity/_in_list.html.erb +1 -1
  75. data/app/views/admin/dynamic_pages/index.html.erb +1 -6
  76. data/app/views/admin/dynamic_pages/show.html.erb +1 -1
  77. data/app/views/admin/index/index.html.erb +1 -1
  78. data/app/views/admin/ip_addresses/index.html.erb +2 -2
  79. data/app/views/admin/navigation_groups/index.html.erb +1 -6
  80. data/app/views/admin/tokens/entity/_in_list.html.erb +1 -1
  81. data/app/views/admin/tokens/index.html.erb +1 -6
  82. data/app/views/admin/tokens/show.html.erb +1 -1
  83. data/app/views/admin/users/entity/_in_list.html.erb +2 -4
  84. data/app/views/admin/users/index.html.erb +1 -1
  85. data/app/views/admin/users/show.html.erb +18 -12
  86. data/app/views/admin/widgets/_filters.html.erb +7 -2
  87. data/app/views/admin/widgets/filters/_text.html.erb +7 -0
  88. data/app/views/errors/error.html.erb +1 -0
  89. data/app/views/layouts/admin/_header.html.erb +7 -2
  90. data/app/views/layouts/application/header/_authentication.html.erb +4 -1
  91. data/app/views/my/components/index.html.erb +25 -0
  92. data/app/views/my/components/show.html.erb +21 -0
  93. data/app/views/my/index/_cards.html.erb +15 -0
  94. data/app/views/my/index/_email.html.erb +14 -0
  95. data/app/views/my/index/_navigation.html.erb +33 -0
  96. data/app/views/my/index/index.html.erb +3 -50
  97. data/app/views/my/profiles/show.html.erb +13 -0
  98. data/app/views/shared/admin/_list.html.erb +10 -19
  99. data/app/views/shared/admin/_list_with_priority.html.erb +10 -19
  100. data/app/views/shared/admin/_priority.html.erb +6 -5
  101. data/app/views/shared/admin/_toggle.html.erb +5 -10
  102. data/app/views/shared/entity/_date_field.html.erb +6 -0
  103. data/app/views/shared/entity/_linked_entity.html.erb +1 -1
  104. data/app/views/shared/entity/_list.html.erb +22 -0
  105. data/app/views/shared/entity/_list_with_priority.html.erb +22 -0
  106. data/app/views/shared/entity/_priority_icons.html.erb +8 -0
  107. data/app/views/shared/entity/_toggle.html.erb +12 -0
  108. data/app/views/shared/forms/_field.html.erb +5 -1
  109. data/app/views/shared/forms/_field_with_search.html.erb +17 -0
  110. data/app/views/shared/forms/_meta_texts.html.erb +1 -1
  111. data/app/views/shared/forms/_simple_entity_link.html.erb +14 -0
  112. data/app/views/shared/my/_list.html.erb +10 -19
  113. data/app/views/shared/my/_list_with_priority.html.erb +10 -19
  114. data/app/views/shared/my/entity/edit.html.erb +25 -0
  115. data/app/views/shared/my/entity/new.html.erb +18 -0
  116. data/app/views/simple_images/_simple_image.jbuilder +13 -0
  117. data/config/locales/biovision-ru.yml +4 -0
  118. data/config/locales/components-ru.yml +23 -2
  119. data/config/locales/content-ru.yml +8 -0
  120. data/config/locales/users-ru.yml +4 -1
  121. data/config/routes.rb +21 -0
  122. data/db/migrate/20200224000010_create_users_component.rb +0 -11
  123. data/db/migrate/20200404000000_create_simple_images.rb +1 -0
  124. data/db/migrate/20210405000000_create_acl.rb +0 -1
  125. data/db/migrate/20210421000000_create_content_component.rb +21 -0
  126. data/db/migrate/20210616000000_create_uploaded_files.rb +52 -0
  127. data/db/migrate/amends/20210816060606_create_oembed_receivers.rb +21 -0
  128. data/db/migrate/amends/20210907070707_add_checksum_to_simple_images.rb +13 -0
  129. data/lib/biovision/base_methods.rb +0 -27
  130. data/lib/biovision/version.rb +1 -1
  131. data/lib/tasks/components.rake +51 -0
  132. metadata +53 -4
  133. data/app/models/biovision_component_user.rb +0 -21
@@ -19,5 +19,18 @@
19
19
  </nav>
20
20
 
21
21
  <%= render partial: 'users/profile', locals: { user: current_user } %>
22
+
23
+ <% prefix = 'my/profiles/components/' %>
24
+ <% BiovisionComponent.list_for_user.each do |component| %>
25
+ <% handler = Biovision::Components::BaseComponent.handler(component, current_user) %>
26
+ <% if lookup_context.exists?("#{prefix}_#{component.slug}") %>
27
+ <%=
28
+ render(
29
+ partial: "#{prefix}#{component.slug}",
30
+ locals: { handler: handler }
31
+ )
32
+ %>
33
+ <% end %>
34
+ <% end %>
22
35
  </div>
23
36
  </article>
@@ -1,19 +1,10 @@
1
- <% use_pagination = collection.respond_to?(:current_page) %>
2
- <%= paginate collection if use_pagination %>
3
- <% if collection.any? %>
4
- <ul class="list-of-entities">
5
- <% collection.each do |entity| %>
6
- <li data-id="<%= entity.id %>">
7
- <%=
8
- render(
9
- partial: "admin/#{entity.class.table_name}/entity/in_list",
10
- locals: { entity: entity, handler: local_assigns[:handler] }
11
- )
12
- %>
13
- </li>
14
- <% end %>
15
- </ul>
16
- <%= paginate collection if use_pagination %>
17
- <% else %>
18
- <%= render 'shared/nothing_found' %>
19
- <% end %>
1
+ <%=
2
+ render(
3
+ partial: 'shared/entity/list',
4
+ locals: {
5
+ collection: collection,
6
+ handler: local_assigns[:handler],
7
+ scope: :admin
8
+ }
9
+ )
10
+ %>
@@ -1,19 +1,10 @@
1
- <% use_pagination = collection.respond_to?(:current_page) %>
2
- <%= paginate collection if use_pagination %>
3
- <% if collection.any? %>
4
- <ol class="list-of-entities">
5
- <% collection.each do |entity| %>
6
- <li data-id="<%= entity.id %>" data-number="<%= entity.priority %>">
7
- <%=
8
- render(
9
- partial: "admin/#{entity.class.table_name}/entity/in_list",
10
- locals: { entity: entity, handler: local_assigns[:handler] }
11
- )
12
- %>
13
- </li>
14
- <% end %>
15
- </ol>
16
- <%= paginate collection if use_pagination %>
17
- <% else %>
18
- <%= render 'shared/nothing_found' %>
19
- <% end %>
1
+ <%=
2
+ render(
3
+ partial: 'shared/entity/list_with_priority',
4
+ locals: {
5
+ collection: collection,
6
+ handler: local_assigns[:handler],
7
+ scope: :admin
8
+ }
9
+ )
10
+ %>
@@ -1,5 +1,6 @@
1
- <% url = "/admin/#{entity.class.table_name}/#{entity.id}/priority" %>
2
- <div class="priority-changer" data-url="<%= url %>">
3
- <button data-delta="-1" type="button">&uarr;</button>
4
- <button data-delta="1" type="button">&darr;</button>
5
- </div>
1
+ <%=
2
+ render(
3
+ partial: 'shared/entity/priority_icons',
4
+ locals: { entity: entity, scope: :admin }
5
+ )
6
+ %>
@@ -1,11 +1,6 @@
1
- <%
2
- model = entity.class
3
- url = "/admin/#{model.table_name}/#{entity.id}/toggle"
1
+ <%=
2
+ render(
3
+ partial: 'shared/entity/toggle',
4
+ locals: { entity: entity, scope: :admin }
5
+ )
4
6
  %>
5
- <div class="toggleable" data-url="<%= url %>">
6
- <% model.toggleable_attributes.each do |flag| %>
7
- <span class="<%= entity.attributes[flag.to_s] ? 'active' : 'inactive' %>" data-flag="<%= flag %>">
8
- <%= model.human_attribute_name(flag) %>
9
- </span>
10
- <% end %>
11
- </div>
@@ -0,0 +1,6 @@
1
+ <% unless entity.attributes[field.to_s].blank? %>
2
+ <div>
3
+ <dt><%= entity.class.human_attribute_name(field) %></dt>
4
+ <dd><%= time_tag(entity.attributes[field.to_s]) %></dd>
5
+ </div>
6
+ <% end %>
@@ -1,6 +1,6 @@
1
1
  <% unless entity.nil? %>
2
2
  <div>
3
- <dt><%= entity.class.model_name.human %></dt>
3
+ <dt><%= local_assigns[:text] || entity.class.model_name.human %></dt>
4
4
  <dd><%= admin_entity_link(entity, handler: local_assigns[:handler]) %></dd>
5
5
  </div>
6
6
  <% end %>
@@ -0,0 +1,22 @@
1
+ <%
2
+ view_scope = %i[admin my].include?(local_assigns[:scope].to_sym) ? "#{scope}/" : ''
3
+ use_pagination = collection.respond_to?(:current_page)
4
+ %>
5
+ <%= paginate collection if use_pagination %>
6
+ <% if collection.any? %>
7
+ <ul class="list-of-entities">
8
+ <% collection.each do |entity| %>
9
+ <li data-id="<%= entity.id %>">
10
+ <%=
11
+ render(
12
+ partial: "#{view_scope}#{entity.class.table_name}/entity/in_list",
13
+ locals: { entity: entity, handler: local_assigns[:handler] }
14
+ )
15
+ %>
16
+ </li>
17
+ <% end %>
18
+ </ul>
19
+ <%= paginate collection if use_pagination %>
20
+ <% else %>
21
+ <%= render 'shared/nothing_found' %>
22
+ <% end %>
@@ -0,0 +1,22 @@
1
+ <%
2
+ view_scope = %i[admin my].include?(local_assigns[:scope].to_sym) ? "#{scope}/" : ''
3
+ use_pagination = collection.respond_to?(:current_page)
4
+ %>
5
+ <%= paginate collection if use_pagination %>
6
+ <% if collection.any? %>
7
+ <ol class="list-of-entities">
8
+ <% collection.each do |entity| %>
9
+ <li data-id="<%= entity.id %>" data-number="<%= entity.priority %>">
10
+ <%=
11
+ render(
12
+ partial: "#{view_scope}#{entity.class.table_name}/entity/in_list",
13
+ locals: { entity: entity, handler: local_assigns[:handler] }
14
+ )
15
+ %>
16
+ </li>
17
+ <% end %>
18
+ </ol>
19
+ <%= paginate collection if use_pagination %>
20
+ <% else %>
21
+ <%= render 'shared/nothing_found' %>
22
+ <% end %>
@@ -0,0 +1,8 @@
1
+ <%
2
+ view_scope = %i[admin my].include?(local_assigns[:scope].to_sym) ? "#{scope}/" : ''
3
+ url = "/#{view_scope}#{entity.class.table_name}/#{entity.id}/priority"
4
+ %>
5
+ <div class="priority-changer" data-url="<%= url %>">
6
+ <button data-delta="-1" type="button">&uarr;</button>
7
+ <button data-delta="1" type="button">&darr;</button>
8
+ </div>
@@ -0,0 +1,12 @@
1
+ <%
2
+ view_scope = %i[admin my].include?(local_assigns[:scope].to_sym) ? "#{scope}/" : ''
3
+ model = entity.class
4
+ url = "/#{view_scope}#{model.table_name}/#{entity.id}/toggle"
5
+ %>
6
+ <div class="toggleable" data-url="<%= url %>">
7
+ <% model.toggleable_attributes.each do |flag| %>
8
+ <span class="<%= entity.attributes[flag.to_s] ? 'active' : 'inactive' %>" data-flag="<%= flag %>">
9
+ <%= model.human_attribute_name(flag) %>
10
+ </span>
11
+ <% end %>
12
+ </div>
@@ -5,6 +5,7 @@
5
5
  validators = model.validators_on(field)
6
6
  length_options = validators.select { |v| v.kind == :length }.first&.options.to_h
7
7
  range_option = validators.select { |v| v.kind == :inclusion }.first&.options.to_h
8
+ # numericality = validators.select { |v| v.kind == :numericality }.first&.options.to_h
8
9
  options = {
9
10
  class: 'input-text',
10
11
  data: { check: field }.merge(local_assigns[:data].to_h),
@@ -13,7 +14,8 @@
13
14
  required: validators.select { |v| v.kind == :presence }.any?,
14
15
  size: nil
15
16
  }
16
- guide_key = "#{controller_path.gsub('/', '.')}.form.guidelines.#{field}"
17
+ legacy_guide_key = "#{controller_path.gsub('/', '.')}.form.guidelines.#{field}"
18
+ guide_key = "guidelines.#{model.to_s.underscore}.#{field}"
17
19
  %>
18
20
  <div>
19
21
  <dt><%= f.label field %></dt>
@@ -41,6 +43,8 @@
41
43
  <div class="check-result-error" data-field="<%= field %>"></div>
42
44
  <% if I18n.exists?(guide_key) %>
43
45
  <div class="guideline"><%= t(guide_key) %></div>
46
+ <% elsif I18n.exists?(legacy_guide_key) %>
47
+ <div class="guideline"><%= t(legacy_guide_key) %></div>
44
48
  <% end %>
45
49
  </dd>
46
50
  </div>
@@ -0,0 +1,17 @@
1
+ <% placeholder ||= t('.search') %>
2
+ <div>
3
+ <dt><%= f.label field %></dt>
4
+ <dd class="js-searchable-list searchable-list" data-url="<%= endpoint %>">
5
+ <div class="current">
6
+ <%= f.hidden_field field %>
7
+ <span class="text"><%= local_assigns[:current] %></span>
8
+ </div>
9
+ <div class="search">
10
+ <label class="floating-label">
11
+ <input placeholder="<%= placeholder %>" type="search" class="input-text"/>
12
+ <span><%= placeholder %></span>
13
+ </label>
14
+ <ul class="results"></ul>
15
+ </div>
16
+ </dd>
17
+ </div>
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
  <dt><%= t('.name') %></dt>
4
4
  <dd>
5
- <ul class="flags">
5
+ <ul class="meta-texts">
6
6
  <% entity.class.meta_keys.each do |key| %>
7
7
  <li>
8
8
  <label class="floating-label" title="<%= key %>">
@@ -0,0 +1,14 @@
1
+ <% preset = local_assigns[:blank] ? [[t(:not_set), '']] : [] %>
2
+ <div>
3
+ <dt><%= f.label(field) %></dt>
4
+ <dd>
5
+ <%=
6
+ f.select(
7
+ field,
8
+ preset + linked_model.list_for_administration.map { |e| [e.text_for_link, e.id ]},
9
+ class: 'input-select',
10
+ required: local_assigns[:required]
11
+ )
12
+ %>
13
+ </dd>
14
+ </div>
@@ -1,19 +1,10 @@
1
- <% use_pagination = collection.respond_to?(:current_page) %>
2
- <%= paginate collection if use_pagination %>
3
- <% if collection.any? %>
4
- <ul class="list-of-entities">
5
- <% collection.each do |entity| %>
6
- <li data-id="<%= entity.id %>">
7
- <%=
8
- render(
9
- partial: "my/#{entity.class.table_name}/entity/in_list",
10
- locals: { entity: entity, handler: local_assigns[:handler] }
11
- )
12
- %>
13
- </li>
14
- <% end %>
15
- </ul>
16
- <%= paginate collection if use_pagination %>
17
- <% else %>
18
- <%= render 'shared/nothing_found' %>
19
- <% end %>
1
+ <%=
2
+ render(
3
+ partial: 'shared/entity/list',
4
+ locals: {
5
+ collection: collection,
6
+ handler: local_assigns[:handler],
7
+ scope: :my
8
+ }
9
+ )
10
+ %>
@@ -1,19 +1,10 @@
1
- <% use_pagination = collection.respond_to?(:current_page) %>
2
- <%= paginate collection if use_pagination %>
3
- <% if collection.any? %>
4
- <ol class="list-of-entities">
5
- <% collection.each do |entity| %>
6
- <li data-id="<%= entity.id %>" data-number="<%= entity.priority %>">
7
- <%=
8
- render(
9
- partial: "my/#{entity.class.table_name}/entity/in_list",
10
- locals: { entity: entity, handler: local_assigns[:handler] }
11
- )
12
- %>
13
- </li>
14
- <% end %>
15
- </ol>
16
- <%= paginate collection if use_pagination %>
17
- <% else %>
18
- <%= render 'shared/nothing_found' %>
19
- <% end %>
1
+ <%=
2
+ render(
3
+ partial: 'shared/entity/list_with_priority',
4
+ locals: {
5
+ collection: collection,
6
+ handler: local_assigns[:handler],
7
+ scope: :my
8
+ }
9
+ )
10
+ %>
@@ -0,0 +1,25 @@
1
+ <%
2
+ prefix = controller_path.gsub('/', '.')
3
+ default_title = "#{@entity.class.model_name.human}: #{t('shared.entity.edit.nav_text')}"
4
+ %>
5
+ <% content_for :meta_title, t("#{prefix}.edit.title", default: default_title) %>
6
+ <% content_for :breadcrumbs do %>
7
+ <%= my_home_link %>
8
+ <%= link_to(t("#{prefix}.index.nav_text"), "/#{controller_path}") %>
9
+ <%= my_entity_link(@entity, handler: component_handler) %>
10
+ <span><%= t('shared.entity.edit.nav_text') %></span>
11
+ <% end %>
12
+
13
+ <article>
14
+ <div class="content-wrapper">
15
+ <h1><%= t("#{prefix}.edit.heading", default: default_title) %></h1>
16
+
17
+ <% if component_handler.permit?('edit', @entity) %>
18
+ <nav class="entity-actions">
19
+ <%= destroy_icon(@entity) %>
20
+ </nav>
21
+ <% end %>
22
+
23
+ <%= render partial: "#{controller_path}/form", locals: { entity: @entity } %>
24
+ </div>
25
+ </article>
@@ -0,0 +1,18 @@
1
+ <%
2
+ prefix = controller_path.gsub('/', '.')
3
+ default_title = "#{@entity.class.model_name.human}: #{t('shared.entity.new.nav_text')}"
4
+ %>
5
+ <% content_for :meta_title, t("#{prefix}.new.title", default: default_title) %>
6
+ <% content_for :breadcrumbs do %>
7
+ <%= my_home_link %>
8
+ <%= link_to(t("#{prefix}.index.nav_text"), "/#{controller_path}") %>
9
+ <span><%= t('shared.entity.new.nav_text') %></span>
10
+ <% end %>
11
+
12
+ <article>
13
+ <div class="content-wrapper">
14
+ <h1><%= t("#{prefix}.new.heading", default: default_title) %></h1>
15
+
16
+ <%= render partial: "#{controller_path}/form", locals: { entity: @entity } %>
17
+ </div>
18
+ </article>
@@ -0,0 +1,13 @@
1
+ json.id simple_image.uuid
2
+ json.type SimpleImage.table_name
3
+ json.attributes do
4
+ json.call(simple_image, *SimpleImage.json_attributes)
5
+ end
6
+ json.meta do
7
+ json.hd_url simple_image.image.hd_url
8
+ json.large_url simple_image.image.large_url
9
+ json.medium_url simple_image.image.medium_url
10
+ json.small_url simple_image.image.small_url
11
+ json.preview_url simple_image.image.preview_url
12
+ json.tiny_url simple_image.image.tiny_url
13
+ end
@@ -74,12 +74,14 @@ ru:
74
74
  home: "Главная"
75
75
  application:
76
76
  errors:
77
+ bad_request: "Плохой запрос (400)."
77
78
  forbidden: "Запрещено (403)."
78
79
  internal_server_error: "Внутренняя ошибка сервера (500)."
79
80
  not_found: "Страница не найдена (404)."
80
81
  restricted_access: "Доступ к странице ограничен (401)."
81
82
  service_unavailable: "Сервис временно недоступен (503)."
82
83
  unauthorized: "Не хватает прав для просмотра страницы (401)."
84
+ unprocessable_entity: "Сущность нельзя обработать (422)."
83
85
  unauthorized:
84
86
  title: "Доступ ограничен"
85
87
  heading: "Доступ ограничен"
@@ -143,6 +145,8 @@ ru:
143
145
  saving: "Сохранение…"
144
146
  meta_texts:
145
147
  name: "Метаданные"
148
+ field_with_search:
149
+ search: "Поиск"
146
150
  entity:
147
151
  edit:
148
152
  nav_text: "Редактировать"
@@ -17,6 +17,9 @@ ru:
17
17
  simple_image: "Простое изображение"
18
18
  simple_image_tag: "Метка простого изображения"
19
19
  simple_image_tag_image: "Связь метки и простого изображения"
20
+ uploaded_file: "Загруженный файл"
21
+ uploaded_file_tag: "Метка загруженного файла"
22
+ uploaded_file_tag_file: "Связь метки и загруженного файла"
20
23
  user_group: "Пользователь в группе доступа"
21
24
  user_role: "Роль доступа для пользователя"
22
25
  attributes:
@@ -52,8 +55,8 @@ ru:
52
55
  simple_image_tag_image:
53
56
  simple_image_tag: "Метка"
54
57
  simple_image_tag_id: "Метка"
55
- user_role:
56
- inclusive: "Инклюзивно"
58
+ uploaded_file:
59
+ attachment: "Приложение"
57
60
  attributes:
58
61
  biovision_component: "Компонент"
59
62
  biovision_component_id: "Компонент"
@@ -63,6 +66,8 @@ ru:
63
66
  role_id: "Роль доступа"
64
67
  simple_image: "Изображение"
65
68
  simple_image_id: "Изображение"
69
+ uploaded_file: "Загруженный файл"
70
+ uploaded_file_id: "Загруженный файл"
66
71
  languages:
67
72
  english: "Английский"
68
73
  russian: "Русский"
@@ -93,6 +98,13 @@ ru:
93
98
  heading: "Компоненты"
94
99
  show:
95
100
  title: "Компонент «%{slug}»"
101
+ biovision_components:
102
+ index:
103
+ title: "Компоненты CMS"
104
+ heading: "Компоненты"
105
+ nav_item:
106
+ text: "Компоненты CMS"
107
+ description: "Управление списком компонентов CMS"
96
108
  shared:
97
109
  forms:
98
110
  simple_image:
@@ -109,3 +121,12 @@ ru:
109
121
  components:
110
122
  base:
111
123
  name: "Базовый компонент"
124
+ my:
125
+ components:
126
+ index:
127
+ title: "Сводка"
128
+ nav_text: "Сводка"
129
+ heading: "Сводка"
130
+ show:
131
+ title: "%{component}: сводка"
132
+ no_view: "Для этого компонента нет представления"
@@ -11,6 +11,9 @@ ru:
11
11
  dynamic_page: "Динамическая страница"
12
12
  navigation_group: "Группа навигации"
13
13
  navigation_group_page: "Страница в группе навигации"
14
+ oembed_domain: "Домен для ссылок OEmbed"
15
+ oembed_link: "Ссылка в oembed"
16
+ oembed_receiver: "Обработчик ссылок oembed"
14
17
  attributes:
15
18
  dynamic_block:
16
19
  body: "Содержимое"
@@ -24,6 +27,11 @@ ru:
24
27
  navigation_group_page:
25
28
  navigation_group: "Группа навигации"
26
29
  dynamic_page: "Динамическая страница"
30
+ oembed_domain:
31
+ oembed_receiver_id: "Обработчик"
32
+ oembed_link:
33
+ code: "Код для вставки"
34
+ url: "URL"
27
35
  admin:
28
36
  dynamic_blocks:
29
37
  destroy:
@@ -166,11 +166,12 @@ ru:
166
166
  sensitive_parameters_require_password: "Это связанные с безопасностью параметры. Для их изменения нужно ввести текущий пароль."
167
167
  new_password: "Новый пароль"
168
168
  index:
169
+ email:
170
+ email_is_not_confirmed: "Ваш адрес электронной почты не подтверждён."
169
171
  index:
170
172
  title: "Личный кабинет"
171
173
  nav_text: "Личный кабинет"
172
174
  heading: "Личный кабинет"
173
- email_is_not_confirmed: "Ваш адрес электронной почты не подтверждён."
174
175
  confirmations:
175
176
  show:
176
177
  nav_text: "Подтвердить email"
@@ -258,6 +259,8 @@ ru:
258
259
  nav_text: "Жетоны"
259
260
  title: "Жетоны доступа пользователя %{user}"
260
261
  heading: "Жетоны доступа"
262
+ authenticate:
263
+ nav_text: "Войти как этот пользователь"
261
264
  users:
262
265
  profile:
263
266
  registration_date: "Дата регистрации"
data/config/routes.rb CHANGED
@@ -17,6 +17,10 @@ Rails.application.routes.draw do
17
17
  get :search, on: :collection
18
18
  end
19
19
 
20
+ concern :stories do
21
+ post 'stories/:slug' => :story, on: :collection, as: :story
22
+ end
23
+
20
24
  # Handling errors
21
25
  match '/400' => 'errors#bad_request', via: :all
22
26
  match '/401' => 'errors#unauthorized', via: :all
@@ -55,6 +59,8 @@ Rails.application.routes.draw do
55
59
  namespace :admin do
56
60
  get '/' => 'index#index'
57
61
 
62
+ resources :biovision_components, only: :index, concerns: %i[priority toggle]
63
+
58
64
  scope :components, controller: :components do
59
65
  get '/' => :index, as: :components
60
66
  scope ':slug' do
@@ -89,6 +95,7 @@ Rails.application.routes.draw do
89
95
  get 'roles'
90
96
  put 'roles/:role_id' => :add_role, as: :role
91
97
  delete 'roles/:role_id' => :remove_role
98
+ post 'authenticate'
92
99
  end
93
100
  end
94
101
  resources :tokens, concerns: %i[toggle]
@@ -99,7 +106,21 @@ Rails.application.routes.draw do
99
106
 
100
107
  resource :profile, except: :destroy, concerns: :check
101
108
  resource :confirmation, :recovery, only: %i[show create update]
109
+
110
+ scope :components, controller: :components do
111
+ get '/' => :index, as: :components
112
+ scope ':slug' do
113
+ get '/' => :show, as: :component
114
+ get 'images' => :images, as: :component_images
115
+ post 'images' => :create_image, as: nil
116
+ post 'ckeditor'
117
+ end
118
+ end
119
+ get 'dashboard' => 'components#index'
120
+ get 'dashboard/:slug' => 'components#show', as: :component_dashboard
102
121
  end
103
122
 
123
+ post 'oembed' => 'oembed#code'
124
+
104
125
  get ':slug' => 'fallback#show', constraints: { slug: /.+/ }
105
126
  end
@@ -88,17 +88,6 @@ class CreateUsersComponent < ActiveRecord::Migration[6.1]
88
88
  end
89
89
  end
90
90
 
91
- def create_biovision_component_users
92
- create_table :biovision_component_users, comment: 'Settings for users in components' do |t|
93
- t.references :biovision_component, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
94
- t.references :user, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
95
- t.timestamps
96
- t.jsonb :data, default: {}, null: false
97
- end
98
-
99
- add_index :biovision_component_users, :data, using: :gin
100
- end
101
-
102
91
  def create_codes
103
92
  create_table :codes, comment: 'Codes for different purposes' do |t|
104
93
  t.references :biovision_component, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
@@ -30,6 +30,7 @@ class CreateSimpleImages < ActiveRecord::Migration[6.0]
30
30
  t.string :caption
31
31
  t.string :source_name
32
32
  t.string :source_link
33
+ t.string :checksum, index: true
33
34
  t.jsonb :data, default: {}, null: false
34
35
  end
35
36
 
@@ -69,7 +69,6 @@ class CreateAcl < ActiveRecord::Migration[6.1]
69
69
  create_table :user_roles, comment: 'Users with (and without) ACL roles' do |t|
70
70
  t.references :user, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
71
71
  t.references :role, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
72
- t.boolean :inclusive, default: true, null: false
73
72
  t.timestamps
74
73
  end
75
74
  end
@@ -56,4 +56,25 @@ class CreateContentComponent < ActiveRecord::Migration[6.1]
56
56
  add_index :dynamic_blocks, :slug, unique: true
57
57
  add_index :dynamic_blocks, :data, using: :gin
58
58
  end
59
+
60
+ def create_oembed_receivers
61
+ create_table :oembed_receivers, comment: 'Receivers for OEmbed content' do |t|
62
+ t.string :slug, null: false, index: true
63
+ end
64
+ end
65
+
66
+ def create_oembed_domains
67
+ create_table :oembed_domains, comment: 'Supported domains for OEmbed' do |t|
68
+ t.references :oembed_receiver, foreign_key: { on_update: :cascade, on_delete: :nullify }
69
+ t.string :name, null: false, index: true
70
+ end
71
+ end
72
+
73
+ def create_oembed_links
74
+ create_table :oembed_links, comment: 'Embedded links' do |t|
75
+ t.string :url, null: false
76
+ t.text :code
77
+ t.timestamps
78
+ end
79
+ end
59
80
  end