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
@@ -5,104 +5,22 @@ module Decidim
5
5
  module Admin
6
6
  # Controller that allows managing conference user roles.
7
7
  #
8
- class ConferenceUserRolesController < Decidim::Conferences::Admin::ApplicationController
8
+ class ConferenceUserRolesController < Decidim::Admin::ParticipatorySpace::UserRoleController
9
9
  include Concerns::ConferenceAdmin
10
- include Decidim::Admin::Officializations::Filterable
11
10
 
12
- def index
13
- enforce_permission_to :index, :conference_user_role
14
- @conference_user_roles = filtered_collection
15
- end
11
+ def authorization_scope = :conference_user_role
16
12
 
17
- def new
18
- enforce_permission_to :create, :conference_user_role
19
- @form = form(ConferenceUserRoleForm).instance
20
- end
13
+ def resource_form = form(ConferenceUserRoleForm)
21
14
 
22
- def create
23
- enforce_permission_to :create, :conference_user_role
24
- @form = form(ConferenceUserRoleForm).from_params(params)
15
+ def space_index_path = conference_user_roles_path(current_participatory_space)
25
16
 
26
- CreateConferenceAdmin.call(@form, current_user, current_conference) do
27
- on(:ok) do
28
- flash[:notice] = I18n.t("conference_user_roles.create.success", scope: "decidim.admin")
29
- end
17
+ def i18n_scope = "decidim.admin.conference_user_roles"
30
18
 
31
- on(:invalid) do
32
- flash[:alert] = I18n.t("conference_user_roles.create.error", scope: "decidim.admin")
33
- end
34
- redirect_to conference_user_roles_path(current_conference)
35
- end
36
- end
19
+ def role_class = Decidim::ConferenceUserRole
37
20
 
38
- def edit
39
- @user_role = collection.find(params[:id])
40
- enforce_permission_to :update, :conference_user_role, user_role: @user_role
41
- @form = form(ConferenceUserRoleForm).from_model(@user_role.user)
42
- end
21
+ def event = "decidim.events.conferences.role_assigned"
43
22
 
44
- def update
45
- @user_role = collection.find(params[:id])
46
- enforce_permission_to :update, :conference_user_role, user_role: @user_role
47
- @form = form(ConferenceUserRoleForm).from_params(params)
48
-
49
- UpdateConferenceAdmin.call(@form, @user_role) do
50
- on(:ok) do
51
- flash[:notice] = I18n.t("conference_user_roles.update.success", scope: "decidim.admin")
52
- redirect_to conference_user_roles_path(current_conference)
53
- end
54
-
55
- on(:invalid) do
56
- flash.now[:alert] = I18n.t("conference_user_roles.update.error", scope: "decidim.admin")
57
- render :edit
58
- end
59
- end
60
- end
61
-
62
- def destroy
63
- @conference_user_role = collection.find(params[:id])
64
- enforce_permission_to :destroy, :conference_user_role, user_role: @conference_user_role
65
-
66
- DestroyConferenceAdmin.call(@conference_user_role, current_user) do
67
- on(:ok) do
68
- flash[:notice] = I18n.t("conference_user_roles.destroy.success", scope: "decidim.admin")
69
- redirect_to conference_user_roles_path(current_conference)
70
- end
71
- end
72
- end
73
-
74
- def resend_invitation
75
- @user_role = collection.find(params[:id])
76
- enforce_permission_to :invite, :conference_user_role, user_role: @user_role
77
-
78
- InviteUserAgain.call(@user_role.user, "invite_admin") do
79
- on(:ok) do
80
- flash[:notice] = I18n.t("users.resend_invitation.success", scope: "decidim.admin")
81
- end
82
-
83
- on(:invalid) do
84
- flash[:alert] = I18n.t("users.resend_invitation.error", scope: "decidim.admin")
85
- end
86
- end
87
-
88
- redirect_to conference_user_roles_path(current_conference)
89
- end
90
-
91
- private
92
-
93
- def search_field_predicate
94
- :name_or_nickname_or_email_cont
95
- end
96
-
97
- def filters
98
- [:invitation_accepted_at_present, :last_sign_in_at_present]
99
- end
100
-
101
- def collection
102
- @collection ||= Decidim::ConferenceUserRole
103
- .joins(:user)
104
- .where(conference: current_conference)
105
- end
23
+ def event_class = Decidim::Conferences::ConferenceRoleAssignedEvent
106
24
  end
107
25
  end
108
26
  end
@@ -6,6 +6,8 @@ module Decidim
6
6
  # Controller that allows managing conferences.
7
7
  #
8
8
  class ConferencesController < Decidim::Conferences::Admin::ApplicationController
9
+ include Decidim::Admin::ParticipatorySpaceAdminBreadcrumb
10
+
9
11
  helper_method :current_conference, :current_participatory_space
10
12
  layout "decidim/admin/conferences"
11
13
  include Decidim::Conferences::Admin::Filterable
@@ -16,7 +16,7 @@ module Decidim
16
16
  def update
17
17
  enforce_permission_to :update, :conference, conference: current_conference
18
18
 
19
- @form = form(DiplomaForm).from_params(diploma_params).with_context(conference: current_conference, current_organization: current_organization)
19
+ @form = form(DiplomaForm).from_params(diploma_params).with_context(conference: current_conference, current_organization:)
20
20
 
21
21
  UpdateDiploma.call(@form, current_conference) do
22
22
  on(:ok) do
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This controller allows exporting things.
7
7
  # It is targeted for customizations for exporting things that lives under
8
- # an conference.
8
+ # a conference.
9
9
  class ExportsController < Decidim::Admin::ExportsController
10
10
  include Concerns::ConferenceAdmin
11
11
  end
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # This controller allows importing things.
7
7
  # It is targeted for customizations for importing things that lives under
8
- # an conference.
8
+ # a conference.
9
9
  class ImportsController < Decidim::Admin::ImportsController
10
10
  include Concerns::ConferenceAdmin
11
11
  end
@@ -4,7 +4,7 @@ module Decidim
4
4
  module Conferences
5
5
  module Admin
6
6
  module Moderations
7
- # This controller allows admins to manage moderation reports in an conference.
7
+ # This controller allows admins to manage moderation reports in a conference.
8
8
  class ReportsController < Decidim::Admin::Moderations::ReportsController
9
9
  include Concerns::ConferenceAdmin
10
10
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Conferences
5
5
  module Admin
6
- # This controller allows admins to manage moderations in an conference.
6
+ # This controller allows admins to manage moderations in a conference.
7
7
  class ModerationsController < Decidim::Admin::ModerationsController
8
8
  include Concerns::ConferenceAdmin
9
9
  end
@@ -10,6 +10,8 @@ module Decidim
10
10
 
11
11
  include NeedsPermission
12
12
 
13
+ layout "layouts/decidim/conferences/application"
14
+
13
15
  register_permissions(::Decidim::Conferences::ApplicationController,
14
16
  Decidim::Conferences::Permissions,
15
17
  Decidim::Admin::Permissions,
@@ -17,6 +19,10 @@ module Decidim
17
19
 
18
20
  private
19
21
 
22
+ def fallback_layout
23
+ "layouts/decidim/conferences/application"
24
+ end
25
+
20
26
  def permissions_context
21
27
  super.merge(
22
28
  current_participatory_space: try(:current_participatory_space)
@@ -7,7 +7,7 @@ module Decidim
7
7
  before_action :ensure_signed_in
8
8
 
9
9
  def create
10
- enforce_permission_to :join, :conference, conference: conference
10
+ enforce_permission_to(:join, :conference, conference:)
11
11
 
12
12
  JoinConference.call(conference, registration_type, current_user) do
13
13
  on(:ok) do
@@ -23,7 +23,7 @@ module Decidim
23
23
  end
24
24
 
25
25
  def destroy
26
- enforce_permission_to :leave, :conference, conference: conference
26
+ enforce_permission_to(:leave, :conference, conference:)
27
27
 
28
28
  LeaveConference.call(conference, registration_type, current_user) do
29
29
  on(:ok) do
@@ -39,7 +39,7 @@ module Decidim
39
39
  end
40
40
 
41
41
  def decline_invitation
42
- enforce_permission_to :decline_invitation, :conference, conference: conference
42
+ enforce_permission_to(:decline_invitation, :conference, conference:)
43
43
 
44
44
  DeclineInvitation.call(conference, current_user) do
45
45
  on(:ok) do
@@ -1,16 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # i18n-tasks-use t('decidim.conferences.conferences.show.already_have_an_account?')
4
+ # i18n-tasks-use t('decidim.conferences.conferences.show.are_you_new?')
5
+ # i18n-tasks-use t('decidim.conferences.conferences.show.sign_in_description')
6
+ # i18n-tasks-use t('decidim.conferences.conferences.show.sign_up_description')
3
7
  module Decidim
4
8
  module Conferences
5
9
  # A controller that holds the logic to show Conferences in a
6
10
  # public layout.
7
11
  class ConferencesController < Decidim::Conferences::ApplicationController
8
12
  include ParticipatorySpaceContext
13
+ include Paginable
14
+
9
15
  participatory_space_layout only: :show
10
16
 
11
17
  helper Decidim::AttachmentsHelper
12
18
  helper Decidim::IconHelper
13
- helper Decidim::WidgetUrlsHelper
14
19
  helper Decidim::SanitizeHelper
15
20
  helper Decidim::ResourceReferenceHelper
16
21
  helper Decidim::Conferences::PartnersHelper
@@ -49,7 +54,9 @@ module Decidim
49
54
  @conferences ||= OrganizationPrioritizedConferences.new(current_organization, current_user)
50
55
  end
51
56
 
52
- alias collection conferences
57
+ def collection
58
+ @collection ||= paginate(conferences.query)
59
+ end
53
60
 
54
61
  def promoted_conferences
55
62
  @promoted_conferences ||= conferences | PromotedConferences.new
@@ -1,10 +1,9 @@
1
- # frozen-string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
4
  module Conferences
5
5
  class ConferenceRegistrationNotificationEvent < Decidim::Events::BaseEvent
6
6
  include Decidim::Events::NotificationEvent
7
- include Decidim::SanitizeHelper
8
7
 
9
8
  def notification_title
10
9
  I18n.t("notification_title", **i18n_options).html_safe
@@ -12,20 +11,11 @@ module Decidim
12
11
 
13
12
  def i18n_options
14
13
  {
15
- resource_title: resource_title,
16
- resource_path: resource_path,
17
- resource_url: resource_url,
14
+ resource_title:,
15
+ resource_url:,
18
16
  scope: event_name
19
17
  }
20
18
  end
21
-
22
- def resource_title
23
- return unless resource
24
-
25
- title = decidim_sanitize_translated(resource.title)
26
-
27
- Decidim::ContentProcessor.render_without_format(title, links: false).html_safe
28
- end
29
19
  end
30
20
  end
31
21
  end
@@ -1,4 +1,4 @@
1
- # frozen-string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
4
  module Conferences
@@ -1,4 +1,4 @@
1
- # frozen-string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
4
  module Conferences
@@ -1,4 +1,4 @@
1
- # frozen-string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
4
  module Conferences
@@ -16,12 +16,12 @@ module Decidim
16
16
 
17
17
  def i18n_options
18
18
  {
19
- resource_path: resource_path,
20
- resource_title: resource_title,
21
- resource_url: resource_url,
19
+ resource_path:,
20
+ resource_title:,
21
+ resource_url:,
22
22
  scope: event_name,
23
- participatory_space_title: participatory_space_title,
24
- participatory_space_url: participatory_space_url,
23
+ participatory_space_title:,
24
+ participatory_space_url:,
25
25
  role: i18n_role
26
26
  }
27
27
  end
@@ -24,7 +24,7 @@ module Decidim
24
24
  private
25
25
 
26
26
  def slug_uniqueness
27
- return unless OrganizationConferences.new(current_organization).query.where(slug: slug).where.not(id: id).any?
27
+ return unless OrganizationConferences.new(current_organization).query.where(slug:).where.not(id:).any?
28
28
 
29
29
  errors.add(:slug, :taken)
30
30
  end
@@ -20,6 +20,7 @@ module Decidim
20
20
  mimic :conference
21
21
 
22
22
  attribute :slug, String
23
+ attribute :weight, Integer, default: 0
23
24
  attribute :hashtag, String
24
25
  attribute :promoted, Boolean
25
26
  attribute :scopes_enabled, Boolean
@@ -36,8 +37,8 @@ module Decidim
36
37
  attribute :location, String
37
38
  attribute :participatory_processes_ids, Array[Integer]
38
39
  attribute :assemblies_ids, Array[Integer]
39
- attribute :consultations_ids, Array[Integer]
40
40
 
41
+ validates :weight, presence: true, numericality: { greater_than_or_equal_to: 0 }
41
42
  validates :slug, presence: true, format: { with: Decidim::Conference.slug_format }
42
43
  validates :title, :slogan, :description, :short_description, translatable_presence: true
43
44
 
@@ -88,29 +89,17 @@ module Decidim
88
89
  end
89
90
  end
90
91
 
91
- def consultations_for_select
92
- return unless Decidim.participatory_space_manifests.map(&:name).include?(:consultations)
93
-
94
- @consultations_for_select ||= Decidim.find_participatory_space_manifest(:consultations)
95
- .participatory_spaces.call(current_organization)&.order(title: :asc)&.map do |consultation|
96
- [
97
- translated_attribute(consultation.title),
98
- consultation.id
99
- ]
100
- end
101
- end
102
-
103
92
  private
104
93
 
105
94
  def available_slots_greater_than_or_equal_to_registrations_count
106
- conference = OrganizationConferences.new(current_organization).query.find_by(slug: slug)
95
+ conference = OrganizationConferences.new(current_organization).query.find_by(slug:)
107
96
  return true if conference.blank?
108
97
 
109
98
  errors.add(:available_slots, :invalid) if available_slots < conference.conference_registrations.count
110
99
  end
111
100
 
112
101
  def slug_uniqueness
113
- return unless OrganizationConferences.new(current_organization).query.where(slug: slug).where.not(id: context[:conference_id]).any?
102
+ return unless OrganizationConferences.new(current_organization).query.where(slug:).where.not(id: context[:conference_id]).any?
114
103
 
115
104
  errors.add(:slug, :taken)
116
105
  end
@@ -5,25 +5,10 @@ module Decidim
5
5
  module Admin
6
6
  # A form object used to create conference user roles from the admin dashboard.
7
7
  #
8
- class ConferenceUserRoleForm < Form
8
+ class ConferenceUserRoleForm < Decidim::Admin::ParticipatorySpaceAdminUserForm
9
9
  mimic :conference_user_role
10
10
 
11
- attribute :name, String
12
- attribute :email, String
13
- attribute :role, String
14
-
15
- validates :email, :role, presence: true
16
- validates :name, presence: true
17
- validates :role, inclusion: { in: Decidim::ConferenceUserRole::ROLES }
18
-
19
- def roles
20
- Decidim::ConferenceUserRole::ROLES.map do |role|
21
- [
22
- I18n.t(role, scope: "decidim.admin.models.conference_user_role.roles"),
23
- role
24
- ]
25
- end
26
- end
11
+ def scope = "decidim.admin.models.conference_user_role.roles"
27
12
  end
28
13
  end
29
14
  end
@@ -18,10 +18,6 @@ module Decidim
18
18
  def assemblies_selected
19
19
  @assemblies_selected ||= current_conference.linked_participatory_space_resources(:assemblies, "included_assemblies").pluck(:id) if current_conference.present?
20
20
  end
21
-
22
- def consultations_selected
23
- @consultations_selected ||= current_conference.linked_participatory_space_resources("Consultations", "included_consultations").pluck(:id) if current_conference.present?
24
- end
25
21
  end
26
22
  end
27
23
  end
@@ -4,6 +4,8 @@ module Decidim
4
4
  # A Helper to render conferences.
5
5
  module Conferences
6
6
  module ConferenceHelper
7
+ include PaginateHelper
8
+
7
9
  # Renders the dates of a conference
8
10
  #
9
11
  def render_date(conference)
@@ -11,6 +13,59 @@ module Decidim
11
13
 
12
14
  "#{l(conference.start_date, format: :decidim_with_month_name_short)} - #{l(conference.end_date, format: :decidim_with_month_name_short)}"
13
15
  end
16
+
17
+ # Items to display in the navigation of a conference
18
+ #
19
+ def conference_nav_items(participatory_space)
20
+ [].tap do |items|
21
+ if participatory_space.speakers.exists?
22
+ items << {
23
+ name: t("layouts.decidim.conferences_nav.conference_speaker_menu_item"),
24
+ url: decidim_conferences.conference_conference_speakers_path(participatory_space)
25
+ }
26
+ end
27
+
28
+ meeting_components = participatory_space.components.published.where(manifest_name: "meetings")
29
+ other_components = participatory_space.components.published.where.not(manifest_name: "meetings")
30
+
31
+ meeting_components.each do |component|
32
+ next unless Decidim::Meetings::Meeting.where(component:).published.not_hidden.visible_for(current_user).exists?
33
+
34
+ items << {
35
+ name: translated_attribute(component.name),
36
+ url: decidim_conferences.conference_conference_program_path(participatory_space, id: component.id)
37
+ }
38
+ end
39
+
40
+ if participatory_space.partners.exists?
41
+ items << {
42
+ name: t("layouts.decidim.conferences_nav.conference_partners_menu_item"),
43
+ url: decidim_conferences.conference_path(participatory_space, anchor: "conference-partners-main_promotor")
44
+ }
45
+ end
46
+
47
+ if meeting_components.exists?
48
+ items << {
49
+ name: t("layouts.decidim.conferences_nav.venues"),
50
+ url: decidim_conferences.conference_path(participatory_space, anchor: "venues")
51
+ }
52
+ end
53
+
54
+ other_components.each do |component|
55
+ items << {
56
+ name: translated_attribute(component.name),
57
+ url: main_component_path(component)
58
+ }
59
+ end
60
+
61
+ if participatory_space.attachments.any? || participatory_space.media_links.any?
62
+ items << {
63
+ name: t("layouts.decidim.conferences_nav.media"),
64
+ url: decidim_conferences.conference_media_path(participatory_space)
65
+ }
66
+ end
67
+ end
68
+ end
14
69
  end
15
70
  end
16
71
  end
@@ -12,7 +12,7 @@ module Decidim
12
12
  meetings_by_time = {}
13
13
  meetings.each do |meeting|
14
14
  meetings_by_time[start_time: meeting.start_time, end_time: meeting.end_time] ||= []
15
- meetings_by_time[start_time: meeting.start_time, end_time: meeting.end_time] << { meeting: meeting }
15
+ meetings_by_time[start_time: meeting.start_time, end_time: meeting.end_time] << { meeting: }
16
16
  end
17
17
  meetings_by_time
18
18
  end
@@ -4,16 +4,6 @@ module Decidim
4
4
  # A Helper to render and link to resources.
5
5
  module Conferences
6
6
  module MediaAttachmentsHelper
7
- # Renders the attachments of a Conference that includes the
8
- # HasAttachments concern.
9
- #
10
- # attached_to - The model to render the attachments from.
11
- #
12
- # Returns nothing.
13
- def attachments_for_conference(attached_to)
14
- render partial: "attachments", locals: { attached_to: attached_to }
15
- end
16
-
17
7
  # Renders the attachment's title.
18
8
  # Checks if the attachment's title is translated or not and use
19
9
  # the correct render method.
@@ -7,8 +7,10 @@ module Decidim
7
7
  # conference - The model to render the partners
8
8
  #
9
9
  # Returns nothing.
10
+
11
+ # deprecated
10
12
  def partners_for(conference)
11
- render partial: "partners", locals: { conference: conference }
13
+ render partial: "partners", locals: { conference: }
12
14
  end
13
15
  end
14
16
  end
@@ -29,7 +29,7 @@ module Decidim
29
29
  @registration_type = registration_type
30
30
 
31
31
  subject = I18n.t("invite.subject", scope: "decidim.conferences.mailer.invite_join_conference_mailer")
32
- mail(to: user.email, subject: subject)
32
+ mail(to: user.email, subject:)
33
33
  end
34
34
  end
35
35
 
@@ -26,7 +26,7 @@ module Decidim
26
26
  add_diploma_attachment
27
27
 
28
28
  subject = I18n.t("diploma.subject", scope: "decidim.conferences.mailer.send_conference_diploma_mailer")
29
- mail(to: user.email, subject: subject)
29
+ mail(to: user.email, subject:)
30
30
  end
31
31
  end
32
32
 
@@ -21,7 +21,7 @@ module Decidim
21
21
  @registration_type = registration_type
22
22
 
23
23
  subject = I18n.t("pending_validation.subject", scope: "decidim.conferences.mailer.conference_registration_mailer")
24
- mail(to: user.email, subject: subject)
24
+ mail(to: user.email, subject:)
25
25
  end
26
26
  end
27
27
 
@@ -36,7 +36,7 @@ module Decidim
36
36
  add_calendar_attachment
37
37
 
38
38
  subject = I18n.t("confirmation.subject", scope: "decidim.conferences.mailer.conference_registration_mailer")
39
- mail(to: user.email, subject: subject)
39
+ mail(to: user.email, subject:)
40
40
  end
41
41
  end
42
42
 
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
- # Interaction between a user and an organization can be done via an Conference.
5
- # It's a unit of action from the Organization point of view that groups
4
+ # Interaction between a user and an organization can be done via a Conference.
5
+ # It is a unit of action from the Organization point of view that groups
6
6
  # several components (proposals, debates...) that can be enabled or disabled.
7
7
  #
8
8
  class Conference < ApplicationRecord
@@ -100,11 +100,11 @@ module Decidim
100
100
  end
101
101
 
102
102
  def has_registration_for?(user)
103
- conference_registrations.where(user: user).any?
103
+ conference_registrations.where(user:).any?
104
104
  end
105
105
 
106
106
  def has_registration_for_user_and_registration_type?(user, registration_type)
107
- conference_registrations.where(user: user, registration_type: registration_type).any?
107
+ conference_registrations.where(user:, registration_type:).any?
108
108
  end
109
109
 
110
110
  def has_available_slots?
@@ -1,51 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
- # Defines a relation between a user and an conference, and what kind of relation
4
+ # Defines a relation between a user and a Conference, and what kind of relation
5
5
  # does the user have.
6
6
  class ConferenceUserRole < ApplicationRecord
7
7
  include Traceable
8
8
  include Loggable
9
+ include ParticipatorySpaceUser
9
10
 
10
- belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User", optional: true
11
11
  belongs_to :conference, foreign_key: "decidim_conference_id", class_name: "Decidim::Conference", optional: true
12
12
  alias participatory_space conference
13
13
 
14
- ROLES = %w(admin collaborator moderator valuator).freeze
15
- validates :role, inclusion: { in: ROLES }, uniqueness: { scope: [:user, :conference] }
16
- validate :user_and_conference_same_organization
14
+ scope :for_space, ->(participatory_space) { where(conference: participatory_space) }
15
+
16
+ validates :role, inclusion: { in: ParticipatorySpaceUser::ROLES }, uniqueness: { scope: [:user, :conference] }
17
+ def target_space_association = :conference
17
18
 
18
19
  def self.log_presenter_class_for(_log)
19
20
  Decidim::Conferences::AdminLog::ConferenceUserRolePresenter
20
21
  end
21
-
22
- ransacker :name do
23
- Arel.sql(%{("decidim_users"."name")::text})
24
- end
25
-
26
- ransacker :nickname do
27
- Arel.sql(%{("decidim_users"."nickname")::text})
28
- end
29
-
30
- ransacker :email do
31
- Arel.sql(%{("decidim_users"."email")::text})
32
- end
33
-
34
- ransacker :invitation_accepted_at do
35
- Arel.sql(%{("decidim_users"."invitation_accepted_at")::text})
36
- end
37
-
38
- ransacker :last_sign_in_at do
39
- Arel.sql(%{("decidim_users"."last_sign_in_at")::text})
40
- end
41
-
42
- private
43
-
44
- # Private: check if the process and the user have the same organization
45
- def user_and_conference_same_organization
46
- return if !conference || !user
47
-
48
- errors.add(:conference, :invalid) unless user.organization == conference.organization
49
- end
50
22
  end
51
23
  end