decidim-conferences 0.27.6 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (229) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/conferences/conference_cell.rb +9 -4
  3. data/app/cells/decidim/conferences/conference_dropdown_metadata_cell.rb +19 -0
  4. data/app/cells/decidim/conferences/conference_g_cell.rb +23 -0
  5. data/app/cells/decidim/conferences/conference_metadata_cell.rb +21 -0
  6. data/app/cells/decidim/conferences/conference_s_cell.rb +13 -0
  7. data/app/cells/decidim/conferences/conference_speaker/show.erb +44 -58
  8. data/app/cells/decidim/conferences/conference_speaker_cell.rb +4 -14
  9. data/app/cells/decidim/conferences/content_blocks/highlighted_conferences_cell.rb +15 -14
  10. data/app/cells/decidim/conferences/content_blocks/highlighted_conferences_settings_form/show.erb +3 -0
  11. data/app/cells/decidim/conferences/content_blocks/highlighted_conferences_settings_form_cell.rb +19 -0
  12. data/app/cells/decidim/conferences/linked_participatory_spaces/show.erb +6 -8
  13. data/app/cells/decidim/conferences/linked_participatory_spaces_cell.rb +1 -10
  14. data/app/cells/decidim/conferences/media_link/show.erb +6 -8
  15. data/app/cells/decidim/conferences/partner/image.erb +3 -0
  16. data/app/cells/decidim/conferences/partner/show.erb +8 -8
  17. data/app/cells/decidim/conferences/partner/text.erb +1 -0
  18. data/app/cells/decidim/conferences/partner_cell.rb +4 -2
  19. data/app/cells/decidim/conferences/registration_type/join_conference.erb +15 -12
  20. data/app/cells/decidim/conferences/registration_type/registration_confirm.erb +12 -12
  21. data/app/cells/decidim/conferences/registration_type/show.erb +11 -14
  22. data/app/cells/decidim/conferences/registration_type_cell.rb +3 -3
  23. data/app/commands/decidim/conferences/admin/copy_conference.rb +1 -1
  24. data/app/commands/decidim/conferences/admin/create_conference.rb +2 -11
  25. data/app/commands/decidim/conferences/admin/create_conference_speaker.rb +2 -2
  26. data/app/commands/decidim/conferences/admin/create_media_link.rb +2 -2
  27. data/app/commands/decidim/conferences/admin/create_partner.rb +2 -2
  28. data/app/commands/decidim/conferences/admin/create_registration_type.rb +2 -2
  29. data/app/commands/decidim/conferences/admin/destroy_conference_speaker.rb +2 -2
  30. data/app/commands/decidim/conferences/admin/destroy_media_link.rb +1 -1
  31. data/app/commands/decidim/conferences/admin/destroy_partner.rb +3 -3
  32. data/app/commands/decidim/conferences/admin/destroy_registration_type.rb +1 -1
  33. data/app/commands/decidim/conferences/admin/invite_user_to_join_conference.rb +5 -5
  34. data/app/commands/decidim/conferences/admin/publish_conference.rb +9 -26
  35. data/app/commands/decidim/conferences/admin/send_conference_diplomas.rb +1 -1
  36. data/app/commands/decidim/conferences/admin/update_conference.rb +2 -11
  37. data/app/commands/decidim/conferences/admin/update_conference_speaker.rb +1 -1
  38. data/app/commands/decidim/conferences/admin/update_media_link.rb +1 -1
  39. data/app/commands/decidim/conferences/admin/update_partner.rb +1 -1
  40. data/app/commands/decidim/conferences/admin/update_registration_type.rb +1 -1
  41. data/app/commands/decidim/conferences/decline_invitation.rb +1 -1
  42. data/app/commands/decidim/conferences/join_conference.rb +5 -5
  43. data/app/constraints/decidim/conferences/current_component.rb +2 -2
  44. data/app/constraints/decidim/conferences/current_conference.rb +2 -2
  45. data/app/controllers/concerns/decidim/conferences/admin/conference_context.rb +1 -1
  46. data/app/controllers/decidim/conferences/admin/concerns/conference_admin.rb +2 -2
  47. data/app/controllers/decidim/conferences/admin/conference_attachment_collections_controller.rb +6 -1
  48. data/app/controllers/decidim/conferences/admin/conference_attachments_controller.rb +5 -0
  49. data/app/controllers/decidim/conferences/admin/conference_invites_controller.rb +2 -1
  50. data/app/controllers/decidim/conferences/admin/conference_publications_controller.rb +10 -28
  51. data/app/controllers/decidim/conferences/admin/conference_registrations_controller.rb +1 -1
  52. data/app/controllers/decidim/conferences/admin/conference_user_roles_controller.rb +8 -90
  53. data/app/controllers/decidim/conferences/admin/conferences_controller.rb +2 -0
  54. data/app/controllers/decidim/conferences/admin/diplomas_controller.rb +1 -1
  55. data/app/controllers/decidim/conferences/admin/exports_controller.rb +1 -1
  56. data/app/controllers/decidim/conferences/admin/imports_controller.rb +1 -1
  57. data/app/controllers/decidim/conferences/admin/moderations/reports_controller.rb +1 -1
  58. data/app/controllers/decidim/conferences/admin/moderations_controller.rb +1 -1
  59. data/app/controllers/decidim/conferences/application_controller.rb +6 -0
  60. data/app/controllers/decidim/conferences/conference_registrations_controller.rb +3 -3
  61. data/app/controllers/decidim/conferences/conferences_controller.rb +9 -2
  62. data/app/events/decidim/conferences/conference_registration_notification_event.rb +3 -13
  63. data/app/events/decidim/conferences/conference_registrations_enabled_event.rb +1 -1
  64. data/app/events/decidim/conferences/conference_registrations_over_percentage_event.rb +1 -1
  65. data/app/events/decidim/conferences/conference_role_assigned_event.rb +6 -6
  66. data/app/forms/decidim/conferences/admin/conference_copy_form.rb +1 -1
  67. data/app/forms/decidim/conferences/admin/conference_form.rb +4 -15
  68. data/app/forms/decidim/conferences/admin/conference_user_role_form.rb +2 -17
  69. data/app/helpers/decidim/conferences/admin/conferences_helper.rb +0 -4
  70. data/app/helpers/decidim/conferences/conference_helper.rb +55 -0
  71. data/app/helpers/decidim/conferences/conference_program_helper.rb +1 -1
  72. data/app/helpers/decidim/conferences/media_attachments_helper.rb +0 -10
  73. data/app/helpers/decidim/conferences/partners_helper.rb +3 -1
  74. data/app/mailers/decidim/conferences/admin/invite_join_conference_mailer.rb +1 -1
  75. data/app/mailers/decidim/conferences/admin/send_conference_diploma_mailer.rb +1 -1
  76. data/app/mailers/decidim/conferences/conference_registration_mailer.rb +2 -2
  77. data/app/models/decidim/conference.rb +4 -4
  78. data/app/models/decidim/conference_user_role.rb +6 -34
  79. data/app/packs/entrypoints/decidim_conferences.js +5 -0
  80. data/app/packs/src/decidim/conferences/admin/conferences.js +6 -6
  81. data/app/packs/stylesheets/decidim/conferences/_conference.scss +102 -0
  82. data/app/packs/stylesheets/decidim/conferences/_media.scss +13 -0
  83. data/app/packs/stylesheets/decidim/conferences/_program.scss +43 -0
  84. data/app/packs/stylesheets/decidim/conferences/_registration.scss +39 -0
  85. data/app/packs/stylesheets/decidim/conferences/_speaker.scss +83 -0
  86. data/app/packs/stylesheets/decidim/conferences/conferences.scss +5 -3
  87. data/app/permissions/decidim/conferences/permissions.rb +2 -13
  88. data/app/presenters/decidim/conference_speaker_presenter.rb +1 -1
  89. data/app/presenters/decidim/conferences/admin_log/conference_invite_presenter.rb +2 -2
  90. data/app/presenters/decidim/conferences/admin_log/conference_presenter.rb +2 -2
  91. data/app/presenters/decidim/conferences/admin_log/conference_registration_presenter.rb +2 -2
  92. data/app/presenters/decidim/conferences/admin_log/conference_speaker_presenter.rb +2 -2
  93. data/app/presenters/decidim/conferences/admin_log/conference_user_role_presenter.rb +2 -2
  94. data/app/presenters/decidim/conferences/admin_log/media_link_presenter.rb +2 -2
  95. data/app/presenters/decidim/conferences/admin_log/partner_presenter.rb +2 -2
  96. data/app/presenters/decidim/conferences/admin_log/registration_type_presenter.rb +2 -2
  97. data/app/presenters/decidim/conferences/conference_stats_presenter.rb +3 -28
  98. data/app/queries/decidim/conferences/admin/admin_users.rb +4 -4
  99. data/app/queries/decidim/conferences/conferences_with_user_role.rb +2 -2
  100. data/app/queries/decidim/conferences/organization_conferences.rb +1 -1
  101. data/app/queries/decidim/conferences/organization_published_conferences.rb +1 -1
  102. data/app/views/decidim/conferences/admin/conference_copies/_form.html.erb +22 -28
  103. data/app/views/decidim/conferences/admin/conference_copies/new.html.erb +16 -5
  104. data/app/views/decidim/conferences/admin/conference_invites/_form.html.erb +17 -19
  105. data/app/views/decidim/conferences/admin/conference_invites/index.html.erb +69 -74
  106. data/app/views/decidim/conferences/admin/conference_invites/new.html.erb +21 -17
  107. data/app/views/decidim/conferences/admin/conference_registrations/index.html.erb +45 -45
  108. data/app/views/decidim/conferences/admin/conference_speakers/_form.html.erb +42 -46
  109. data/app/views/decidim/conferences/admin/conference_speakers/edit.html.erb +16 -6
  110. data/app/views/decidim/conferences/admin/conference_speakers/index.html.erb +52 -55
  111. data/app/views/decidim/conferences/admin/conference_speakers/new.html.erb +16 -6
  112. data/app/views/decidim/conferences/admin/conference_user_roles/_form.html.erb +14 -18
  113. data/app/views/decidim/conferences/admin/conference_user_roles/edit.html.erb +16 -6
  114. data/app/views/decidim/conferences/admin/conference_user_roles/index.html.erb +53 -56
  115. data/app/views/decidim/conferences/admin/conference_user_roles/new.html.erb +16 -6
  116. data/app/views/decidim/conferences/admin/conferences/_form.html.erb +88 -88
  117. data/app/views/decidim/conferences/admin/conferences/edit.html.erb +26 -12
  118. data/app/views/decidim/conferences/admin/conferences/index.html.erb +55 -64
  119. data/app/views/decidim/conferences/admin/conferences/new.html.erb +16 -8
  120. data/app/views/decidim/conferences/admin/diplomas/_form.html.erb +18 -24
  121. data/app/views/decidim/conferences/admin/diplomas/edit.html.erb +19 -5
  122. data/app/views/decidim/conferences/admin/media_links/_form.html.erb +15 -19
  123. data/app/views/decidim/conferences/admin/media_links/edit.html.erb +16 -6
  124. data/app/views/decidim/conferences/admin/media_links/index.html.erb +37 -40
  125. data/app/views/decidim/conferences/admin/media_links/new.html.erb +16 -6
  126. data/app/views/decidim/conferences/admin/partners/_form.html.erb +18 -22
  127. data/app/views/decidim/conferences/admin/partners/edit.html.erb +16 -6
  128. data/app/views/decidim/conferences/admin/partners/index.html.erb +45 -48
  129. data/app/views/decidim/conferences/admin/partners/new.html.erb +16 -6
  130. data/app/views/decidim/conferences/admin/registration_types/_form.html.erb +23 -23
  131. data/app/views/decidim/conferences/admin/registration_types/edit.html.erb +16 -6
  132. data/app/views/decidim/conferences/admin/registration_types/index.html.erb +52 -56
  133. data/app/views/decidim/conferences/admin/registration_types/new.html.erb +16 -6
  134. data/app/views/decidim/conferences/admin/send_conference_diploma_mailer/diploma_user.html.erb +2 -2
  135. data/app/views/decidim/conferences/conference_program/_program_item.html.erb +21 -24
  136. data/app/views/decidim/conferences/conference_program/_program_meeting.html.erb +29 -63
  137. data/app/views/decidim/conferences/conference_program/show.html.erb +27 -39
  138. data/app/views/decidim/conferences/conference_speakers/index.html.erb +12 -6
  139. data/app/views/decidim/conferences/conferences/_conference_hero.html.erb +33 -0
  140. data/app/views/decidim/conferences/conferences/_partners.html.erb +10 -13
  141. data/app/views/decidim/conferences/conferences/index.html.erb +17 -7
  142. data/app/views/decidim/conferences/conferences/show.html.erb +84 -50
  143. data/app/views/decidim/conferences/media/index.html.erb +33 -19
  144. data/app/views/decidim/conferences/registration_types/index.html.erb +25 -17
  145. data/app/views/layouts/decidim/admin/conference.html.erb +12 -14
  146. data/app/views/layouts/decidim/admin/conferences.html.erb +13 -8
  147. data/app/views/layouts/decidim/conference.html.erb +7 -17
  148. data/app/views/layouts/decidim/conferences/_conference_nav_item.html.erb +6 -0
  149. data/app/views/layouts/decidim/conferences/application.html.erb +6 -0
  150. data/config/assets.rb +1 -1
  151. data/config/initializers/wicked_pdf.rb +1 -1
  152. data/config/locales/ar.yml +3 -64
  153. data/config/locales/bg.yml +0 -85
  154. data/config/locales/ca.yml +34 -54
  155. data/config/locales/cs.yml +35 -53
  156. data/config/locales/de.yml +33 -53
  157. data/config/locales/el.yml +11 -51
  158. data/config/locales/en.yml +34 -54
  159. data/config/locales/es-MX.yml +32 -52
  160. data/config/locales/es-PY.yml +32 -52
  161. data/config/locales/es.yml +32 -52
  162. data/config/locales/eu.yml +33 -58
  163. data/config/locales/fi-plain.yml +32 -52
  164. data/config/locales/fi.yml +32 -52
  165. data/config/locales/fr-CA.yml +31 -51
  166. data/config/locales/fr.yml +31 -51
  167. data/config/locales/ga-IE.yml +0 -17
  168. data/config/locales/gl.yml +3 -62
  169. data/config/locales/hu.yml +15 -53
  170. data/config/locales/id-ID.yml +3 -57
  171. data/config/locales/it.yml +4 -62
  172. data/config/locales/ja.yml +33 -54
  173. data/config/locales/lb.yml +1 -55
  174. data/config/locales/lt.yml +14 -52
  175. data/config/locales/lv.yml +1 -61
  176. data/config/locales/nl.yml +3 -62
  177. data/config/locales/no.yml +1 -62
  178. data/config/locales/pl.yml +1 -79
  179. data/config/locales/pt-BR.yml +1 -72
  180. data/config/locales/pt.yml +2 -63
  181. data/config/locales/ro-RO.yml +13 -50
  182. data/config/locales/sk.yml +1 -61
  183. data/config/locales/sl.yml +0 -2
  184. data/config/locales/sr-CS.yml +0 -9
  185. data/config/locales/sv.yml +7 -62
  186. data/config/locales/tr-TR.yml +13 -62
  187. data/config/locales/zh-CN.yml +3 -60
  188. data/config/locales/zh-TW.yml +6 -47
  189. data/db/migrate/20221116084952_add_weight_to_conferences.rb +7 -0
  190. data/lib/decidim/conferences/admin_engine.rb +14 -138
  191. data/lib/decidim/conferences/content_blocks/registry_manager.rb +21 -0
  192. data/lib/decidim/conferences/engine.rb +17 -15
  193. data/lib/decidim/conferences/menu.rb +182 -0
  194. data/lib/decidim/conferences/participatory_space.rb +6 -200
  195. data/lib/decidim/conferences/query_extensions.rb +2 -2
  196. data/lib/decidim/conferences/seeds.rb +153 -0
  197. data/lib/decidim/conferences/test/factories.rb +37 -73
  198. data/lib/decidim/conferences/version.rb +1 -1
  199. metadata +48 -52
  200. data/app/cells/decidim/conferences/conference_address/show.erb +0 -11
  201. data/app/cells/decidim/conferences/conference_address_cell.rb +0 -11
  202. data/app/cells/decidim/conferences/conference_m/footer.erb +0 -9
  203. data/app/cells/decidim/conferences/conference_m/tags.erb +0 -1
  204. data/app/cells/decidim/conferences/conference_m_cell.rb +0 -38
  205. data/app/cells/decidim/conferences/content_blocks/highlighted_conferences/show.erb +0 -30
  206. data/app/cells/decidim/conferences/photo/show.erb +0 -26
  207. data/app/cells/decidim/conferences/photo_cell.rb +0 -41
  208. data/app/cells/decidim/conferences/photos_list/show.erb +0 -8
  209. data/app/cells/decidim/conferences/photos_list_cell.rb +0 -18
  210. data/app/commands/decidim/conferences/admin/create_conference_admin.rb +0 -114
  211. data/app/commands/decidim/conferences/admin/destroy_conference_admin.rb +0 -58
  212. data/app/commands/decidim/conferences/admin/notify_role_assigned_to_conference.rb +0 -22
  213. data/app/commands/decidim/conferences/admin/unpublish_conference.rb +0 -39
  214. data/app/commands/decidim/conferences/admin/update_conference_admin.rb +0 -53
  215. data/app/controllers/decidim/conferences/conference_widgets_controller.rb +0 -33
  216. data/app/queries/decidim/conferences/admin/conference_invites.rb +0 -60
  217. data/app/views/decidim/conferences/_order_by_conferences.html.erb +0 -3
  218. data/app/views/decidim/conferences/conferences/_promoted_conference.html.erb +0 -27
  219. data/app/views/decidim/conferences/media/_attachments.html.erb +0 -6
  220. data/app/views/decidim/conferences/shared/_conference_user_login.html.erb +0 -14
  221. data/app/views/layouts/decidim/_conference_hero.html.erb +0 -42
  222. data/app/views/layouts/decidim/_conferences_nav.html.erb +0 -46
  223. data/config/locales/he-IL.yml +0 -1
  224. data/db/seeds/Exampledocument.pdf +0 -0
  225. data/db/seeds/city.jpeg +0 -0
  226. data/db/seeds/city2.jpeg +0 -0
  227. data/db/seeds/homepage_image.jpg +0 -0
  228. data/db/seeds/logo.png +0 -0
  229. data/decidim-conferences.gemspec +0 -33
@@ -0,0 +1,182 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Conferences
5
+ class Menu
6
+ def self.register_menu!
7
+ Decidim.menu :menu do |menu|
8
+ menu.add_item :conferences,
9
+ I18n.t("menu.conferences", scope: "decidim"),
10
+ decidim_conferences.conferences_path,
11
+ position: 2.8,
12
+ if: Decidim::Conference.where(organization: current_organization).published.any?,
13
+ active: :inclusive
14
+ end
15
+ end
16
+
17
+ def self.register_home_content_block_menu!
18
+ Decidim.menu :home_content_block_menu do |menu|
19
+ menu.add_item :conferences,
20
+ I18n.t("menu.conferences", scope: "decidim"),
21
+ decidim_conferences.conferences_path,
22
+ position: 50,
23
+ if: Decidim::Conference.where(organization: current_organization).published.any?,
24
+ active: :inclusive
25
+ end
26
+ end
27
+
28
+ def self.register_admin_conferences_components_menu!
29
+ Decidim.menu :admin_conferences_components_menu do |menu|
30
+ current_participatory_space.components.each do |component|
31
+ caption = translated_attribute(component.name)
32
+ if component.primary_stat.present?
33
+ caption += content_tag(:span, component.primary_stat, class: component.primary_stat.zero? ? "component-counter component-counter--off" : "component-counter")
34
+ end
35
+
36
+ menu.add_item [component.manifest_name, component.id].join("_"),
37
+ caption.html_safe,
38
+ manage_component_path(component),
39
+ active: is_active_link?(manage_component_path(component)) ||
40
+ is_active_link?(decidim_admin_conferences.edit_component_path(current_participatory_space, component)) ||
41
+ is_active_link?(decidim_admin_conferences.edit_component_permissions_path(current_participatory_space, component)) ||
42
+ participatory_space_active_link?(component),
43
+ if: component.manifest.admin_engine && user_role_config.component_is_accessible?(component.manifest_name)
44
+ end
45
+ end
46
+ end
47
+
48
+ def self.register_conferences_admin_registrations_menu!
49
+ Decidim.menu :conferences_admin_registrations_menu do |menu|
50
+ menu.add_item :conference_registration_types,
51
+ I18n.t("registration_types", scope: "decidim.admin.menu.conferences_submenu"),
52
+ decidim_admin_conferences.conference_registration_types_path(current_participatory_space),
53
+ active: is_active_link?(decidim_admin_conferences.conference_registration_types_path(current_participatory_space)),
54
+ if: allowed_to?(:read, :registration_type, conference: current_participatory_space)
55
+
56
+ menu.add_item :conference_conference_registrations,
57
+ I18n.t("user_registrations", scope: "decidim.admin.menu.conferences_submenu"),
58
+ decidim_admin_conferences.conference_conference_registrations_path(current_participatory_space),
59
+ active: is_active_link?(decidim_admin_conferences.conference_conference_registrations_path(current_participatory_space)),
60
+ if: allowed_to?(:read, :conference_registration, conference: current_participatory_space)
61
+
62
+ menu.add_item :conference_conference_invites,
63
+ I18n.t("conference_invites", scope: "decidim.admin.menu.conferences_submenu"),
64
+ decidim_admin_conferences.conference_conference_invites_path(current_participatory_space),
65
+ active: is_active_link?(decidim_admin_conferences.conference_conference_invites_path(current_participatory_space)),
66
+ if: allowed_to?(:read, :conference_invite, conference: current_participatory_space)
67
+
68
+ menu.add_item :edit_conference_diploma,
69
+ I18n.t("diploma", scope: "decidim.admin.menu.conferences_submenu"),
70
+ decidim_admin_conferences.edit_conference_diploma_path(current_participatory_space),
71
+ active: is_active_link?(decidim_admin_conferences.edit_conference_diploma_path(current_participatory_space)),
72
+ if: allowed_to?(:update, :conference, conference: current_participatory_space)
73
+ end
74
+ end
75
+
76
+ def self.register_conferences_admin_attachments_menu!
77
+ Decidim.menu :conferences_admin_attachments_menu do |menu|
78
+ menu.add_item :conference_attachments,
79
+ I18n.t("attachment_files", scope: "decidim.admin.menu.conferences_submenu"),
80
+ decidim_admin_conferences.conference_attachments_path(current_participatory_space),
81
+ active: is_active_link?(decidim_admin_conferences.conference_attachments_path(current_participatory_space)),
82
+ if: allowed_to?(:read, :attachment, conference: current_participatory_space),
83
+ icon_name: "attachment-line"
84
+
85
+ menu.add_item :conference_attachment_collections,
86
+ I18n.t("attachment_collections", scope: "decidim.admin.menu.conferences_submenu"),
87
+ decidim_admin_conferences.conference_attachment_collections_path(current_participatory_space),
88
+ active: is_active_link?(decidim_admin_conferences.conference_attachment_collections_path(current_participatory_space)),
89
+ if: allowed_to?(:read, :attachment_collection, conference: current_participatory_space),
90
+ icon_name: "folder-line"
91
+ end
92
+ end
93
+
94
+ def self.register_conferences_admin_menu!
95
+ Decidim.menu :conferences_admin_menu do |menu|
96
+ menu.add_item :edit_conference,
97
+ I18n.t("info", scope: "decidim.admin.menu.conferences_submenu"),
98
+ decidim_admin_conferences.edit_conference_path(current_participatory_space),
99
+ position: 1,
100
+ icon_name: "information-line",
101
+ if: allowed_to?(:update, :conference, conference: current_participatory_space)
102
+
103
+ menu.add_item :components,
104
+ I18n.t("components", scope: "decidim.admin.menu.conferences_submenu"),
105
+ decidim_admin_conferences.components_path(current_participatory_space),
106
+ icon_name: "tools-line",
107
+ if: allowed_to?(:read, :component, conference: current_participatory_space),
108
+ active: is_active_link?(decidim_admin_conferences.components_path(current_participatory_space),
109
+ ["decidim/conferences/admin/components", %w(index new edit)]),
110
+ submenu: { target_menu: :admin_conferences_components_menu }
111
+
112
+ menu.add_item :categories,
113
+ I18n.t("categories", scope: "decidim.admin.menu.conferences_submenu"),
114
+ decidim_admin_conferences.categories_path(current_participatory_space),
115
+ icon_name: "price-tag-3-line",
116
+ if: allowed_to?(:read, :category, conference: current_participatory_space)
117
+
118
+ menu.add_item :attachments,
119
+ I18n.t("attachments", scope: "decidim.admin.menu.conferences_submenu"),
120
+ decidim_admin_conferences.conference_attachments_path(current_participatory_space),
121
+ icon_name: "attachment-2",
122
+ active: is_active_link?(decidim_admin_conferences.conference_attachment_collections_path(current_participatory_space)) ||
123
+ is_active_link?(decidim_admin_conferences.conference_attachments_path(current_participatory_space)),
124
+ if: allowed_to?(:read, :attachment, conference: current_participatory_space) ||
125
+ allowed_to?(:read, :attachment_collection, conference: current_participatory_space)
126
+
127
+ menu.add_item :conference_media_links,
128
+ I18n.t("media_links", scope: "decidim.admin.menu.conferences_submenu"),
129
+ decidim_admin_conferences.conference_media_links_path(current_participatory_space),
130
+ icon_name: "film-line",
131
+ active: is_active_link?(decidim_admin_conferences.conference_media_links_path(current_participatory_space))
132
+
133
+ menu.add_item :conference_partners,
134
+ I18n.t("partners", scope: "decidim.admin.menu.conferences_submenu"),
135
+ decidim_admin_conferences.conference_partners_path(current_participatory_space),
136
+ icon_name: "service-line",
137
+ if: allowed_to?(:read, :partner, conference: current_participatory_space)
138
+
139
+ menu.add_item :conference_speakers,
140
+ I18n.t("conference_speakers", scope: "decidim.admin.menu.conferences_submenu"),
141
+ decidim_admin_conferences.conference_speakers_path(current_participatory_space),
142
+ icon_name: "user-voice-line",
143
+ if: allowed_to?(:read, :conference_speaker, conference: current_participatory_space)
144
+
145
+ menu.add_item :registrations,
146
+ I18n.t("registrations", scope: "decidim.admin.menu.conferences_submenu"),
147
+ "#",
148
+ active: false,
149
+ icon_name: "group-line",
150
+ if: allowed_to?(:read, :conference_invite, conference: current_participatory_space) ||
151
+ allowed_to?(:read, :registration_type, conference: current_participatory_space) ||
152
+ allowed_to?(:read, :conference_registration, conference: current_participatory_space),
153
+ submenu: { target_menu: :conferences_admin_registrations_menu }
154
+
155
+ menu.add_item :conference_user_roles,
156
+ I18n.t("conference_admins", scope: "decidim.admin.menu.conferences_submenu"),
157
+ decidim_admin_conferences.conference_user_roles_path(current_participatory_space),
158
+ icon_name: "user-settings-line",
159
+ if: allowed_to?(:read, :conference_user_role, conference: current_participatory_space)
160
+
161
+ menu.add_item :moderations,
162
+ I18n.t("moderations", scope: "decidim.admin.menu.conferences_submenu"),
163
+ decidim_admin_conferences.moderations_path(current_participatory_space),
164
+ icon_name: "flag-line",
165
+ if: allowed_to?(:read, :moderation, conference: current_participatory_space)
166
+ end
167
+ end
168
+
169
+ def self.register_admin_menu_modules!
170
+ Decidim.menu :admin_menu_modules do |menu|
171
+ menu.add_item :conferences,
172
+ I18n.t("menu.conferences", scope: "decidim.admin"),
173
+ decidim_admin_conferences.conferences_path,
174
+ icon_name: "live-line",
175
+ position: 2.8,
176
+ active: :inclusive,
177
+ if: allowed_to?(:enter, :space_area, space_name: :conferences)
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
@@ -17,6 +17,8 @@ Decidim.register_participatory_space(:conferences) do |participatory_space|
17
17
 
18
18
  participatory_space.query_type = "Decidim::Conferences::ConferenceType"
19
19
 
20
+ participatory_space.breadcrumb_cell = "decidim/conferences/conference_dropdown_metadata"
21
+
20
22
  participatory_space.register_resource(:conference) do |resource|
21
23
  resource.model_class_name = "Decidim::Conference"
22
24
  resource.card = "decidim/conferences/conference"
@@ -35,209 +37,13 @@ Decidim.register_participatory_space(:conferences) do |participatory_space|
35
37
  end
36
38
 
37
39
  participatory_space.register_on_destroy_account do |user|
38
- Decidim::ConferenceUserRole.where(user: user).destroy_all
39
- Decidim::ConferenceSpeaker.where(user: user).destroy_all
40
+ Decidim::ConferenceUserRole.where(user:).destroy_all
41
+ Decidim::ConferenceSpeaker.where(user:).destroy_all
40
42
  end
41
43
 
42
44
  participatory_space.seeds do
43
- organization = Decidim::Organization.first
44
- seeds_root = File.join(__dir__, "..", "..", "..", "db", "seeds")
45
-
46
- Decidim::ContentBlock.create(
47
- organization: organization,
48
- weight: 33,
49
- scope_name: :homepage,
50
- manifest_name: :highlighted_conferences,
51
- published_at: Time.current
52
- )
53
-
54
- 2.times do |_n|
55
- conference = Decidim::Conference.create!(
56
- title: Decidim::Faker::Localized.sentence(word_count: 5),
57
- slogan: Decidim::Faker::Localized.sentence(word_count: 2),
58
- slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
59
- hashtag: "##{Faker::Lorem.word}",
60
- short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
61
- Decidim::Faker::Localized.sentence(word_count: 3)
62
- end,
63
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
64
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
65
- end,
66
- organization: organization,
67
- hero_image: ActiveStorage::Blob.create_and_upload!(
68
- io: File.open(File.join(seeds_root, "city.jpeg")),
69
- filename: "hero_image.jpeg",
70
- content_type: "image/jpeg",
71
- metadata: nil
72
- ), # Keep after organization
73
- banner_image: ActiveStorage::Blob.create_and_upload!(
74
- io: File.open(File.join(seeds_root, "city2.jpeg")),
75
- filename: "banner_image.jpeg",
76
- content_type: "image/jpeg",
77
- metadata: nil
78
- ), # Keep after organization
79
- promoted: true,
80
- published_at: 2.weeks.ago,
81
- objectives: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
82
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
83
- end,
84
- start_date: Time.current,
85
- end_date: 2.months.from_now.at_midnight,
86
- registrations_enabled: [true, false].sample,
87
- available_slots: (10..50).step(10).to_a.sample,
88
- registration_terms: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
89
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
90
- end
91
- )
92
- conference.add_to_index_as_search_resource
93
-
94
- # Create users with specific roles
95
- Decidim::ConferenceUserRole::ROLES.each do |role|
96
- email = "conference_#{conference.id}_#{role}@example.org"
97
-
98
- user = Decidim::User.find_or_initialize_by(email: email)
99
- user.update!(
100
- name: Faker::Name.name,
101
- nickname: Faker::Twitter.unique.screen_name,
102
- password: "decidim123456789",
103
- password_confirmation: "decidim123456789",
104
- organization: organization,
105
- confirmed_at: Time.current,
106
- locale: I18n.default_locale,
107
- tos_agreement: true
108
- )
109
-
110
- Decidim::ConferenceUserRole.find_or_create_by!(
111
- user: user,
112
- conference: conference,
113
- role: role
114
- )
115
- end
116
-
117
- attachment_collection = Decidim::AttachmentCollection.create!(
118
- name: Decidim::Faker::Localized.word,
119
- description: Decidim::Faker::Localized.sentence(word_count: 5),
120
- collection_for: conference
121
- )
122
-
123
- Decidim::Attachment.create!(
124
- title: Decidim::Faker::Localized.sentence(word_count: 2),
125
- description: Decidim::Faker::Localized.sentence(word_count: 5),
126
- attachment_collection: attachment_collection,
127
- attached_to: conference,
128
- content_type: "application/pdf",
129
- file: ActiveStorage::Blob.create_and_upload!(
130
- io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
131
- filename: "Exampledocument.pdf",
132
- content_type: "application/pdf",
133
- metadata: nil
134
- ) # Keep after attached_to
135
- )
136
-
137
- Decidim::Attachment.create!(
138
- title: Decidim::Faker::Localized.sentence(word_count: 2),
139
- description: Decidim::Faker::Localized.sentence(word_count: 5),
140
- attached_to: conference,
141
- content_type: "image/jpeg",
142
- file: ActiveStorage::Blob.create_and_upload!(
143
- io: File.open(File.join(seeds_root, "city.jpeg")),
144
- filename: "city.jpeg",
145
- content_type: "image/jpeg",
146
- metadata: nil
147
- ) # Keep after attached_to
148
- )
149
-
150
- Decidim::Attachment.create!(
151
- title: Decidim::Faker::Localized.sentence(word_count: 2),
152
- description: Decidim::Faker::Localized.sentence(word_count: 5),
153
- attached_to: conference,
154
- content_type: "application/pdf",
155
- file: ActiveStorage::Blob.create_and_upload!(
156
- io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
157
- filename: "Exampledocument.pdf",
158
- content_type: "application/pdf",
159
- metadata: nil
160
- ) # Keep after attached_to
161
- )
162
-
163
- 2.times do
164
- Decidim::Category.create!(
165
- name: Decidim::Faker::Localized.sentence(word_count: 5),
166
- description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
167
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
168
- end,
169
- participatory_space: conference
170
- )
171
- end
172
-
173
- 5.times do
174
- Decidim::ConferenceSpeaker.create!(
175
- user: conference.organization.users.sample,
176
- full_name: Faker::Name.name,
177
- position: Decidim::Faker::Localized.word,
178
- affiliation: Decidim::Faker::Localized.sentence(word_count: 3),
179
- short_bio: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
180
- Decidim::Faker::Localized.paragraph(sentence_count: 3)
181
- end,
182
- twitter_handle: Faker::Twitter.unique.screen_name,
183
- personal_url: Faker::Internet.url,
184
- conference: conference
185
- )
186
- end
187
-
188
- Decidim::Conferences::Partner::TYPES.map do |type|
189
- 4.times do
190
- Decidim::Conferences::Partner.create!(
191
- name: Faker::Name.name,
192
- weight: Faker::Number.between(from: 1, to: 10),
193
- link: Faker::Internet.url,
194
- partner_type: type,
195
- conference: conference,
196
- logo: ActiveStorage::Blob.create_and_upload!(
197
- io: File.open(File.join(seeds_root, "logo.png")),
198
- filename: "logo.png",
199
- content_type: "image/png",
200
- metadata: nil
201
- ) # Keep after conference
202
- )
203
- end
204
- end
205
-
206
- 5.times do
207
- Decidim::Conferences::MediaLink.create!(
208
- title: Decidim::Faker::Localized.sentence(word_count: 2),
209
- link: Faker::Internet.url,
210
- date: Date.current,
211
- weight: Faker::Number.between(from: 1, to: 10),
212
- conference: conference
213
- )
214
- end
215
-
216
- 5.times do
217
- Decidim::Conferences::RegistrationType.create!(
218
- title: Decidim::Faker::Localized.sentence(word_count: 2),
219
- description: Decidim::Faker::Localized.sentence(word_count: 5),
220
- weight: Faker::Number.between(from: 1, to: 10),
221
- price: Faker::Number.between(from: 1, to: 300),
222
- published_at: 2.weeks.ago,
223
- conference: conference
224
- )
225
- end
226
-
227
- Decidim.component_manifests.each do |manifest|
228
- manifest.seed!(conference.reload)
229
- end
230
-
231
- Decidim::ConferenceMeeting.where(component: conference.components).each do |conference_meeting|
232
- next unless Faker::Boolean.boolean(true_ratio: 0.5)
45
+ require "decidim/conferences/seeds"
233
46
 
234
- conference.speakers.sample(3).each do |speaker|
235
- Decidim::ConferenceSpeakerConferenceMeeting.create!(
236
- conference_meeting: conference_meeting,
237
- conference_speaker: speaker
238
- )
239
- end
240
- end
241
- end
47
+ Decidim::Conferences::Seeds.new.call
242
48
  end
243
49
  end
@@ -30,13 +30,13 @@ module Decidim
30
30
  def conferences(filter: {}, order: {})
31
31
  manifest = Decidim.participatory_space_manifests.select { |m| m.name == :conferences }.first
32
32
 
33
- Decidim::Core::ParticipatorySpaceListBase.new(manifest: manifest).call(object, { filter: filter, order: order }, context)
33
+ Decidim::Core::ParticipatorySpaceListBase.new(manifest:).call(object, { filter:, order: }, context)
34
34
  end
35
35
 
36
36
  def conference(id: nil)
37
37
  manifest = Decidim.participatory_space_manifests.select { |m| m.name == :conferences }.first
38
38
 
39
- Decidim::Core::ParticipatorySpaceFinderBase.new(manifest: manifest).call(object, { id: id }, context)
39
+ Decidim::Core::ParticipatorySpaceFinderBase.new(manifest:).call(object, { id: }, context)
40
40
  end
41
41
  end
42
42
  end
@@ -0,0 +1,153 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "decidim/seeds"
4
+
5
+ module Decidim
6
+ module Conferences
7
+ class Seeds < Decidim::Seeds
8
+ def call
9
+ organization = Decidim::Organization.first
10
+
11
+ Decidim::ContentBlock.create(
12
+ organization:,
13
+ weight: 33,
14
+ scope_name: :homepage,
15
+ manifest_name: :highlighted_conferences,
16
+ published_at: Time.current
17
+ )
18
+
19
+ 2.times do |_n|
20
+ conference = Decidim::Conference.create!(
21
+ title: Decidim::Faker::Localized.sentence(word_count: 5),
22
+ slogan: Decidim::Faker::Localized.sentence(word_count: 2),
23
+ slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
24
+ hashtag: "##{::Faker::Lorem.word}",
25
+ short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
26
+ Decidim::Faker::Localized.sentence(word_count: 3)
27
+ end,
28
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
29
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
30
+ end,
31
+ organization:,
32
+ hero_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? hero_image : nil, # Keep after organization
33
+ banner_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? banner_image : nil, # Keep after organization
34
+ promoted: true,
35
+ published_at: 2.weeks.ago,
36
+ objectives: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
37
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
38
+ end,
39
+ start_date: Time.current,
40
+ end_date: 2.months.from_now.at_midnight,
41
+ registrations_enabled: [true, false].sample,
42
+ available_slots: (10..50).step(10).to_a.sample,
43
+ registration_terms: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
44
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
45
+ end
46
+ )
47
+ conference.add_to_index_as_search_resource
48
+
49
+ # Create users with specific roles
50
+ Decidim::ConferenceUserRole::ROLES.each do |role|
51
+ email = "conference_#{conference.id}_#{role}@example.org"
52
+
53
+ user = Decidim::User.find_or_initialize_by(email:)
54
+ user.update!(
55
+ name: ::Faker::Name.name,
56
+ nickname: ::Faker::Twitter.unique.screen_name,
57
+ password: "decidim123456789",
58
+ organization:,
59
+ confirmed_at: Time.current,
60
+ locale: I18n.default_locale,
61
+ tos_agreement: true
62
+ )
63
+
64
+ Decidim::ConferenceUserRole.find_or_create_by!(
65
+ user:,
66
+ conference:,
67
+ role:
68
+ )
69
+ end
70
+
71
+ attachment_collection = create_attachment_collection(collection_for: conference)
72
+ create_attachment(attached_to: conference, filename: "Exampledocument.pdf", attachment_collection:)
73
+ create_attachment(attached_to: conference, filename: "city.jpeg")
74
+ create_attachment(attached_to: conference, filename: "Exampledocument.pdf")
75
+
76
+ 2.times do
77
+ Decidim::Category.create!(
78
+ name: Decidim::Faker::Localized.sentence(word_count: 5),
79
+ description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
80
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
81
+ end,
82
+ participatory_space: conference
83
+ )
84
+ end
85
+
86
+ 5.times do
87
+ Decidim::ConferenceSpeaker.create!(
88
+ user: conference.organization.users.sample,
89
+ full_name: ::Faker::Name.name,
90
+ position: Decidim::Faker::Localized.word,
91
+ affiliation: Decidim::Faker::Localized.sentence(word_count: 3),
92
+ short_bio: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
93
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
94
+ end,
95
+ twitter_handle: ::Faker::Twitter.unique.screen_name,
96
+ personal_url: ::Faker::Internet.url,
97
+ conference:
98
+ )
99
+ end
100
+
101
+ Decidim::Conferences::Partner::TYPES.map do |type|
102
+ 4.times do
103
+ Decidim::Conferences::Partner.create!(
104
+ name: ::Faker::Name.name,
105
+ weight: ::Faker::Number.between(from: 1, to: 10),
106
+ link: ::Faker::Internet.url,
107
+ partner_type: type,
108
+ conference:,
109
+ logo: create_blob!(seeds_file: "logo.png", filename: "logo.png", content_type: "image/png")
110
+ )
111
+ end
112
+ end
113
+
114
+ 5.times do
115
+ Decidim::Conferences::MediaLink.create!(
116
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
117
+ link: ::Faker::Internet.url,
118
+ date: Date.current,
119
+ weight: ::Faker::Number.between(from: 1, to: 10),
120
+ conference:
121
+ )
122
+ end
123
+
124
+ 5.times do
125
+ Decidim::Conferences::RegistrationType.create!(
126
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
127
+ description: Decidim::Faker::Localized.sentence(word_count: 5),
128
+ weight: ::Faker::Number.between(from: 1, to: 10),
129
+ price: ::Faker::Number.between(from: 1, to: 300),
130
+ published_at: 2.weeks.ago,
131
+ conference:
132
+ )
133
+ end
134
+
135
+ Decidim.component_manifests.each do |manifest|
136
+ manifest.seed!(conference.reload)
137
+ end
138
+
139
+ Decidim::ConferenceMeeting.where(component: conference.components).each do |conference_meeting|
140
+ next unless ::Faker::Boolean.boolean(true_ratio: 0.5)
141
+
142
+ conference.speakers.sample(3).each do |speaker|
143
+ Decidim::ConferenceSpeakerConferenceMeeting.create!(
144
+ conference_meeting:,
145
+ conference_speaker: speaker
146
+ )
147
+ end
148
+ end
149
+ end
150
+ end
151
+ end
152
+ end
153
+ end