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
@@ -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
@@ -206,6 +206,16 @@ class User < ApplicationRecord
206
206
  "/u/#{CGI.escape(key)}"
207
207
  end
208
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
+
209
219
  private
210
220
 
211
221
  def prepare_referral_link
@@ -4,7 +4,6 @@
4
4
  #
5
5
  # Attributes:
6
6
  # created_at [DateTime]
7
- # inclusive [Boolean]
8
7
  # role_id [Role]
9
8
  # updated_at [DateTime]
10
9
  # user_id [User]
@@ -2,13 +2,9 @@
2
2
 
3
3
  # Simple file uploader without any processing
4
4
  class SimpleFileUploader < CarrierWave::Uploader::Base
5
- storage :file
6
-
7
- def store_dir
8
- slug = "#{model.&id / 100}/#{model&.id}"
5
+ include Uploaders::PathSlug
9
6
 
10
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{slug}"
11
- end
7
+ storage :file
12
8
 
13
9
  def extension_blacklist
14
10
  %w[
@@ -2,15 +2,12 @@
2
2
 
3
3
  # Uploader for universal simple images
4
4
  class SimpleImageUploader < CarrierWave::Uploader::Base
5
+ include Uploaders::PathSlug
5
6
  include CarrierWave::ImageOptim
6
7
  include CarrierWave::MiniMagick
7
8
 
8
9
  storage :file
9
10
 
10
- def store_dir
11
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{path_slug}"
12
- end
13
-
14
11
  def default_url(*)
15
12
  ActionController::Base.helpers.asset_path('biovision/placeholders/1x1.svg')
16
13
  end
@@ -50,10 +47,8 @@ class SimpleImageUploader < CarrierWave::Uploader::Base
50
47
  resize_to_fit(48, 48)
51
48
  end
52
49
 
53
- # Add a white list of extensions which are allowed to be uploaded.
54
- # For images you might use something like this:
55
- def extension_whitelist
56
- %w[jpg jpeg png svg svgz]
50
+ def extension_allowlist
51
+ [/jpe?g/, 'png', /svgz?/]
57
52
  end
58
53
 
59
54
  # Text for image alt attribute
@@ -107,16 +102,4 @@ class SimpleImageUploader < CarrierWave::Uploader::Base
107
102
  def hd_url
108
103
  raster? ? hd.url : url
109
104
  end
110
-
111
- private
112
-
113
- def path_slug
114
- if model.respond_to?(:uuid)
115
- uuid = model&.uuid.to_s
116
- "#{uuid[0..2]}/#{uuid[3..5]}/#{uuid[6..7]}/#{uuid}"
117
- else
118
- id = model&.id.to_i
119
- "#{id / 1000}/#{id}"
120
- end
121
- end
122
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
@@ -7,5 +7,5 @@
7
7
  <article>
8
8
  <h1><%= t('.heading') %></h1>
9
9
 
10
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
10
+ <%= entity_list(@collection) %>
11
11
  </article>
@@ -0,0 +1,6 @@
1
+ <div>
2
+ <%= link_to t('.text'), admin_biovision_components_path %>
3
+ </div>
4
+ <div class="description">
5
+ <%= t('.description') %>
6
+ </div>
@@ -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>
@@ -1 +1 @@
1
- <li>:)</li>
1
+ <li><%= render 'admin/biovision_components/nav_item' %></li>
@@ -4,7 +4,7 @@
4
4
  <dl class="fields">
5
5
  <%= render partial: 'shared/forms/text_field', locals: { f: f, field: :slug } %>
6
6
  <%= render partial: 'shared/forms/text_area', locals: { f: f, field: :body } %>
7
- <%= render partial: 'shared/forms/entity_flags', locals: { f: f } %>
7
+ <%= entity_form_block(f, :entity_flags) %>
8
8
  </dl>
9
9
 
10
10
  <%= render 'shared/forms/state_container' %>
@@ -1,7 +1,7 @@
1
1
  <div class="data">
2
2
  <div><%= admin_entity_link(entity, handler: local_assigns[:handler]) %></div>
3
3
 
4
- <%= render(partial: 'shared/admin/toggle', locals: { entity: entity }) %>
4
+ <%= entity_toggle(entity) %>
5
5
 
6
6
  <% if local_assigns[:handler]&.permit?('edit', entity) %>
7
7
  <div class="entity-actions">
@@ -13,5 +13,5 @@
13
13
  </nav>
14
14
  <% end %>
15
15
 
16
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
16
+ <%= entity_list(@collection) %>
17
17
  </article>
@@ -16,10 +16,10 @@
16
16
  <% end %>
17
17
 
18
18
  <dl class="fields">
19
- <%= render partial: 'shared/entity/slug', locals: { entity: @entity } %>
19
+ <%= entity_partial_block(@entity, :slug) %>
20
20
  <%= render partial: 'shared/entity/text_field', locals: { entity: @entity, field: :body } %>
21
- <%= render partial: 'shared/entity/timestamps', locals: { entity: @entity } %>
21
+ <%= entity_partial_block(@entity, :timestamps) %>
22
22
  </dl>
23
23
 
24
- <%= render(partial: 'shared/admin/toggle', locals: { entity: @entity }) %>
24
+ <%= entity_toggle(@entity) %>
25
25
  </article>
@@ -5,7 +5,7 @@
5
5
  <div class="info"><%= entity.name %></div>
6
6
  <% end %>
7
7
 
8
- <%= render(partial: 'shared/admin/toggle', locals: { entity: entity }) %>
8
+ <%= entity_toggle(entity) %>
9
9
 
10
10
  <div class="entity-actions">
11
11
  <%= world_icon(entity) unless entity.url.blank? %>
@@ -13,10 +13,5 @@
13
13
  </nav>
14
14
  <% end %>
15
15
 
16
- <%=
17
- render(
18
- partial: 'shared/admin/list',
19
- locals: { collection: @collection, handler: component_handler }
20
- )
21
- %>
16
+ <%= entity_list(@collection) %>
22
17
  </article>
@@ -24,5 +24,5 @@
24
24
  <%= render partial: 'shared/entity/timestamps', locals: { entity: @entity } %>
25
25
  </dl>
26
26
 
27
- <%= render(partial: 'shared/admin/toggle', locals: { entity: @entity }) %>
27
+ <%= entity_toggle(@entity) %>
28
28
  </article>
@@ -8,7 +8,7 @@
8
8
  render(
9
9
  partial: 'admin/components/list',
10
10
  locals: {
11
- collection: BiovisionComponent.list_for_administration
11
+ collection: BiovisionComponent.active.list_for_administration
12
12
  }
13
13
  )
14
14
  %>
@@ -6,6 +6,6 @@
6
6
 
7
7
  <article>
8
8
  <h1><%= t('.heading') %></h1>
9
-
10
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
9
+
10
+ <%= entity_list(@collection) %>
11
11
  </article>
@@ -13,10 +13,5 @@
13
13
  </nav>
14
14
  <% end %>
15
15
 
16
- <%=
17
- render(
18
- partial: 'shared/admin/list',
19
- locals: { collection: @collection, handler: component_handler }
20
- )
21
- %>
16
+ <%= entity_list(@collection) %>
22
17
  </article>
@@ -16,7 +16,7 @@
16
16
  <% end %>
17
17
  </div>
18
18
 
19
- <%= render(partial: 'shared/admin/toggle', locals: { entity: entity }) %>
19
+ <%= entity_toggle(entity) %>
20
20
 
21
21
  <% if local_assigns[:handler]&.permit?('edit', entity) %>
22
22
  <div class="entity-actions">
@@ -7,10 +7,5 @@
7
7
  <article>
8
8
  <h1><%= t('.heading') %></h1>
9
9
 
10
- <%=
11
- render(
12
- partial: 'shared/admin/list',
13
- locals: { collection: @collection, handler: component_handler }
14
- )
15
- %>
10
+ <%= entity_list(@collection) %>
16
11
  </article>
@@ -22,5 +22,5 @@
22
22
  <%= render partial: 'shared/entity/track', locals: { entity: @entity } %>
23
23
  </dl>
24
24
 
25
- <%= render(partial: 'shared/admin/toggle', locals: { entity: @entity }) %>
25
+ <%= entity_toggle(@entity) %>
26
26
  </article>
@@ -29,12 +29,10 @@
29
29
  )
30
30
  %>
31
31
 
32
- <%= render(partial: 'shared/admin/toggle', locals: { entity: entity }) %>
32
+ <%= entity_toggle(entity) %>
33
33
 
34
34
  <div class="entity-actions">
35
- <% if local_assigns[:handler] %>
36
- <%= edit_icon(entity) if handler.permit?('edit', entity) %>
37
- <% end %>
35
+ <%= edit_icon(entity) if local_assigns[:handler]&.permit?('edit', entity) %>
38
36
  <%= world_icon(entity) %>
39
37
  </div>
40
38
  </div>
@@ -20,5 +20,5 @@
20
20
  )
21
21
  %>
22
22
 
23
- <%= render partial: 'shared/admin/list', locals: { collection: @collection, handler: component_handler } %>
23
+ <%= entity_list(@collection) %>
24
24
  </article>
@@ -18,8 +18,8 @@
18
18
  <%= destroy_icon(@entity) if component_handler.permit?('edit', @entity) %>
19
19
  </nav>
20
20
 
21
- <% if current_user.super_user? %>
22
- <nav>
21
+ <nav>
22
+ <% if current_user.super_user? %>
23
23
  <%=
24
24
  link_to(
25
25
  "#{t('admin.users.roles.nav_text')} (#{@entity.role_ids.count})",
@@ -27,27 +27,33 @@
27
27
  class: 'button button-ghost'
28
28
  )
29
29
  %>
30
- </nav>
31
- <% end %>
30
+ <% end %>
31
+ <% if component_handler.permit?('log_in', @entity) && @entity != current_user && !@entity.super_user? %>
32
+ <%=
33
+ link_to(
34
+ t('admin.users.authenticate.nav_text'),
35
+ authenticate_admin_user_path(id: @entity.id),
36
+ method: :post,
37
+ class: 'button button-secondary'
38
+ )
39
+ %>
40
+ <% end %>
41
+ </nav>
32
42
 
33
43
  <%= render partial: 'admin/users/entity/fields', locals: { entity: @entity } %>
34
44
 
35
- <%=
36
- render(
37
- partial: 'shared/admin/toggle',
38
- locals: { entity: @entity }
39
- )
40
- %>
45
+ <%= entity_toggle(@entity) %>
41
46
 
42
47
  <% prefix = 'admin/users/entity/components/' %>
43
48
  <% BiovisionComponent.list_for_administration.each do |component| %>
44
49
  <% if lookup_context.exists?("#{prefix}_#{component.slug}") %>
50
+ <% handler = Biovision::Components::BaseComponent.handler(component, @entity) %>
45
51
  <section>
46
- <h2><%= component.name %></h2>
52
+ <h2><%= handler.name %></h2>
47
53
  <%=
48
54
  render(
49
55
  partial: "#{prefix}#{component.slug}",
50
- locals: { user: @entity }
56
+ locals: { user: @entity, handler: handler }
51
57
  )
52
58
  %>
53
59
  </section>
@@ -3,8 +3,13 @@
3
3
  <legend><%= t('.heading') %></legend>
4
4
  <div class="list">
5
5
  <% fields.each do |key, type| %>
6
- <% if type == :flag %>
7
- <%= render partial: 'admin/widgets/filters/flag', locals: { f: f, key: key, scope: scope, value: filter[key] } %>
6
+ <% if lookup_context.exists?("admin/widgets/filters/_#{type}") %>
7
+ <%=
8
+ render(
9
+ partial: "admin/widgets/filters/#{type}",
10
+ locals: { f: f, key: key, scope: scope, value: filter[key] }
11
+ )
12
+ %>
8
13
  <% end %>
9
14
  <% end %>
10
15
  </div>
@@ -0,0 +1,7 @@
1
+ <% placeholder = t("filters.#{scope}.#{key}", default: key.to_s) %>
2
+ <div class="text">
3
+ <label class="floating-label">
4
+ <%= f.text_field(key, value: value, class: 'input-text', placeholder: placeholder) %>
5
+ <span><%= placeholder %></span>
6
+ </label>
7
+ </div>
@@ -0,0 +1 @@
1
+ <div class="message-box error"><%= @message %></div>
@@ -2,8 +2,13 @@
2
2
  <%= render 'layouts/admin/header/logo' %>
3
3
  <nav>
4
4
  <% unless current_user.nil? %>
5
- <ul>
6
- <li><%= current_user.screen_name %></li>
5
+ <ul class="header-authentication">
6
+ <li>
7
+ <a href="<%= my_path %>" class="current-user">
8
+ <span class="avatar"><%= simple_image_tiny(current_user) %></span>
9
+ <span><%= current_user.screen_name %></span>
10
+ </a>
11
+ </li>
7
12
  <li>
8
13
  <%=
9
14
  link_to(
@@ -2,7 +2,10 @@
2
2
  <% if current_user.nil? %>
3
3
  <%= link_to(image_tag('biovision/icons/log_in.svg', alt: t(:log_in)), login_path) %>
4
4
  <% else %>
5
- <%= link_to(simple_image_tiny(current_user), my_path, class: 'avatar') %>
5
+ <a href="<%= my_path %>" class="current-user">
6
+ <span class="avatar"><%= simple_image_tiny(current_user) %></span>
7
+ <span><%= current_user.screen_name %></span>
8
+ </a>
6
9
  <%=
7
10
  link_to(
8
11
  image_tag('biovision/icons/log_out.svg', alt: t(:log_out)),
@@ -0,0 +1,25 @@
1
+ <% content_for :meta_title, t('.title') %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= my_home_link %>
4
+ <span><%= t('.nav_text') %></span>
5
+ <% end %>
6
+
7
+ <article>
8
+ <div class="content-wrapper">
9
+ <h1><%= t('.heading') %></h1>
10
+ </div>
11
+
12
+ <% prefix = 'my/components/' %>
13
+ <% @collection.each do |component| %>
14
+ <% handler = Biovision::Components::BaseComponent.handler(component, current_user) %>
15
+ <% next unless handler&.permit?('default') %>
16
+ <% if lookup_context.exists?("#{prefix}#{component.slug}/_dashboard") %>
17
+ <%=
18
+ render(
19
+ partial: "#{prefix}#{component.slug}/dashboard",
20
+ locals: { handler: handler }
21
+ )
22
+ %>
23
+ <% end %>
24
+ <% end %>
25
+ </article>
@@ -0,0 +1,21 @@
1
+ <% content_for :meta_title, t('.title', component: @handler.name) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= link_to(t('my.components.index.nav_text'), my_dashboard_path) %>
4
+ <span><%= @handler.name %></span>
5
+ <% end %>
6
+
7
+ <% prefix = "my/components/#{@handler.slug}/" %>
8
+ <% if lookup_context.exists?("#{prefix}_section") %>
9
+ <%=
10
+ render(
11
+ partial: "#{prefix}#{component.slug}",
12
+ locals: { handler: @handler }
13
+ )
14
+ %>
15
+ <% else %>
16
+ <article class="content-wrapper">
17
+ <h1><%= @handler.name %></h1>
18
+
19
+ <div class="message-box warning"><%= t('.no_view') %></div>
20
+ </article>
21
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <section class="my__component-cards">
2
+ <% prefix = 'my/components/' %>
3
+ <% BiovisionComponent.list_for_user.each do |component| %>
4
+ <% handler = Biovision::Components::BaseComponent.handler(component, current_user) %>
5
+ <% next unless handler&.permit?('default') %>
6
+ <% if lookup_context.exists?("#{prefix}_#{component.slug}") %>
7
+ <%=
8
+ render(
9
+ partial: "#{prefix}#{component.slug}",
10
+ locals: { user: @entity, handler: handler }
11
+ )
12
+ %>
13
+ <% end %>
14
+ <% end %>
15
+ </section>
@@ -0,0 +1,14 @@
1
+ <% if handler.needs_email_confirmation? %>
2
+ <div class="message-box warning">
3
+ <p><%= t('.email_is_not_confirmed') %></p>
4
+ <p>
5
+ <%=
6
+ link_to(
7
+ t('my.confirmations.show.nav_text'),
8
+ my_confirmation_path,
9
+ class: 'button button-secondary'
10
+ )
11
+ %>
12
+ </p>
13
+ </div>
14
+ <% end %>
@@ -0,0 +1,33 @@
1
+ <nav>
2
+ <%=
3
+ link_to(
4
+ t('my.profiles.show.nav_text'),
5
+ my_profile_path,
6
+ class: 'button button-ghost'
7
+ )
8
+ %>
9
+ <%=
10
+ link_to(
11
+ t('my.components.index.nav_text'),
12
+ my_dashboard_path,
13
+ class: 'button button-ghost'
14
+ )
15
+ %>
16
+ <% if current_user.role?('base.admin') %>
17
+ <%=
18
+ link_to(
19
+ t('admin.index.index.nav_text'),
20
+ admin_path,
21
+ class: 'button button-secondary'
22
+ )
23
+ %>
24
+ <% end %>
25
+ <%=
26
+ link_to(
27
+ t(:log_out),
28
+ logout_path,
29
+ class: 'button button-secondary',
30
+ method: :delete
31
+ )
32
+ %>
33
+ </nav>
@@ -6,54 +6,7 @@
6
6
  <article class="content-wrapper">
7
7
  <h1><%= t('.heading') %></h1>
8
8
 
9
- <% if component_handler.needs_email_confirmation? %>
10
- <div class="message-box warning">
11
- <p><%= t('.email_is_not_confirmed') %></p>
12
- <p>
13
- <%=
14
- link_to(
15
- t('my.confirmations.show.nav_text'),
16
- my_confirmation_path,
17
- class: 'button button-secondary'
18
- )
19
- %>
20
- </p>
21
- </div>
22
- <% end %>
23
-
24
- <nav>
25
- <%=
26
- link_to(
27
- t('my.profiles.show.nav_text'),
28
- my_profile_path,
29
- class: 'button button-ghost'
30
- )
31
- %>
32
- <% if current_user.role?('base.admin') %>
33
- <%=
34
- link_to(
35
- t('admin.index.index.nav_text'),
36
- admin_path,
37
- class: 'button button-secondary'
38
- )
39
- %>
40
- <% end %>
41
- </nav>
42
-
43
- <% prefix = 'my/components/' %>
44
- <% BiovisionComponent.list_for_user.each do |component| %>
45
- <% handler = Biovision::Components::BaseComponent.handler(component, current_user) %>
46
- <% next unless handler&.permit?('default') %>
47
- <% if lookup_context.exists?("#{prefix}_#{component.slug}") %>
48
- <section class="my__component">
49
- <h2><%= handler.name %></h2>
50
- <%=
51
- render(
52
- partial: "#{prefix}#{component.slug}",
53
- locals: { user: @entity, handler: handler }
54
- )
55
- %>
56
- </section>
57
- <% end %>
58
- <% end %>
9
+ <%= render partial: 'my/index/email', locals: { handler: component_handler } %>
10
+ <%= render 'my/index/navigation' %>
11
+ <%= render 'my/index/cards' %>
59
12
  </article>