decidim-conferences 0.27.5 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) 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 +3 -13
  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 -3
  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 -2
  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 -62
  153. data/config/locales/bg.yml +0 -1
  154. data/config/locales/ca.yml +33 -53
  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 +31 -51
  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 -51
  170. data/config/locales/id-ID.yml +3 -57
  171. data/config/locales/it.yml +4 -62
  172. data/config/locales/ja.yml +34 -53
  173. data/config/locales/lb.yml +1 -55
  174. data/config/locales/lt.yml +14 -52
  175. data/config/locales/lv.yml +1 -60
  176. data/config/locales/nl.yml +3 -62
  177. data/config/locales/no.yml +1 -62
  178. data/config/locales/pl.yml +1 -78
  179. data/config/locales/pt-BR.yml +1 -63
  180. data/config/locales/pt.yml +2 -63
  181. data/config/locales/ro-RO.yml +13 -50
  182. data/config/locales/sk.yml +1 -60
  183. data/config/locales/sl.yml +0 -2
  184. data/config/locales/sr-CS.yml +0 -5
  185. data/config/locales/sv.yml +7 -62
  186. data/config/locales/tr-TR.yml +13 -61
  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 +10 -9
  198. data/lib/decidim/conferences/version.rb +1 -1
  199. metadata +44 -47
  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 -42
  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 -23
  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/environment.rb +0 -3
  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
@@ -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
@@ -12,6 +12,7 @@ FactoryBot.define do
12
12
  factory :conference, class: "Decidim::Conference" do
13
13
  title { generate_localized_title }
14
14
  slug { generate(:conference_slug) }
15
+ weight { 1 }
15
16
  slogan { generate_localized_title }
16
17
  short_description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
17
18
  description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
@@ -62,7 +63,7 @@ FactoryBot.define do
62
63
 
63
64
  after(:create) do |user, evaluator|
64
65
  create :conference_user_role,
65
- user: user,
66
+ user:,
66
67
  conference: evaluator.conference,
67
68
  role: :admin
68
69
  end
@@ -78,7 +79,7 @@ FactoryBot.define do
78
79
 
79
80
  after(:create) do |user, evaluator|
80
81
  create :conference_user_role,
81
- user: user,
82
+ user:,
82
83
  conference: evaluator.conference,
83
84
  role: :moderator
84
85
  end
@@ -94,7 +95,7 @@ FactoryBot.define do
94
95
 
95
96
  after(:create) do |user, evaluator|
96
97
  create :conference_user_role,
97
- user: user,
98
+ user:,
98
99
  conference: evaluator.conference,
99
100
  role: :collaborator
100
101
  end
@@ -110,7 +111,7 @@ FactoryBot.define do
110
111
 
111
112
  after(:create) do |user, evaluator|
112
113
  create :conference_user_role,
113
- user: user,
114
+ user:,
114
115
  conference: evaluator.conference,
115
116
  role: :valuator
116
117
  end
@@ -142,7 +143,7 @@ FactoryBot.define do
142
143
  after :build do |conference_speaker, evaluator|
143
144
  conference_speaker.conference_speaker_conference_meetings << build(:conference_speaker_conference_meeting,
144
145
  meetings_component: evaluator.meetings_component,
145
- conference_speaker: conference_speaker)
146
+ conference_speaker:)
146
147
  end
147
148
  end
148
149
  end
@@ -153,8 +154,8 @@ FactoryBot.define do
153
154
  meetings_component { create(:meetings_component, participatory_space: conference.participatory_space) }
154
155
  end
155
156
 
156
- conference_meeting { create(:conference_meeting, :published, conference: conference, component: meetings_component) }
157
- conference_speaker { create(:conference_speaker, conference: conference) }
157
+ conference_meeting { create(:conference_meeting, :published, conference:, component: meetings_component) }
158
+ conference_speaker { create(:conference_speaker, conference:) }
158
159
  end
159
160
 
160
161
  factory :conference_meeting_registration_type, class: "Decidim::Conferences::ConferenceMeetingRegistrationType" do
@@ -163,7 +164,7 @@ FactoryBot.define do
163
164
  end
164
165
 
165
166
  conference_meeting
166
- registration_type { build(:registration_type, conference: conference) }
167
+ registration_type { build(:registration_type, conference:) }
167
168
  end
168
169
 
169
170
  factory :conference_meeting, parent: :meeting, class: "Decidim::ConferenceMeeting" do
@@ -173,7 +174,7 @@ FactoryBot.define do
173
174
 
174
175
  after :build do |conference_meeting, evaluator|
175
176
  conference_meeting.conference_meeting_registration_types << build(:conference_meeting_registration_type,
176
- conference_meeting: conference_meeting,
177
+ conference_meeting:,
177
178
  conference: evaluator.conference)
178
179
  end
179
180
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-conferences version.
5
5
  module Conferences
6
6
  def self.version
7
- "0.27.5"
7
+ "0.28.0.rc4"
8
8
  end
9
9
  end
10
10
  end