biovision 0.1.210414.0 → 0.3.210504.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +43 -34
  3. data/app/assets/stylesheets/biovision/admin/components.scss +10 -0
  4. data/app/assets/stylesheets/biovision/admin/components/users.scss +4 -0
  5. data/app/assets/stylesheets/biovision/admin/layout.scss +0 -8
  6. data/app/assets/stylesheets/biovision/biovision.scss +8 -0
  7. data/app/assets/stylesheets/biovision/components.scss +1 -0
  8. data/app/assets/stylesheets/biovision/components/filters.scss +41 -0
  9. data/app/assets/stylesheets/biovision/components/forms.scss +16 -0
  10. data/app/assets/stylesheets/biovision/components/quick_search.scss +24 -0
  11. data/app/assets/stylesheets/biovision/default.scss +4 -4
  12. data/app/assets/stylesheets/biovision/themes/default_theme.scss +0 -1
  13. data/app/assets/stylesheets/biovision/themes/default_theme/layout.scss +6 -3
  14. data/app/assets/stylesheets/biovision/themes/default_theme/layout/footer.scss +3 -0
  15. data/app/assets/stylesheets/biovision/themes/default_theme/layout/header.scss +2 -0
  16. data/app/assets/stylesheets/biovision/vars.scss +5 -0
  17. data/app/controllers/admin/components_controller.rb +25 -79
  18. data/app/controllers/admin/dynamic_pages_controller.rb +1 -1
  19. data/app/controllers/admin/index_controller.rb +8 -2
  20. data/app/controllers/admin/navigation_groups_controller.rb +31 -0
  21. data/app/controllers/admin/tokens_controller.rb +15 -0
  22. data/app/controllers/admin/users_controller.rb +33 -3
  23. data/app/controllers/admin_controller.rb +15 -2
  24. data/app/controllers/concerns/crud_entities.rb +13 -13
  25. data/app/controllers/contact_controller.rb +1 -1
  26. data/app/helpers/biovision_components_helper.rb +7 -3
  27. data/app/lib/biovision/components/base/component_parameters.rb +8 -0
  28. data/app/lib/biovision/components/base/component_privileges.rb +26 -17
  29. data/app/lib/biovision/components/base/component_settings.rb +8 -0
  30. data/app/lib/biovision/components/base_component.rb +20 -23
  31. data/app/lib/biovision/components/contact_component.rb +5 -1
  32. data/app/lib/biovision/components/content_component.rb +36 -10
  33. data/app/lib/biovision/components/track_component.rb +1 -1
  34. data/app/lib/biovision/components/users_component.rb +28 -2
  35. data/app/lib/biovision/helpers/data_helper.rb +43 -0
  36. data/app/lib/biovision/migrations/component_migration.rb +54 -0
  37. data/app/mailers/feedback_mailer.rb +14 -0
  38. data/app/models/biovision_component.rb +3 -0
  39. data/app/models/browser.rb +1 -1
  40. data/app/models/code.rb +2 -2
  41. data/app/models/concerns/tree_structure.rb +2 -1
  42. data/app/models/contact_method.rb +1 -1
  43. data/app/models/contact_type.rb +1 -1
  44. data/app/models/dynamic_block.rb +1 -1
  45. data/app/models/dynamic_page.rb +3 -1
  46. data/app/models/feedback_message.rb +7 -1
  47. data/app/models/feedback_response.rb +2 -2
  48. data/app/models/navigation_group.rb +11 -1
  49. data/app/models/role.rb +44 -6
  50. data/app/models/simple_image.rb +1 -1
  51. data/app/models/simple_image_tag.rb +1 -1
  52. data/app/models/token.rb +6 -2
  53. data/app/models/user.rb +25 -10
  54. data/app/uploaders/simple_file_uploader.rb +1 -1
  55. data/app/views/admin/components/_list.html.erb +1 -1
  56. data/app/views/admin/components/entity/_links.html.erb +31 -21
  57. data/app/views/admin/components/links/_base.html.erb +1 -0
  58. data/app/views/admin/components/settings.html.erb +2 -1
  59. data/app/views/admin/components/settings/_settings.html.erb +3 -3
  60. data/app/views/admin/dynamic_blocks/entity/_in_list.html.erb +6 -4
  61. data/app/views/admin/dynamic_blocks/index.html.erb +5 -3
  62. data/app/views/admin/dynamic_blocks/show.html.erb +6 -4
  63. data/app/views/admin/dynamic_pages/_dynamic_page.jbuilder +18 -0
  64. data/app/views/admin/dynamic_pages/entity/_in_list.html.erb +4 -2
  65. data/app/views/admin/dynamic_pages/entity/_in_search.html.erb +7 -0
  66. data/app/views/admin/dynamic_pages/index.html.erb +11 -4
  67. data/app/views/admin/dynamic_pages/search.jbuilder +4 -0
  68. data/app/views/admin/dynamic_pages/show.html.erb +1 -1
  69. data/app/views/admin/index/index.html.erb +7 -5
  70. data/app/views/admin/navigation_group_pages/entity/_in_list.html.erb +26 -0
  71. data/app/views/admin/navigation_groups/entity/_dynamic_pages.html.erb +38 -0
  72. data/app/views/admin/navigation_groups/entity/_in_list.html.erb +6 -4
  73. data/app/views/admin/navigation_groups/index.html.erb +11 -4
  74. data/app/views/admin/navigation_groups/show.html.erb +16 -3
  75. data/app/views/admin/tokens/_form.html.erb +31 -0
  76. data/app/views/admin/tokens/_nav_item.html.erb +6 -0
  77. data/app/views/admin/tokens/entity/_in_list.html.erb +27 -0
  78. data/app/views/admin/tokens/index.html.erb +16 -0
  79. data/app/views/admin/tokens/show.html.erb +26 -0
  80. data/app/views/admin/users/_user.jbuilder +18 -0
  81. data/app/views/admin/users/entity/_in_list.html.erb +3 -1
  82. data/app/views/admin/users/entity/_in_search.html.erb +18 -0
  83. data/app/views/admin/users/index.html.erb +13 -4
  84. data/app/views/admin/users/roles.html.erb +23 -0
  85. data/app/views/admin/users/roles/_component.html.erb +22 -0
  86. data/app/views/admin/users/search.jbuilder +4 -0
  87. data/app/views/admin/users/show.html.erb +14 -2
  88. data/app/views/admin/widgets/_filters.html.erb +15 -0
  89. data/app/views/admin/widgets/_quick_search.html.erb +13 -0
  90. data/app/views/admin/widgets/filters/_flag.html.erb +15 -0
  91. data/app/views/components/content/_dynamic_page.html.erb +6 -10
  92. data/app/views/components/content/_dynamic_page_content.html.erb +14 -0
  93. data/app/views/contact/_form.html.erb +1 -1
  94. data/app/views/feedback_mailer/new_feedback_request.html.erb +11 -0
  95. data/app/views/feedback_mailer/new_feedback_request.text.erb +6 -0
  96. data/app/views/index/index.html.erb +14 -0
  97. data/app/views/layouts/admin.html.erb +0 -1
  98. data/app/views/layouts/application/_footer.html.erb +1 -1
  99. data/app/views/my/index/index.html.erb +26 -0
  100. data/app/views/shared/entity/_time_field.html.erb +6 -0
  101. data/app/views/shared/entity/_track.html.erb +12 -0
  102. data/app/views/shared/entity/_tree_caches.html.erb +8 -1
  103. data/app/views/shared/entity/edit.html.erb +5 -3
  104. data/app/views/shared/forms/_simple_image.html.erb +12 -4
  105. data/config/locales/biovision-ru.yml +14 -1
  106. data/config/locales/components-ru.yml +4 -2
  107. data/config/locales/contact-ru.yml +4 -0
  108. data/config/locales/content-ru.yml +4 -0
  109. data/config/locales/users-ru.yml +27 -5
  110. data/config/routes.rb +14 -4
  111. data/db/migrate/20191228000000_create_biovision_components.rb +2 -0
  112. data/db/migrate/20200224000000_create_track_component.rb +8 -12
  113. data/db/migrate/20200224000010_create_users_component.rb +10 -40
  114. data/db/migrate/20210405000000_create_acl.rb +15 -0
  115. data/db/migrate/{20200529000000_create_content_component.rb → 20210421000000_create_content_component.rb} +3 -18
  116. data/db/migrate/{20210401000000_create_contact_component.rb → 20210421000010_create_contact_component.rb} +1 -22
  117. data/lib/biovision/version.rb +1 -1
  118. metadata +34 -13
  119. data/app/lib/biovision/components/base/privilege_handler.rb +0 -79
  120. data/app/views/admin/components/links/_content.html.erb +0 -9
  121. data/app/views/admin/components/links/_track.html.erb +0 -2
  122. data/app/views/admin/components/links/_users.html.erb +0 -4
  123. data/app/views/admin/components/links/extra/_content.html.erb +0 -0
  124. data/app/views/admin/components/privileges.html.erb +0 -20
  125. data/app/views/admin/components/privileges/_component_user.html.erb +0 -17
  126. data/app/views/admin/components/privileges/_links.html.erb +0 -17
  127. data/app/views/admin/components/privileges/_users.html.erb +0 -23
@@ -8,6 +8,8 @@ class CreateAcl < ActiveRecord::Migration[6.1]
8
8
  create_role_groups unless RoleGroup.table_exists?
9
9
  create_user_groups unless UserGroup.table_exists?
10
10
  create_user_roles unless UserRole.table_exists?
11
+
12
+ create_component_roles
11
13
  end
12
14
 
13
15
  def down
@@ -71,4 +73,17 @@ class CreateAcl < ActiveRecord::Migration[6.1]
71
73
  t.timestamps
72
74
  end
73
75
  end
76
+
77
+ def create_component_roles
78
+ BiovisionComponent.pluck(:slug).each do |component|
79
+ next if component == Biovision::Components::BaseComponent.slug
80
+
81
+ Biovision::Components::BaseComponent.handler(component).create_roles
82
+ end
83
+
84
+ base_component = BiovisionComponent[Biovision::Components::BaseComponent]
85
+ %w[admin components.view].each do |role|
86
+ Role.create(biovision_component: base_component, slug: role)
87
+ end
88
+ end
74
89
  end
@@ -1,23 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Create Content component and tables
4
- class CreateContentComponent < ActiveRecord::Migration[6.0]
5
- def up
6
- BiovisionComponent.create(slug: Biovision::Components::ContentComponent.slug)
7
-
8
- create_dynamic_pages unless DynamicPage.table_exists?
9
- create_navigation_groups unless NavigationGroup.table_exists?
10
- create_pages_in_groups unless NavigationGroupPage.table_exists?
11
- create_dynamic_blocks unless DynamicBlock.table_exists?
12
- end
13
-
14
- def down
15
- Biovision::Components::ContentComponent.dependent_models.each do |model|
16
- drop_table model.table_name if model.table_exists?
17
- end
18
-
19
- BiovisionComponent[Biovision::Components::ContentComponent]&.destroy
20
- end
4
+ class CreateContentComponent < ActiveRecord::Migration[6.1]
5
+ include Biovision::Migrations::ComponentMigration
21
6
 
22
7
  private
23
8
 
@@ -50,7 +35,7 @@ class CreateContentComponent < ActiveRecord::Migration[6.0]
50
35
  add_index :dynamic_pages, :data, using: :gin
51
36
  end
52
37
 
53
- def create_pages_in_groups
38
+ def create_navigation_group_pages
54
39
  create_table :navigation_group_pages, comment: 'Dynamic pages in navigation groups' do |t|
55
40
  t.references :navigation_group, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
56
41
  t.references :dynamic_page, null: false, foreign_key: { on_update: :cascade, on_delete: :cascade }
@@ -2,31 +2,10 @@
2
2
 
3
3
  # Create tables for contact component
4
4
  class CreateContactComponent < ActiveRecord::Migration[6.1]
5
- def up
6
- create_component
7
- create_feedback_messages unless FeedbackMessage.table_exists?
8
- create_feedback_responses unless FeedbackResponse.table_exists?
9
- create_contact_types unless ContactType.table_exists?
10
- create_contact_methods unless ContactMethod.table_exists?
11
- end
12
-
13
- def down
14
- Biovision::Components::ContactComponent.dependent_models.each do |model|
15
- drop_table model.table_name if model.table_exists?
16
- end
17
-
18
- BiovisionComponent[Biovision::Components::ContactComponent]&.destroy
19
- end
5
+ include Biovision::Migrations::ComponentMigration
20
6
 
21
7
  private
22
8
 
23
- def create_component
24
- settings = { feedback_email: '' }
25
- slug = Biovision::Components::ContactComponent.slug
26
-
27
- BiovisionComponent.create(slug: slug, settings: settings)
28
- end
29
-
30
9
  def create_feedback_messages
31
10
  create_table :feedback_messages, comment: 'Feedback messages from visitors' do |t|
32
11
  t.uuid :uuid, null: false
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Biovision
4
- VERSION = '0.1.210414.0'
4
+ VERSION = '0.3.210504.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: biovision
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.210414.0
4
+ version: 0.3.210504.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxim Khan-Magomedov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-13 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -252,11 +252,13 @@ files:
252
252
  - app/assets/stylesheets/biovision/components/breadcrumbs.scss
253
253
  - app/assets/stylesheets/biovision/components/buttons.scss
254
254
  - app/assets/stylesheets/biovision/components/carousel.scss
255
+ - app/assets/stylesheets/biovision/components/filters.scss
255
256
  - app/assets/stylesheets/biovision/components/forms.scss
256
257
  - app/assets/stylesheets/biovision/components/hamburger.scss
257
258
  - app/assets/stylesheets/biovision/components/lists.scss
258
259
  - app/assets/stylesheets/biovision/components/messages.scss
259
260
  - app/assets/stylesheets/biovision/components/pagination.scss
261
+ - app/assets/stylesheets/biovision/components/quick_search.scss
260
262
  - app/assets/stylesheets/biovision/components/simple_image.scss
261
263
  - app/assets/stylesheets/biovision/components/toggleable.scss
262
264
  - app/assets/stylesheets/biovision/default.scss
@@ -276,6 +278,7 @@ files:
276
278
  - app/controllers/admin/index_controller.rb
277
279
  - app/controllers/admin/ip_addresses_controller.rb
278
280
  - app/controllers/admin/navigation_groups_controller.rb
281
+ - app/controllers/admin/tokens_controller.rb
279
282
  - app/controllers/admin/users_controller.rb
280
283
  - app/controllers/admin_controller.rb
281
284
  - app/controllers/authentication_controller.rb
@@ -302,7 +305,6 @@ files:
302
305
  - app/lib/biovision/components/base/component_parameters.rb
303
306
  - app/lib/biovision/components/base/component_privileges.rb
304
307
  - app/lib/biovision/components/base/component_settings.rb
305
- - app/lib/biovision/components/base/privilege_handler.rb
306
308
  - app/lib/biovision/components/base_component.rb
307
309
  - app/lib/biovision/components/contact_component.rb
308
310
  - app/lib/biovision/components/content_component.rb
@@ -314,6 +316,8 @@ files:
314
316
  - app/lib/biovision/components/users/registration_handler.rb
315
317
  - app/lib/biovision/components/users/validation.rb
316
318
  - app/lib/biovision/components/users_component.rb
319
+ - app/lib/biovision/helpers/data_helper.rb
320
+ - app/lib/biovision/migrations/component_migration.rb
317
321
  - app/lib/biovision/notifiers/base_notifier.rb
318
322
  - app/lib/biovision/notifiers/contact_notifier.rb
319
323
  - app/lib/biovision/notifiers/socialization_notifier.rb
@@ -321,6 +325,7 @@ files:
321
325
  - app/lib/canonizer.rb
322
326
  - app/lib/carrier_wave/image_optim.rb
323
327
  - app/mailers/code_sender.rb
328
+ - app/mailers/feedback_mailer.rb
324
329
  - app/models/agent.rb
325
330
  - app/models/biovision_component.rb
326
331
  - app/models/biovision_component_user.rb
@@ -376,14 +381,7 @@ files:
376
381
  - app/views/admin/components/image.jbuilder
377
382
  - app/views/admin/components/images.jbuilder
378
383
  - app/views/admin/components/index.html.erb
379
- - app/views/admin/components/links/_content.html.erb
380
- - app/views/admin/components/links/_track.html.erb
381
- - app/views/admin/components/links/_users.html.erb
382
- - app/views/admin/components/links/extra/_content.html.erb
383
- - app/views/admin/components/privileges.html.erb
384
- - app/views/admin/components/privileges/_component_user.html.erb
385
- - app/views/admin/components/privileges/_links.html.erb
386
- - app/views/admin/components/privileges/_users.html.erb
384
+ - app/views/admin/components/links/_base.html.erb
387
385
  - app/views/admin/components/settings.html.erb
388
386
  - app/views/admin/components/settings/_new_parameter.html.erb
389
387
  - app/views/admin/components/settings/_parameters.html.erb
@@ -396,29 +394,47 @@ files:
396
394
  - app/views/admin/dynamic_blocks/entity/_in_list.html.erb
397
395
  - app/views/admin/dynamic_blocks/index.html.erb
398
396
  - app/views/admin/dynamic_blocks/show.html.erb
397
+ - app/views/admin/dynamic_pages/_dynamic_page.jbuilder
399
398
  - app/views/admin/dynamic_pages/_form.html.erb
400
399
  - app/views/admin/dynamic_pages/_nav_item.html.erb
401
400
  - app/views/admin/dynamic_pages/entity/_in_list.html.erb
401
+ - app/views/admin/dynamic_pages/entity/_in_search.html.erb
402
402
  - app/views/admin/dynamic_pages/index.html.erb
403
+ - app/views/admin/dynamic_pages/search.jbuilder
403
404
  - app/views/admin/dynamic_pages/show.html.erb
404
405
  - app/views/admin/index/index.html.erb
405
406
  - app/views/admin/ip_addresses/_nav_item.html.erb
406
407
  - app/views/admin/ip_addresses/entity/_in_list.html.erb
407
408
  - app/views/admin/ip_addresses/index.html.erb
409
+ - app/views/admin/navigation_group_pages/entity/_in_list.html.erb
408
410
  - app/views/admin/navigation_groups/_form.html.erb
409
411
  - app/views/admin/navigation_groups/_nav_item.html.erb
412
+ - app/views/admin/navigation_groups/entity/_dynamic_pages.html.erb
410
413
  - app/views/admin/navigation_groups/entity/_in_list.html.erb
411
414
  - app/views/admin/navigation_groups/index.html.erb
412
415
  - app/views/admin/navigation_groups/show.html.erb
416
+ - app/views/admin/tokens/_form.html.erb
417
+ - app/views/admin/tokens/_nav_item.html.erb
418
+ - app/views/admin/tokens/entity/_in_list.html.erb
419
+ - app/views/admin/tokens/index.html.erb
420
+ - app/views/admin/tokens/show.html.erb
413
421
  - app/views/admin/unauthorized.html.erb
414
422
  - app/views/admin/users/_form.html.erb
415
423
  - app/views/admin/users/_nav_item.html.erb
424
+ - app/views/admin/users/_user.jbuilder
416
425
  - app/views/admin/users/entity/_fields.html.erb
417
426
  - app/views/admin/users/entity/_in_list.html.erb
427
+ - app/views/admin/users/entity/_in_search.html.erb
418
428
  - app/views/admin/users/entity/_profile.html.erb
419
429
  - app/views/admin/users/entity/in_list/_additional_data.html.erb
420
430
  - app/views/admin/users/index.html.erb
431
+ - app/views/admin/users/roles.html.erb
432
+ - app/views/admin/users/roles/_component.html.erb
433
+ - app/views/admin/users/search.jbuilder
421
434
  - app/views/admin/users/show.html.erb
435
+ - app/views/admin/widgets/_filters.html.erb
436
+ - app/views/admin/widgets/_quick_search.html.erb
437
+ - app/views/admin/widgets/filters/_flag.html.erb
422
438
  - app/views/application/forbidden.html.erb
423
439
  - app/views/application/forbidden.jbuilder
424
440
  - app/views/application/not_found.html.erb
@@ -427,6 +443,7 @@ files:
427
443
  - app/views/application/unauthorized.jbuilder
428
444
  - app/views/authentication/new.html.erb
429
445
  - app/views/components/content/_dynamic_page.html.erb
446
+ - app/views/components/content/_dynamic_page_content.html.erb
430
447
  - app/views/components/users/_form_tabs.html.erb
431
448
  - app/views/components/users/_join_form.html.erb
432
449
  - app/views/components/users/_login_form.html.erb
@@ -437,6 +454,8 @@ files:
437
454
  - app/views/contact/feedback.html.erb
438
455
  - app/views/contact/index.html.erb
439
456
  - app/views/fallback/show.html.erb
457
+ - app/views/feedback_mailer/new_feedback_request.html.erb
458
+ - app/views/feedback_mailer/new_feedback_request.text.erb
440
459
  - app/views/index/index.html.erb
441
460
  - app/views/layouts/admin.html.erb
442
461
  - app/views/layouts/admin/_breadcrumbs.html.erb
@@ -484,7 +503,9 @@ files:
484
503
  - app/views/shared/entity/_slug.html.erb
485
504
  - app/views/shared/entity/_text_field.html.erb
486
505
  - app/views/shared/entity/_text_fields.html.erb
506
+ - app/views/shared/entity/_time_field.html.erb
487
507
  - app/views/shared/entity/_timestamps.html.erb
508
+ - app/views/shared/entity/_track.html.erb
488
509
  - app/views/shared/entity/_tree_caches.html.erb
489
510
  - app/views/shared/entity/_uuid.html.erb
490
511
  - app/views/shared/entity/edit.html.erb
@@ -523,9 +544,9 @@ files:
523
544
  - db/migrate/20200224000000_create_track_component.rb
524
545
  - db/migrate/20200224000010_create_users_component.rb
525
546
  - db/migrate/20200404000000_create_simple_images.rb
526
- - db/migrate/20200529000000_create_content_component.rb
527
- - db/migrate/20210401000000_create_contact_component.rb
528
547
  - db/migrate/20210405000000_create_acl.rb
548
+ - db/migrate/20210421000000_create_content_component.rb
549
+ - db/migrate/20210421000010_create_contact_component.rb
529
550
  - lib/biovision.rb
530
551
  - lib/biovision/base_methods.rb
531
552
  - lib/biovision/engine.rb
@@ -1,79 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Biovision
4
- module Components
5
- module Base
6
- # Handling user privileges in component
7
- class PrivilegeHandler
8
- attr_accessor :component
9
-
10
- # @param [BaseComponent] component
11
- def initialize(component)
12
- @component = component
13
- end
14
-
15
- # @param [String|Symbol]
16
- def privilege?(slug)
17
- return false if @component.user_link.nil?
18
-
19
- privileges = Array(@component.user_link.data['privileges'])
20
- privileges.include?(slug)
21
- end
22
-
23
- def administrator!
24
- return if @component.user.nil?
25
-
26
- link = @component.user_link!
27
- link.administrator = true
28
- link.save
29
- end
30
-
31
- def not_administrator!
32
- return if @component.user.nil? || @component.user_link.nil?
33
-
34
- @component.user_link.update(administrator: false)
35
- end
36
-
37
- # @param [Array] new_privileges
38
- def privileges=(new_privileges)
39
- return if @component.user.nil?
40
-
41
- link = @component.user_link!
42
- link.data['privileges'] = Array(new_privileges).uniq
43
- link.save
44
- end
45
-
46
- # @param [Hash] new_settings
47
- def settings=(new_settings)
48
- return if @component.user.nil?
49
-
50
- link = @component.user_link!
51
- link.data['settings'] = new_settings
52
- link.save
53
- end
54
-
55
- # @param [String] slug
56
- def add_privilege(slug)
57
- return if @component.user.nil?
58
-
59
- link = @component.user_link!
60
- link.data['privileges'] ||= []
61
- link.data['privileges'] += [slug.to_s]
62
- link.data['privileges'].uniq!
63
- link.save
64
- end
65
-
66
- # @param [String] slug
67
- def remove_privilege(slug)
68
- link = @component.user_link
69
-
70
- return if link.nil?
71
-
72
- link.data['privileges'] ||= []
73
- link.data['privileges'] -= [slug.to_s]
74
- link.save
75
- end
76
- end
77
- end
78
- end
79
- end
@@ -1,9 +0,0 @@
1
- <li><%= render 'admin/navigation_groups/nav_item' %></li>
2
- <li><%= render 'admin/dynamic_blocks/nav_item' %></li>
3
- <li><%= render 'admin/dynamic_pages/nav_item' %></li>
4
- <%=
5
- render(
6
- partial: 'admin/components/links/extra/content',
7
- locals: { handler: handler }
8
- )
9
- %>
@@ -1,2 +0,0 @@
1
- <li><%= render 'admin/agents/nav_item' %></li>
2
- <li><%= render 'admin/ip_addresses/nav_item' %></li>
@@ -1,4 +0,0 @@
1
- <li><%= render 'admin/users/nav_item' %></li>
2
- <!-- <li><%#= render 'admin/login_attempts/nav_item' %></li>-->
3
- <!-- <li><%#= render 'admin/tokens/nav_item' %></li>-->
4
- <!-- <li><%#= render 'admin/codes/nav_item' %></li>-->
@@ -1,20 +0,0 @@
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>
@@ -1,17 +0,0 @@
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>
@@ -1,17 +0,0 @@
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
- </ul>
@@ -1,23 +0,0 @@
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>