biovision 0.1.210414.0 → 0.12.211128.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +50 -40
  3. data/app/assets/stylesheets/biovision/admin/components/users.scss +4 -0
  4. data/app/assets/stylesheets/biovision/admin/components.scss +10 -0
  5. data/app/assets/stylesheets/biovision/admin/layout.scss +34 -8
  6. data/app/assets/stylesheets/biovision/biovision.scss +64 -26
  7. data/app/assets/stylesheets/biovision/components/carousel.scss +24 -24
  8. data/app/assets/stylesheets/biovision/components/filters.scss +39 -0
  9. data/app/assets/stylesheets/biovision/components/forms.scss +56 -10
  10. data/app/assets/stylesheets/biovision/components/quick_search.scss +24 -0
  11. data/app/assets/stylesheets/biovision/components.scss +1 -0
  12. data/app/assets/stylesheets/biovision/default.scss +4 -4
  13. data/app/assets/stylesheets/biovision/themes/default_theme/components/users/dashboard.scss +4 -0
  14. data/app/assets/stylesheets/biovision/themes/default_theme/components/users.scss +1 -0
  15. data/app/assets/stylesheets/biovision/themes/default_theme/layout/footer.scss +3 -0
  16. data/app/assets/stylesheets/biovision/themes/default_theme/layout/header.scss +12 -0
  17. data/app/assets/stylesheets/biovision/themes/default_theme/layout.scss +6 -3
  18. data/app/assets/stylesheets/biovision/themes/default_theme.scss +0 -1
  19. data/app/assets/stylesheets/biovision/vars.scss +5 -0
  20. data/app/controllers/admin/biovision_components_controller.rb +10 -0
  21. data/app/controllers/admin/components_controller.rb +33 -83
  22. data/app/controllers/admin/dynamic_pages_controller.rb +1 -1
  23. data/app/controllers/admin/index_controller.rb +8 -2
  24. data/app/controllers/admin/navigation_groups_controller.rb +31 -0
  25. data/app/controllers/admin/tokens_controller.rb +15 -0
  26. data/app/controllers/admin/users_controller.rb +35 -4
  27. data/app/controllers/admin_controller.rb +2 -9
  28. data/app/controllers/concerns/component_stories.rb +22 -0
  29. data/app/controllers/concerns/crud_entities.rb +23 -15
  30. data/app/controllers/concerns/my_crud_entities.rb +146 -0
  31. data/app/controllers/concerns/processed_forms.rb +28 -0
  32. data/app/controllers/concerns/restricted_access.rb +37 -0
  33. data/app/controllers/contact_controller.rb +1 -1
  34. data/app/controllers/errors_controller.rb +37 -0
  35. data/app/controllers/my/components_controller.rb +21 -0
  36. data/app/controllers/my/index_controller.rb +1 -3
  37. data/app/controllers/my/profiles_controller.rb +2 -0
  38. data/app/controllers/oembed_controller.rb +12 -0
  39. data/app/controllers/profile_controller.rb +2 -0
  40. data/app/controllers/users_controller.rb +2 -0
  41. data/app/helpers/biovision_components_helper.rb +7 -3
  42. data/app/helpers/biovision_helper.rb +33 -34
  43. data/app/helpers/entity_helper.rb +77 -0
  44. data/app/helpers/my_helper.rb +34 -0
  45. data/app/lib/biovision/components/base/component_parameters.rb +13 -2
  46. data/app/lib/biovision/components/base/component_privileges.rb +28 -18
  47. data/app/lib/biovision/components/base/component_settings.rb +8 -0
  48. data/app/lib/biovision/components/base/component_stories.rb +30 -0
  49. data/app/lib/biovision/components/base/entity_links.rb +38 -0
  50. data/app/lib/biovision/components/base/image_handling.rb +33 -0
  51. data/app/lib/biovision/components/base_component.rb +20 -49
  52. data/app/lib/biovision/components/contact_component.rb +5 -1
  53. data/app/lib/biovision/components/content/oembed/receiver.rb +98 -0
  54. data/app/lib/biovision/components/content/oembed/twitter_receiver.rb +20 -0
  55. data/app/lib/biovision/components/content/oembed/vimeo_receiver.rb +20 -0
  56. data/app/lib/biovision/components/content/oembed/youtube_receiver.rb +20 -0
  57. data/app/lib/biovision/components/content_component.rb +46 -9
  58. data/app/lib/biovision/components/track_component.rb +1 -1
  59. data/app/lib/biovision/components/users_component.rb +34 -2
  60. data/app/lib/biovision/helpers/data_helper.rb +70 -0
  61. data/app/lib/biovision/helpers/export_helper.rb +97 -0
  62. data/app/lib/biovision/migrations/component_migration.rb +56 -0
  63. data/app/lib/biovision/stories/component_story.rb +55 -0
  64. data/app/mailers/feedback_mailer.rb +14 -0
  65. data/app/models/biovision_component.rb +17 -1
  66. data/app/models/browser.rb +1 -1
  67. data/app/models/code.rb +5 -5
  68. data/app/models/concerns/checkable.rb +2 -1
  69. data/app/models/concerns/has_uploaded_file.rb +26 -0
  70. data/app/models/concerns/simple_tag.rb +30 -0
  71. data/app/models/concerns/toggleable.rb +2 -1
  72. data/app/models/concerns/tree_structure.rb +4 -1
  73. data/app/models/contact_method.rb +1 -1
  74. data/app/models/contact_type.rb +1 -1
  75. data/app/models/dynamic_block.rb +1 -1
  76. data/app/models/dynamic_page.rb +3 -1
  77. data/app/models/feedback_message.rb +7 -1
  78. data/app/models/feedback_response.rb +2 -2
  79. data/app/models/metric.rb +4 -0
  80. data/app/models/navigation_group.rb +11 -1
  81. data/app/models/oembed_domain.rb +25 -0
  82. data/app/models/oembed_link.rb +19 -0
  83. data/app/models/oembed_receiver.rb +15 -0
  84. data/app/models/role.rb +42 -12
  85. data/app/models/simple_image.rb +30 -3
  86. data/app/models/simple_image_tag.rb +1 -16
  87. data/app/models/token.rb +6 -2
  88. data/app/models/uploaded_file.rb +62 -0
  89. data/app/models/uploaded_file_tag.rb +15 -0
  90. data/app/models/uploaded_file_tag_file.rb +13 -0
  91. data/app/models/user.rb +35 -10
  92. data/app/models/user_role.rb +0 -1
  93. data/app/uploaders/simple_file_uploader.rb +2 -6
  94. data/app/uploaders/simple_image_uploader.rb +10 -21
  95. data/app/uploaders/uploaders/path_slug.rb +22 -0
  96. data/app/views/admin/agents/index.html.erb +1 -1
  97. data/app/views/admin/biovision_components/_nav_item.html.erb +6 -0
  98. data/app/views/admin/biovision_components/entity/_in_list.html.erb +12 -0
  99. data/app/views/admin/biovision_components/index.html.erb +11 -0
  100. data/app/views/admin/components/_list.html.erb +1 -1
  101. data/app/views/admin/components/entity/_links.html.erb +31 -21
  102. data/app/views/admin/components/links/_base.html.erb +1 -0
  103. data/app/views/admin/components/settings/_settings.html.erb +3 -3
  104. data/app/views/admin/components/settings.html.erb +2 -1
  105. data/app/views/admin/dynamic_blocks/_form.html.erb +1 -1
  106. data/app/views/admin/dynamic_blocks/entity/_in_list.html.erb +8 -6
  107. data/app/views/admin/dynamic_blocks/index.html.erb +6 -4
  108. data/app/views/admin/dynamic_blocks/show.html.erb +9 -7
  109. data/app/views/admin/dynamic_pages/_dynamic_page.jbuilder +18 -0
  110. data/app/views/admin/dynamic_pages/entity/_in_list.html.erb +6 -4
  111. data/app/views/admin/dynamic_pages/entity/_in_search.html.erb +7 -0
  112. data/app/views/admin/dynamic_pages/index.html.erb +6 -4
  113. data/app/views/admin/dynamic_pages/search.jbuilder +4 -0
  114. data/app/views/admin/dynamic_pages/show.html.erb +2 -2
  115. data/app/views/admin/index/index.html.erb +7 -5
  116. data/app/views/admin/ip_addresses/index.html.erb +2 -2
  117. data/app/views/admin/navigation_group_pages/entity/_in_list.html.erb +26 -0
  118. data/app/views/admin/navigation_groups/entity/_dynamic_pages.html.erb +38 -0
  119. data/app/views/admin/navigation_groups/entity/_in_list.html.erb +7 -5
  120. data/app/views/admin/navigation_groups/index.html.erb +6 -4
  121. data/app/views/admin/navigation_groups/show.html.erb +16 -3
  122. data/app/views/admin/tokens/_form.html.erb +31 -0
  123. data/app/views/admin/tokens/_nav_item.html.erb +6 -0
  124. data/app/views/admin/tokens/entity/_in_list.html.erb +27 -0
  125. data/app/views/admin/tokens/index.html.erb +11 -0
  126. data/app/views/admin/tokens/show.html.erb +26 -0
  127. data/app/views/admin/users/_user.jbuilder +18 -0
  128. data/app/views/admin/users/entity/_fields.html.erb +1 -1
  129. data/app/views/admin/users/entity/_in_list.html.erb +3 -3
  130. data/app/views/admin/users/entity/_in_search.html.erb +18 -0
  131. data/app/views/admin/users/index.html.erb +13 -4
  132. data/app/views/admin/users/roles/_component.html.erb +22 -0
  133. data/app/views/admin/users/roles.html.erb +23 -0
  134. data/app/views/admin/users/search.jbuilder +4 -0
  135. data/app/views/admin/users/show.html.erb +28 -10
  136. data/app/views/admin/widgets/_filters.html.erb +20 -0
  137. data/app/views/admin/widgets/_quick_search.html.erb +13 -0
  138. data/app/views/admin/widgets/filters/_flag.html.erb +15 -0
  139. data/app/views/admin/widgets/filters/_text.html.erb +7 -0
  140. data/app/views/application/unauthorized.html.erb +4 -1
  141. data/app/views/components/content/_dynamic_page.html.erb +6 -10
  142. data/app/views/components/content/_dynamic_page_content.html.erb +14 -0
  143. data/app/views/components/users/_login_form.html.erb +1 -0
  144. data/app/views/contact/_form.html.erb +1 -1
  145. data/app/views/errors/error.html.erb +1 -0
  146. data/app/views/feedback_mailer/new_feedback_request.html.erb +11 -0
  147. data/app/views/feedback_mailer/new_feedback_request.text.erb +6 -0
  148. data/app/views/index/index.html.erb +14 -0
  149. data/app/views/layouts/admin/_header.html.erb +7 -2
  150. data/app/views/layouts/admin.html.erb +0 -1
  151. data/app/views/layouts/application/_footer.html.erb +1 -1
  152. data/app/views/layouts/application/header/_authentication.html.erb +4 -1
  153. data/app/views/my/components/index.html.erb +25 -0
  154. data/app/views/my/components/show.html.erb +21 -0
  155. data/app/views/my/index/_cards.html.erb +15 -0
  156. data/app/views/my/index/_email.html.erb +14 -0
  157. data/app/views/my/index/_navigation.html.erb +33 -0
  158. data/app/views/my/index/index.html.erb +7 -26
  159. data/app/views/my/profiles/show.html.erb +13 -0
  160. data/app/views/{admin/components/links/extra/_content.html.erb → my/recoveries/show.html.erb} +0 -0
  161. data/app/views/shared/admin/_list.html.erb +10 -19
  162. data/app/views/shared/admin/_list_with_priority.html.erb +10 -19
  163. data/app/views/shared/admin/_priority.html.erb +6 -5
  164. data/app/views/shared/admin/_toggle.html.erb +5 -10
  165. data/app/views/shared/entity/_date_field.html.erb +6 -0
  166. data/app/views/shared/entity/_linked_entity.html.erb +2 -2
  167. data/app/views/shared/entity/_list.html.erb +22 -0
  168. data/app/views/shared/entity/_list_with_priority.html.erb +22 -0
  169. data/app/views/shared/entity/_parent.html.erb +1 -1
  170. data/app/views/shared/entity/_priority_icons.html.erb +8 -0
  171. data/app/views/shared/entity/_time_field.html.erb +6 -0
  172. data/app/views/shared/entity/_toggle.html.erb +12 -0
  173. data/app/views/shared/entity/_track.html.erb +12 -0
  174. data/app/views/shared/entity/_tree_caches.html.erb +8 -1
  175. data/app/views/shared/entity/edit.html.erb +10 -6
  176. data/app/views/shared/entity/new.html.erb +4 -2
  177. data/app/views/shared/forms/_field.html.erb +6 -2
  178. data/app/views/shared/forms/_field_with_search.html.erb +17 -0
  179. data/app/views/shared/forms/_meta_texts.html.erb +1 -1
  180. data/app/views/shared/forms/_simple_entity_link.html.erb +14 -0
  181. data/app/views/shared/forms/_simple_image.html.erb +12 -4
  182. data/app/views/shared/forms/_text_area.html.erb +1 -1
  183. data/app/views/shared/forms/_text_field.html.erb +1 -1
  184. data/app/views/shared/my/_list.html.erb +10 -19
  185. data/app/views/shared/my/_list_with_priority.html.erb +10 -19
  186. data/app/views/shared/my/entity/edit.html.erb +25 -0
  187. data/app/views/shared/my/entity/new.html.erb +18 -0
  188. data/app/views/simple_images/_simple_image.jbuilder +13 -0
  189. data/config/locales/biovision-ru.yml +18 -1
  190. data/config/locales/components-ru.yml +27 -4
  191. data/config/locales/contact-ru.yml +4 -0
  192. data/config/locales/content-ru.yml +12 -0
  193. data/config/locales/users-ru.yml +31 -6
  194. data/config/routes.rb +35 -4
  195. data/db/migrate/20191228000000_create_biovision_components.rb +2 -0
  196. data/db/migrate/20200224000000_create_track_component.rb +8 -12
  197. data/db/migrate/20200224000010_create_users_component.rb +8 -49
  198. data/db/migrate/20200404000000_create_simple_images.rb +1 -0
  199. data/db/migrate/20210405000000_create_acl.rb +15 -1
  200. data/db/migrate/{20200529000000_create_content_component.rb → 20210421000000_create_content_component.rb} +24 -18
  201. data/db/migrate/{20210401000000_create_contact_component.rb → 20210421000010_create_contact_component.rb} +1 -22
  202. data/db/migrate/20210616000000_create_uploaded_files.rb +52 -0
  203. data/db/migrate/amends/20210816060606_create_oembed_receivers.rb +21 -0
  204. data/db/migrate/amends/20210907070707_add_checksum_to_simple_images.rb +13 -0
  205. data/lib/biovision/base_methods.rb +8 -28
  206. data/lib/biovision/version.rb +1 -1
  207. data/lib/tasks/components.rake +51 -0
  208. metadata +90 -17
  209. data/app/lib/biovision/components/base/privilege_handler.rb +0 -79
  210. data/app/models/biovision_component_user.rb +0 -21
  211. data/app/views/admin/components/links/_content.html.erb +0 -9
  212. data/app/views/admin/components/links/_track.html.erb +0 -2
  213. data/app/views/admin/components/links/_users.html.erb +0 -4
  214. data/app/views/admin/components/privileges/_component_user.html.erb +0 -17
  215. data/app/views/admin/components/privileges/_links.html.erb +0 -17
  216. data/app/views/admin/components/privileges/_users.html.erb +0 -23
  217. data/app/views/admin/components/privileges.html.erb +0 -20
@@ -13,7 +13,8 @@
13
13
  partial: 'admin/components/settings/settings',
14
14
  locals: {
15
15
  handler: @handler,
16
- settings: @handler.component.settings
16
+ settings: @handler.component.settings,
17
+ keys: @handler.class.default_settings.keys
17
18
  }
18
19
  )
19
20
  %>
@@ -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,10 +1,12 @@
1
1
  <div class="data">
2
- <div><%= admin_entity_link(entity) %></div>
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
- <div class="entity-actions">
7
- <%= edit_icon(entity) %>
8
- <%= destroy_icon(entity) %>
9
- </div>
6
+ <% if local_assigns[:handler]&.permit?('edit', entity) %>
7
+ <div class="entity-actions">
8
+ <%= edit_icon(entity) %>
9
+ <%= destroy_icon(entity) %>
10
+ </div>
11
+ <% end %>
10
12
  </div>
@@ -7,9 +7,11 @@
7
7
  <article>
8
8
  <h1><%= t('.heading') %></h1>
9
9
 
10
- <nav class="entity-actions">
11
- <%= create_icon(new_admin_dynamic_block_path) %>
12
- </nav>
10
+ <% if component_handler.permit?("#{controller_name}.create") %>
11
+ <nav class="entity-actions">
12
+ <%= create_icon(new_admin_dynamic_block_path) %>
13
+ </nav>
14
+ <% end %>
13
15
 
14
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
16
+ <%= entity_list(@collection) %>
15
17
  </article>
@@ -8,16 +8,18 @@
8
8
  <article>
9
9
  <h1><%= @entity.class.model_name.human %> <q><%= @entity.slug %></q></h1>
10
10
 
11
- <nav class="entity-actions">
12
- <%= edit_icon(@entity) %>
13
- <%= destroy_icon(@entity) %>
14
- </nav>
11
+ <% if component_handler.permit?('edit', @entity) %>
12
+ <nav class="entity-actions">
13
+ <%= edit_icon(@entity) %>
14
+ <%= destroy_icon(@entity) %>
15
+ </nav>
16
+ <% end %>
15
17
 
16
18
  <dl class="fields">
17
- <%= render partial: 'shared/entity/slug', locals: { entity: @entity } %>
19
+ <%= entity_partial_block(@entity, :slug) %>
18
20
  <%= render partial: 'shared/entity/text_field', locals: { entity: @entity, field: :body } %>
19
- <%= render partial: 'shared/entity/timestamps', locals: { entity: @entity } %>
21
+ <%= entity_partial_block(@entity, :timestamps) %>
20
22
  </dl>
21
23
 
22
- <%= render(partial: 'shared/admin/toggle', locals: { entity: @entity }) %>
24
+ <%= entity_toggle(@entity) %>
23
25
  </article>
@@ -0,0 +1,18 @@
1
+ json.id dynamic_page.id
2
+ json.type dynamic_page.class.table_name
3
+ json.attributes do
4
+ json.call(dynamic_page, :slug, :url)
5
+ end
6
+ json.meta do
7
+ json.text_for_link dynamic_page.text_for_link
8
+ json.html(
9
+ render(
10
+ partial: 'admin/dynamic_pages/entity/in_search',
11
+ locals: { entity: dynamic_page },
12
+ formats: [:html]
13
+ )
14
+ )
15
+ end
16
+ json.links do
17
+ json.self admin_dynamic_page_path(id: dynamic_page.id)
18
+ end
@@ -1,15 +1,17 @@
1
1
  <figure class="image"><%= simple_image_preview(entity) %></figure>
2
2
  <div class="data">
3
- <div><%= admin_entity_link(entity) %></div>
3
+ <div><%= admin_entity_link(entity, handler: local_assigns[:handler]) %></div>
4
4
  <% unless entity.name.blank? %>
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? %>
12
- <%= edit_icon(entity) %>
13
- <%= destroy_icon(entity) %>
12
+ <% if local_assigns[:handler]&.permit?('edit', entity) %>
13
+ <%= edit_icon(entity) %>
14
+ <%= destroy_icon(entity) %>
15
+ <% end %>
14
16
  </div>
15
17
  </div>
@@ -0,0 +1,7 @@
1
+ <figure class="image"><%= simple_image_preview(entity) %></figure>
2
+ <div class="data">
3
+ <div><%= admin_entity_link(entity, handler: local_assigns[:handler]) %></div>
4
+ <% unless entity.name.blank? %>
5
+ <div class="info"><%= entity.name %></div>
6
+ <% end %>
7
+ </div>
@@ -7,9 +7,11 @@
7
7
  <article>
8
8
  <h1><%= t('.heading') %></h1>
9
9
 
10
- <nav class="entity-actions">
11
- <%= create_icon(new_admin_dynamic_page_path) %>
12
- </nav>
10
+ <% if component_handler.permit?("#{controller_name}.edit") %>
11
+ <nav class="entity-actions">
12
+ <%= create_icon(new_admin_dynamic_page_path) %>
13
+ </nav>
14
+ <% end %>
13
15
 
14
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
16
+ <%= entity_list(@collection) %>
15
17
  </article>
@@ -0,0 +1,4 @@
1
+ json.data @collection do |entity|
2
+ json.partial! entity
3
+ end
4
+ json.partial! 'shared/pagination', locals: { collection: @collection }
@@ -10,7 +10,7 @@
10
10
 
11
11
  <nav class="entity-actions">
12
12
  <%= world_icon(@entity) unless @entity.url.blank? %>
13
- <%= edit_icon(@entity) %>
13
+ <%= edit_icon(@entity) if component_handler.permit?('edit', @entity) %>
14
14
  </nav>
15
15
 
16
16
  <dl class="fields">
@@ -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>
@@ -3,12 +3,14 @@
3
3
  <article>
4
4
  <h1><%= t('.heading') %></h1>
5
5
 
6
- <%=
7
- render(
6
+ <% if component_handler.permit?('components.view') %>
7
+ <%=
8
+ render(
8
9
  partial: 'admin/components/list',
9
10
  locals: {
10
- collection: BiovisionComponent.list_for_administration
11
+ collection: BiovisionComponent.active.list_for_administration
11
12
  }
12
- )
13
- %>
13
+ )
14
+ %>
15
+ <% end %>
14
16
  </article>
@@ -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>
@@ -0,0 +1,26 @@
1
+ <div class="data">
2
+ <div><%= admin_entity_link(entity.dynamic_page, handler: local_assigns[:handler]) %></div>
3
+ <div class="info"><%= entity.dynamic_page.url %></div>
4
+ <div class="secondary info"><%= entity.dynamic_page.name %></div>
5
+
6
+ <% if local_assigns[:handler]&.permit?('edit', entity.navigation_group) %>
7
+ <div class="entity-actions">
8
+ <% url = page_priority_admin_navigation_group_path(id: entity.navigation_group_id, page_id: entity.id) %>
9
+ <div class="priority-changer" data-url="<%= url %>">
10
+ <button data-delta="-1" type="button">&uarr;</button>
11
+ <button data-delta="1" type="button">&darr;</button>
12
+ </div>
13
+
14
+ <%=
15
+ button_tag(
16
+ '',
17
+ class: 'danger destroy',
18
+ data: {
19
+ url: dynamic_page_admin_navigation_group_path(id: entity.navigation_group_id, page_id: entity.id)
20
+ },
21
+ type: 'button'
22
+ )
23
+ %>
24
+ </div>
25
+ <% end %>
26
+ </div>
@@ -0,0 +1,38 @@
1
+ <section
2
+ class="js-entity-list-with-search"
3
+ data-prefix="<%= dynamic_page_admin_navigation_group_path(id: entity.id, page_id: '') %>"
4
+ >
5
+ <h2><%= t('.heading') %></h2>
6
+
7
+ <div class="list">
8
+ <%=
9
+ render(
10
+ partial: 'shared/admin/list_with_priority',
11
+ locals: { collection: collection, handler: handler }
12
+ )
13
+ %>
14
+ </div>
15
+
16
+ <% if component_handler.permit?('edit', entity) %>
17
+ <section>
18
+ <h3><%= t('.add') %></h3>
19
+
20
+ <div class="search">
21
+ <label class="floating-label">
22
+ <%=
23
+ search_field_tag(
24
+ 'q',
25
+ '',
26
+ class: 'input-text',
27
+ data: { url: search_admin_dynamic_pages_url(format: :json) },
28
+ placeholder: DynamicPage.human_attribute_name(:url)
29
+ )
30
+ %>
31
+ <span><%= DynamicPage.human_attribute_name(:url) %></span>
32
+ </label>
33
+ </div>
34
+
35
+ <ul class="results"></ul>
36
+ </section>
37
+ <% end %>
38
+ </section>
@@ -1,12 +1,14 @@
1
1
  <div class="data">
2
- <div><%= admin_entity_link(entity) %></div>
2
+ <div><%= admin_entity_link(entity, handler: local_assigns[:handler]) %></div>
3
3
  <div class="info"><%= entity.slug %></div>
4
4
  <div class="secondary info">
5
5
  <%= t(:page_count, count: entity.dynamic_pages_count) %>
6
6
  </div>
7
7
 
8
- <div class="entity-actions">
9
- <%= edit_icon(entity) %>
10
- <%= destroy_icon(entity) %>
11
- </div>
8
+ <% if local_assigns[:handler]&.permit?('edit', entity) %>
9
+ <div class="entity-actions">
10
+ <%= edit_icon(entity) %>
11
+ <%= destroy_icon(entity) %>
12
+ </div>
13
+ <% end %>
12
14
  </div>
@@ -7,9 +7,11 @@
7
7
  <article>
8
8
  <h1><%= t('.heading') %></h1>
9
9
 
10
- <nav class="entity-actions">
11
- <%= create_icon(new_admin_navigation_group_path) %>
12
- </nav>
10
+ <% if component_handler.permit?("#{controller_name}.edit") %>
11
+ <nav class="entity-actions">
12
+ <%= create_icon(new_admin_navigation_group_path) %>
13
+ </nav>
14
+ <% end %>
13
15
 
14
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
16
+ <%= entity_list(@collection) %>
15
17
  </article>
@@ -8,13 +8,26 @@
8
8
  <article>
9
9
  <h1><%= @entity.class.model_name.human %> <q><%= @entity.name %></q></h1>
10
10
 
11
- <nav class="entity-actions">
12
- <%= edit_icon(@entity) %>
13
- </nav>
11
+ <% if component_handler.permit?('edit', @entity) %>
12
+ <nav class="entity-actions">
13
+ <%= edit_icon(@entity) %>
14
+ </nav>
15
+ <% end %>
14
16
 
15
17
  <dl class="fields">
16
18
  <%= render partial: 'shared/entity/text_field', locals: { entity: @entity, field: :name } %>
17
19
  <%= render partial: 'shared/entity/slug', locals: { entity: @entity } %>
18
20
  <%= render partial: 'shared/entity/timestamps', locals: { entity: @entity } %>
19
21
  </dl>
22
+
23
+ <%=
24
+ render(
25
+ partial: 'admin/navigation_groups/entity/dynamic_pages',
26
+ locals: {
27
+ collection: @entity.navigation_group_pages,
28
+ entity: @entity,
29
+ handler: component_handler
30
+ }
31
+ )
32
+ %>
20
33
  </article>
@@ -0,0 +1,31 @@
1
+ <%= form_with(**Biovision::Components::BaseComponent.form_options(entity)) do |f| %>
2
+ <%= render partial: 'shared/list_of_errors', locals: { entity: entity } %>
3
+
4
+ <dl class="fields">
5
+ <% if entity.id.blank? %>
6
+ <!-- <div>-->
7
+ <!-- <dt><%#= f.label :user_id %></dt>-->
8
+ <!-- <dd>-->
9
+ <%#=
10
+ <!-- f.number_field(-->
11
+ <!-- :user_id,-->
12
+ <!-- in: User.ids_range-->
13
+ <!-- )-->
14
+ %>
15
+ <%#= render partial: 'admin/users/search', locals: { target_id: 'token_user_id' } %>
16
+ <!-- </dd>-->
17
+ <!-- </div>-->
18
+ <% else %>
19
+ <%= render partial: 'shared/entity/linked_entity', locals: { entity: entity.user } %>
20
+ <%= render partial: 'shared/entity/text_field', locals: { entity: entity, field: :token } %>
21
+ <% end %>
22
+ <%= render partial: 'shared/forms/entity_flags', locals: { f: f } %>
23
+ </dl>
24
+
25
+ <%= render 'shared/forms/state_container' %>
26
+
27
+ <div class="buttons">
28
+ <%= hidden_field_tag :entity_id, entity.id %>
29
+ <%= f.button t(:save), class: 'button button-save' %>
30
+ </div>
31
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <div>
2
+ <%= link_to t('.text'), admin_tokens_path %>
3
+ </div>
4
+ <div class="description">
5
+ <%= t('.description') %>
6
+ </div>
@@ -0,0 +1,27 @@
1
+ <figure class="image"><%= simple_image_preview(entity.user) %></figure>
2
+ <div class="data">
3
+ <div><%= admin_entity_link(entity, handler: local_assigns[:handler]) %></div>
4
+ <div class="info">
5
+ <% unless entity.last_used.nil? %>
6
+ <div>
7
+ <%= entity.class.human_attribute_name(:last_used) %>
8
+ <%= time_tag entity.last_used %>
9
+ </div>
10
+ <% end %>
11
+ </div>
12
+ <div class="secondary info">
13
+ <div><%= entity.ip_address&.ip %></div>
14
+ <% unless entity.agent.blank? %>
15
+ <div class="truncate"><%= entity.agent.name %></div>
16
+ <% end %>
17
+ </div>
18
+
19
+ <%= entity_toggle(entity) %>
20
+
21
+ <% if local_assigns[:handler]&.permit?('edit', entity) %>
22
+ <div class="entity-actions">
23
+ <%= edit_icon(entity) %>
24
+ <%= destroy_icon(entity) %>
25
+ </div>
26
+ <% end %>
27
+ </div>
@@ -0,0 +1,11 @@
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.tokens.nav_item.text') %></span>
5
+ <% end %>
6
+
7
+ <article>
8
+ <h1><%= t('.heading') %></h1>
9
+
10
+ <%= entity_list(@collection) %>
11
+ </article>
@@ -0,0 +1,26 @@
1
+ <% content_for :meta_title, t('.title', id: @entity.id) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= admin_biovision_component_link(component_handler.component) %>
4
+ <%= link_to(t('admin.tokens.nav_item.text'), admin_tokens_path) %>
5
+ <span><%= @entity.token %></span>
6
+ <% end %>
7
+
8
+ <article>
9
+ <h1><%= @entity.class.model_name.human %> <%= @entity.id %></h1>
10
+
11
+ <% if component_handler.permit?('edit', @entity) %>
12
+ <nav class="entity-actions">
13
+ <%= edit_icon(@entity) %>
14
+ <%= destroy_icon(@entity) %>
15
+ </nav>
16
+ <% end %>
17
+
18
+ <dl class="fields">
19
+ <%= render partial: 'shared/entity/linked_entity', locals: { entity: @entity.user } %>
20
+ <%= render partial: 'shared/entity/time_field', locals: { entity: @entity, field: :last_used } %>
21
+ <%= render partial: 'shared/entity/timestamps', locals: { entity: @entity } %>
22
+ <%= render partial: 'shared/entity/track', locals: { entity: @entity } %>
23
+ </dl>
24
+
25
+ <%= entity_toggle(@entity) %>
26
+ </article>
@@ -0,0 +1,18 @@
1
+ json.id user.id
2
+ json.type user.class.table_name
3
+ json.attributes do
4
+ json.call(user, :slug, :screen_name)
5
+ end
6
+ json.meta do
7
+ json.text_for_link user.text_for_link
8
+ json.html(
9
+ render(
10
+ partial: 'admin/users/entity/in_search',
11
+ locals: { entity: user },
12
+ formats: [:html]
13
+ )
14
+ )
15
+ end
16
+ json.links do
17
+ json.self admin_user_path(id: user.id)
18
+ end
@@ -7,7 +7,7 @@
7
7
  <% unless entity.inviter_id.nil? %>
8
8
  <div>
9
9
  <dt><%= model.human_attribute_name(:inviter) %></dt>
10
- <dd><%= admin_entity_link(entity.inviter) %></dd>
10
+ <dd><%= admin_entity_link(entity.inviter, handler: local_assigns[:handler]) %></dd>
11
11
  </div>
12
12
  <% end %>
13
13
 
@@ -1,6 +1,6 @@
1
1
  <figure class="image"><%= simple_image_preview(entity) %></figure>
2
2
  <div class="data">
3
- <div><%= admin_entity_link(entity) %></div>
3
+ <div><%= admin_entity_link(entity, handler: local_assigns[:handler]) %></div>
4
4
  <% unless entity.notice.blank? %>
5
5
  <div><%= entity.notice %></div>
6
6
  <% end %>
@@ -29,10 +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
- <%= edit_icon(entity) %>
35
+ <%= edit_icon(entity) if local_assigns[:handler]&.permit?('edit', entity) %>
36
36
  <%= world_icon(entity) %>
37
37
  </div>
38
38
  </div>
@@ -0,0 +1,18 @@
1
+ <figure class="image"><%= simple_image_preview(entity) %></figure>
2
+ <div class="data">
3
+ <div><%= admin_entity_link(entity, handler: local_assigns[:handler]) %></div>
4
+ <% unless entity.notice.blank? %>
5
+ <div><%= entity.notice %></div>
6
+ <% end %>
7
+ <div class="info"><%= entity.slug %></div>
8
+ <% unless entity.email.blank? %>
9
+ <div class="info"><%= entity.email %></div>
10
+ <% end %>
11
+ <div class="secondary info">UUID: <%= entity.uuid %></div>
12
+ <% unless entity.last_seen.nil? %>
13
+ <div class="secondary info">
14
+ <%= entity.class.human_attribute_name(:last_seen) %>:
15
+ <%= time_tag entity.last_seen %>
16
+ </div>
17
+ <% end %>
18
+ </div>
@@ -7,9 +7,18 @@
7
7
  <article>
8
8
  <h1><%= t('.heading') %></h1>
9
9
 
10
- <nav class="entity-actions">
11
- <%= create_icon(new_admin_user_path) %>
12
- </nav>
10
+ <% if component_handler.permit?('users.edit') %>
11
+ <nav class="entity-actions">
12
+ <%= create_icon(new_admin_user_path) %>
13
+ </nav>
14
+ <% end %>
13
15
 
14
- <%= render partial: 'shared/admin/list', locals: { collection: @collection } %>
16
+ <%=
17
+ render(
18
+ partial: 'admin/widgets/quick_search',
19
+ locals: { endpoint: search_admin_users_url }
20
+ )
21
+ %>
22
+
23
+ <%= entity_list(@collection) %>
15
24
  </article>
@@ -0,0 +1,22 @@
1
+ <section class="component-for-user">
2
+ <h2><%= component_name(component) %></h2>
3
+
4
+ <ul class="entity-links">
5
+ <% component.roles.each do |role| %>
6
+ <li>
7
+ <label class="flag-label">
8
+ <%=
9
+ check_box_tag(
10
+ 'role_id',
11
+ role.id,
12
+ entity.role_ids.include?(role.id),
13
+ data: { url: role_admin_user_path(id: entity.id, role_id: role.id) },
14
+ id: nil
15
+ )
16
+ %>
17
+ <span><%= role.slug %></span>
18
+ </label>
19
+ </li>
20
+ <% end %>
21
+ </ul>
22
+ </section>
@@ -0,0 +1,23 @@
1
+ <% content_for :meta_title, t('.title', user: @entity.screen_name) %>
2
+ <% content_for :breadcrumbs do %>
3
+ <%= admin_biovision_component_link(component_handler.component) %>
4
+ <%= link_to(t('admin.users.nav_item.text'), admin_users_path) %>
5
+ <%= admin_entity_link(@entity, handler: component_handler) %>
6
+ <span><%= t('.nav_text') %></span>
7
+ <% end %>
8
+
9
+ <article>
10
+ <h1><%= t('.heading') %></h1>
11
+
12
+ <% @components.each do |component| %>
13
+ <%=
14
+ render(
15
+ partial: 'admin/users/roles/component',
16
+ locals: {
17
+ entity: @entity,
18
+ component: component
19
+ }
20
+ )
21
+ %>
22
+ <% end %>
23
+ </article>
@@ -0,0 +1,4 @@
1
+ json.data @collection do |entity|
2
+ json.partial! entity
3
+ end
4
+ json.partial! 'shared/pagination', locals: { collection: @collection }