decidim-meetings 0.24.3 → 0.25.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/meetings/join_meeting_button/registration_confirm.erb +6 -0
  3. data/app/cells/decidim/meetings/join_meeting_button/show.erb +8 -6
  4. data/app/cells/decidim/meetings/meeting_m_cell.rb +4 -0
  5. data/app/cells/decidim/meetings/meeting_url/show.erb +7 -2
  6. data/app/cells/decidim/meetings/meeting_url_cell.rb +14 -2
  7. data/app/cells/decidim/meetings/meetings_map/show.erb +1 -1
  8. data/app/cells/decidim/meetings/online_meeting_cell.rb +36 -0
  9. data/app/cells/decidim/meetings/online_meeting_link/show.erb +44 -0
  10. data/app/cells/decidim/meetings/online_meeting_link_cell.rb +27 -0
  11. data/app/cells/decidim/meetings/public_participants_list/show.erb +16 -0
  12. data/app/cells/decidim/meetings/public_participants_list_cell.rb +31 -0
  13. data/app/cells/decidim/meetings/question_responses/show.erb +7 -0
  14. data/app/cells/decidim/meetings/question_responses_cell.rb +72 -0
  15. data/app/commands/decidim/meetings/admin/close_meeting.rb +3 -0
  16. data/app/commands/decidim/meetings/admin/copy_meeting.rb +0 -9
  17. data/app/commands/decidim/meetings/admin/create_meeting.rb +4 -20
  18. data/app/commands/decidim/meetings/admin/destroy_meeting.rb +2 -0
  19. data/app/commands/decidim/meetings/admin/publish_meeting.rb +72 -0
  20. data/app/commands/decidim/meetings/admin/unpublish_meeting.rb +45 -0
  21. data/app/commands/decidim/meetings/admin/update_meeting.rb +6 -3
  22. data/app/commands/decidim/meetings/admin/update_question_status.rb +57 -0
  23. data/app/commands/decidim/meetings/admin/update_questionnaire.rb +93 -0
  24. data/app/commands/decidim/meetings/close_meeting.rb +2 -0
  25. data/app/commands/decidim/meetings/create_answer.rb +52 -0
  26. data/app/commands/decidim/meetings/create_meeting.rb +3 -1
  27. data/app/commands/decidim/meetings/join_meeting.rb +2 -1
  28. data/app/commands/decidim/meetings/update_meeting.rb +2 -1
  29. data/app/controllers/concerns/decidim/meetings/admin/filterable.rb +55 -0
  30. data/app/controllers/concerns/decidim/meetings/polls_resources.rb +29 -0
  31. data/app/controllers/decidim/meetings/admin/application_controller.rb +6 -2
  32. data/app/controllers/decidim/meetings/admin/invites_controller.rb +0 -2
  33. data/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb +1 -1
  34. data/app/controllers/decidim/meetings/admin/meetings_controller.rb +46 -1
  35. data/app/controllers/decidim/meetings/admin/meetings_poll_controller.rb +107 -0
  36. data/app/controllers/decidim/meetings/calendars_controller.rb +8 -0
  37. data/app/controllers/decidim/meetings/live_events_controller.rb +29 -0
  38. data/app/controllers/decidim/meetings/meeting_closes_controller.rb +1 -1
  39. data/app/controllers/decidim/meetings/polls/answers_controller.rb +37 -0
  40. data/app/controllers/decidim/meetings/polls/questions_controller.rb +45 -0
  41. data/app/events/decidim/meetings/create_meeting_event.rb +16 -0
  42. data/app/forms/decidim/meetings/admin/answer_option_form.rb +24 -0
  43. data/app/forms/decidim/meetings/admin/close_meeting_form.rb +3 -1
  44. data/app/forms/decidim/meetings/admin/meeting_form.rb +12 -1
  45. data/app/forms/decidim/meetings/admin/question_form.rb +44 -0
  46. data/app/forms/decidim/meetings/admin/questionnaire_form.rb +19 -0
  47. data/app/forms/decidim/meetings/answer_choice_form.rb +14 -0
  48. data/app/forms/decidim/meetings/answer_form.rb +65 -0
  49. data/app/forms/decidim/meetings/close_meeting_form.rb +4 -0
  50. data/app/forms/decidim/meetings/join_meeting_form.rb +1 -0
  51. data/app/forms/decidim/meetings/meeting_form.rb +9 -0
  52. data/app/helpers/decidim/meetings/admin/filterable_helper.rb +13 -0
  53. data/app/helpers/decidim/meetings/application_helper.rb +3 -2
  54. data/app/helpers/decidim/meetings/meetings_helper.rb +21 -0
  55. data/app/models/decidim/meetings/answer.rb +48 -0
  56. data/app/models/decidim/meetings/answer_choice.rb +15 -0
  57. data/app/models/decidim/meetings/answer_option.rb +24 -0
  58. data/app/models/decidim/meetings/meeting.rb +88 -42
  59. data/app/models/decidim/meetings/poll.rb +19 -0
  60. data/app/models/decidim/meetings/question.rb +54 -0
  61. data/app/models/decidim/meetings/questionnaire.rb +23 -0
  62. data/app/models/decidim/meetings/registration.rb +2 -0
  63. data/app/packs/entrypoints/decidim_meetings.js +6 -0
  64. data/app/packs/entrypoints/decidim_meetings_admin.js +5 -0
  65. data/app/{assets/images/decidim/gamification/badges/attended_meetings.svg → packs/images/decidim/gamification/badges/decidim_gamification_badges_attended_meetings.svg} +0 -0
  66. data/app/{assets/images/decidim/meetings/icon.svg → packs/images/decidim/meetings/decidim_meetings.svg} +0 -0
  67. data/app/packs/src/decidim/meetings/admin/agendas.js +159 -0
  68. data/app/{assets/javascripts/decidim/meetings/admin/destroy_meeting_alert.js.es6 → packs/src/decidim/meetings/admin/destroy_meeting_alert.js} +0 -0
  69. data/app/{assets/javascripts/decidim/meetings/admin/meetings_form.js.es6 → packs/src/decidim/meetings/admin/meetings_form.js} +7 -4
  70. data/app/{assets/javascripts/decidim/meetings/admin/registrations_form.js.es6 → packs/src/decidim/meetings/admin/registrations_form.js} +0 -0
  71. data/app/{assets/javascripts/decidim/meetings/admin/registrations_invite_form.es6 → packs/src/decidim/meetings/admin/registrations_invite_form.js} +3 -3
  72. data/app/packs/src/decidim/meetings/meetings_form.js +54 -0
  73. data/app/packs/src/decidim/meetings/meetings_polls.js +41 -0
  74. data/app/packs/src/decidim/meetings/poll.component.js +166 -0
  75. data/app/packs/stylesheets/decidim/meetings/_header.scss +52 -0
  76. data/app/packs/stylesheets/decidim/meetings/_main.scss +178 -0
  77. data/app/packs/stylesheets/decidim/meetings/_meetings.scss +2 -0
  78. data/app/permissions/decidim/meetings/admin/permissions.rb +16 -8
  79. data/app/permissions/decidim/meetings/permissions.rb +42 -17
  80. data/app/presenters/decidim/meetings/admin_log/meeting_presenter.rb +5 -1
  81. data/app/presenters/decidim/meetings/meeting_presenter.rb +25 -25
  82. data/app/queries/decidim/meetings/filtered_meetings.rb +1 -1
  83. data/app/queries/decidim/meetings/metrics/meetings_metric_manage.rb +1 -1
  84. data/app/queries/decidim/meetings/questionnaire_user_answers.rb +29 -0
  85. data/app/serializers/decidim/meetings/data_portability_invite_serializer.rb +2 -1
  86. data/app/serializers/decidim/meetings/data_portability_registration_serializer.rb +2 -1
  87. data/app/serializers/decidim/meetings/registration_serializer.rb +3 -12
  88. data/app/services/decidim/meetings/calendar/component_calendar.rb +2 -2
  89. data/app/services/decidim/meetings/calendar/meeting_calendar.rb +33 -0
  90. data/app/services/decidim/meetings/calendar_renderer.rb +2 -0
  91. data/app/services/decidim/meetings/meeting_iframe_embedder.rb +86 -0
  92. data/app/services/decidim/meetings/meeting_search.rb +2 -2
  93. data/app/views/decidim/meetings/admin/agenda/_form.html.erb +1 -1
  94. data/app/views/decidim/meetings/admin/invite_join_meeting_mailer/invite.html.erb +4 -4
  95. data/app/views/decidim/meetings/admin/invites/_form.html.erb +1 -1
  96. data/app/views/decidim/meetings/admin/meeting_closes/_form.html.erb +16 -1
  97. data/app/views/decidim/meetings/admin/meeting_copies/_form.html.erb +1 -1
  98. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +16 -1
  99. data/app/views/decidim/meetings/admin/meetings/index.html.erb +39 -11
  100. data/app/views/decidim/meetings/admin/poll/_answer_option.html.erb +34 -0
  101. data/app/views/decidim/meetings/admin/poll/_answer_option_template.html.erb +7 -0
  102. data/app/views/decidim/meetings/admin/poll/_form.html.erb +63 -0
  103. data/app/views/decidim/meetings/admin/poll/_question.html.erb +96 -0
  104. data/app/views/decidim/meetings/admin/poll/edit.html.erb +9 -0
  105. data/app/views/decidim/meetings/admin/registrations/_form.html.erb +1 -1
  106. data/app/views/decidim/meetings/directory/meetings/index.html.erb +4 -4
  107. data/app/views/decidim/meetings/directory/meetings/index.js.erb +2 -0
  108. data/app/views/decidim/meetings/layouts/live_event.html.erb +50 -0
  109. data/app/views/decidim/meetings/live_events/show.html.erb +12 -0
  110. data/app/views/decidim/meetings/meeting_closes/_form.html.erb +8 -1
  111. data/app/views/decidim/meetings/meeting_closes/edit.html.erb +1 -1
  112. data/app/views/decidim/meetings/meetings/_calendar_modal.html.erb +26 -0
  113. data/app/views/decidim/meetings/meetings/_filters.html.erb +1 -1
  114. data/app/views/decidim/meetings/meetings/_form.html.erb +6 -1
  115. data/app/views/decidim/meetings/meetings/_linked_meetings.html.erb +1 -1
  116. data/app/views/decidim/meetings/meetings/_meeting_minutes.html.erb +7 -18
  117. data/app/views/decidim/meetings/meetings/edit.html.erb +1 -1
  118. data/app/views/decidim/meetings/meetings/index.html.erb +4 -4
  119. data/app/views/decidim/meetings/meetings/new.html.erb +1 -1
  120. data/app/views/decidim/meetings/meetings/show.html.erb +13 -14
  121. data/app/views/decidim/meetings/polls/answers/_multiple_option.html.erb +13 -0
  122. data/app/views/decidim/meetings/polls/answers/_single_option.html.erb +19 -0
  123. data/app/views/decidim/meetings/polls/answers/create.js.erb +5 -0
  124. data/app/views/decidim/meetings/polls/questions/_closed_question.html.erb +7 -0
  125. data/app/views/decidim/meetings/polls/questions/_index.html.erb +5 -0
  126. data/app/views/decidim/meetings/polls/questions/_index_admin.html.erb +43 -0
  127. data/app/views/decidim/meetings/polls/questions/_published_question.html.erb +29 -0
  128. data/app/views/decidim/meetings/polls/questions/_question.html.erb +7 -0
  129. data/app/views/decidim/meetings/polls/questions/index.js.erb +5 -0
  130. data/app/views/decidim/meetings/polls/questions/index_admin.js.erb +5 -0
  131. data/app/views/decidim/meetings/registration_mailer/confirmation.html.erb +5 -2
  132. data/app/views/devise/mailer/join_meeting.html.erb +6 -6
  133. data/config/assets.rb +11 -0
  134. data/config/locales/ar.yml +3 -24
  135. data/config/locales/ca.yml +36 -27
  136. data/config/locales/cs.yml +72 -26
  137. data/config/locales/de.yml +22 -27
  138. data/config/locales/el.yml +3 -24
  139. data/config/locales/en.yml +112 -26
  140. data/config/locales/es-MX.yml +13 -27
  141. data/config/locales/es-PY.yml +13 -27
  142. data/config/locales/es.yml +13 -27
  143. data/config/locales/eu.yml +3 -24
  144. data/config/locales/fi-plain.yml +70 -26
  145. data/config/locales/fi.yml +70 -26
  146. data/config/locales/fr-CA.yml +19 -26
  147. data/config/locales/fr-LU.yml +534 -0
  148. data/config/locales/fr.yml +19 -26
  149. data/config/locales/gl.yml +46 -24
  150. data/config/locales/hu.yml +5 -24
  151. data/config/locales/id-ID.yml +3 -24
  152. data/config/locales/is-IS.yml +2 -22
  153. data/config/locales/it.yml +117 -23
  154. data/config/locales/ja.yml +148 -58
  155. data/config/locales/lb-LU.yml +1 -0
  156. data/config/locales/lv.yml +3 -24
  157. data/config/locales/nl.yml +70 -25
  158. data/config/locales/no.yml +5 -26
  159. data/config/locales/pl.yml +22 -33
  160. data/config/locales/pt-BR.yml +178 -23
  161. data/config/locales/pt.yml +3 -24
  162. data/config/locales/ro-RO.yml +38 -27
  163. data/config/locales/ru.yml +3 -24
  164. data/config/locales/sk.yml +3 -24
  165. data/config/locales/sv.yml +36 -27
  166. data/config/locales/tr-TR.yml +5 -27
  167. data/config/locales/uk.yml +3 -24
  168. data/config/locales/zh-CN.yml +3 -24
  169. data/db/migrate/20210217124802_add_registration_custom_content_to_meetings.rb +8 -0
  170. data/db/migrate/20210413050756_add_published_at_to_meetings.rb +7 -0
  171. data/db/migrate/20210413050917_update_published_at_to_existing_meetings.rb +20 -0
  172. data/db/migrate/20210430123416_add_public_participation_to_decidim_meetings_registrations.rb +7 -0
  173. data/db/migrate/20210506180226_merge_meetings_minutes_into_meetings_table.rb +48 -0
  174. data/db/migrate/20210512055802_create_decidim_meetings_polls.rb +10 -0
  175. data/db/migrate/20210512100333_drop_decidim_meetings_minutes_table.rb +77 -0
  176. data/db/migrate/20210518133236_merge_minutes_with_closing_report_in_meetings_table.rb +57 -0
  177. data/db/migrate/20210520084247_create_decidim_meetings_questionnaires.rb +11 -0
  178. data/db/migrate/20210520084253_create_decidim_meetings_questions.rb +15 -0
  179. data/db/migrate/20210520084321_create_decidim_meetings_answers.rb +13 -0
  180. data/db/migrate/20210520084330_create_decidim_meetings_answer_options.rb +10 -0
  181. data/db/migrate/20210520084337_create_decidim_meetings_answer_choices.rb +13 -0
  182. data/db/migrate/20210520134834_add_status_to_meetings_questions.rb +7 -0
  183. data/db/migrate/20210602040614_add_setting_embed_iframe_to_meetings.rb +7 -0
  184. data/lib/decidim/api/linked_resources_interface.rb +8 -1
  185. data/lib/decidim/api/meeting_type.rb +19 -4
  186. data/lib/decidim/api/meetings_type.rb +2 -2
  187. data/lib/decidim/meetings/admin_engine.rb +5 -1
  188. data/lib/decidim/meetings/api.rb +0 -1
  189. data/lib/decidim/meetings/component.rb +41 -6
  190. data/lib/decidim/meetings/data_portability_user_answers_serializer.rb +33 -0
  191. data/lib/decidim/meetings/engine.rb +10 -11
  192. data/lib/decidim/meetings/meeting_serializer.rb +1 -0
  193. data/lib/decidim/meetings/polls.rb +10 -0
  194. data/lib/decidim/meetings/test/factories.rb +85 -9
  195. data/lib/decidim/meetings/user_answers_serializer.rb +47 -0
  196. data/lib/decidim/meetings/version.rb +1 -1
  197. data/lib/decidim/meetings.rb +10 -0
  198. metadata +103 -113
  199. data/app/assets/config/decidim_meetings_manifest.js +0 -9
  200. data/app/assets/javascripts/decidim/meetings/admin/agendas.js.es6 +0 -158
  201. data/app/assets/javascripts/decidim/meetings/meetings_form.js.es6 +0 -54
  202. data/app/commands/decidim/meetings/admin/create_minutes.rb +0 -55
  203. data/app/commands/decidim/meetings/admin/update_minutes.rb +0 -63
  204. data/app/controllers/decidim/meetings/admin/minutes_controller.rb +0 -69
  205. data/app/forms/decidim/meetings/admin/minutes_form.rb +0 -20
  206. data/app/models/decidim/meetings/minutes.rb +0 -22
  207. data/app/presenters/decidim/meetings/admin_log/minutes_presenter.rb +0 -42
  208. data/app/views/decidim/meetings/admin/minutes/_form.html.erb +0 -23
  209. data/app/views/decidim/meetings/admin/minutes/edit.html.erb +0 -7
  210. data/app/views/decidim/meetings/admin/minutes/new.html.erb +0 -7
  211. data/app/views/decidim/meetings/meetings/_online_meeting_link.html.erb +0 -11
  212. data/config/locales/ja-JP.yml +0 -494
  213. data/lib/decidim/api/minutes_type.rb +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a92e6db66392bb715213783701f79426439c8d04ee7477bf0cbf53678a7ba37
4
- data.tar.gz: c11f7df32e7fdbe012b1b4f5a7c2887c8734a3fc94d5196b5fbb2045c0117cb7
3
+ metadata.gz: ab6b8251a715062c189020553bfb57757740cbd1ffa121296885058b0fb8d9f6
4
+ data.tar.gz: 68cb83595a3308d8746bba38e1044d0e0bbc2c86ad1d55b0ffb65537d510b501
5
5
  SHA512:
6
- metadata.gz: e2558bf62dd477e601613e9ff3aaad145ed78327b120202bac2f8137f4f4006673ce33989341134654d72371c6928a690784ed0aafceee618344ce33383030b0
7
- data.tar.gz: f44814296cf29aed73b671399258d78ad233eca14ed6fbce2635a04c5e2fb3b89f652ef70f0412f1cc5fe433168e8a01c1ae8b8cf25f9e2456fa0fab1dd770c7
6
+ metadata.gz: 8df219dc002060c59f897970bf4cfdba38189f1f8864385c733f700630fe6ba1d58165471fefed2657830c713180ce57b64b341d733828ac3c81e06f4b10d129
7
+ data.tar.gz: d26e7f6d6f2009970427a955d4b1b659b4aa13267cb8f8c6a67aeb46eaaf4e898e379333490a94386f6a1b89fced225aa93a5881f0f68b2cb3f1e4e6470b3427
@@ -6,6 +6,12 @@
6
6
  </div>
7
7
  </div>
8
8
 
9
+ <div class="row">
10
+ <div class="columns medium-10 medium-offset-1">
11
+ <%= cell("decidim/public_participation", form) %>
12
+ </div>
13
+ </div>
14
+
9
15
  <div class="row">
10
16
  <div class="columns medium-10 medium-offset-1 help-text">
11
17
  <%= registration_terms_text %>
@@ -1,16 +1,18 @@
1
1
  <% if model.can_be_joined_by?(current_user) %>
2
2
  <% if model.has_registration_for? current_user %>
3
+ <span>
4
+ <%= icon("check", class: "icon--small") %>
5
+ <%= t("going", scope: "decidim.meetings.meetings.show") %>
6
+ </span>
3
7
  <%= action_authorized_button_to(
4
8
  :join,
9
+ t("leave", scope: "decidim.meetings.meetings.show"),
5
10
  meeting_registration_path(model),
6
11
  resource: model,
7
12
  method: :delete,
8
- class: "#{button_classes} active",
9
- data: { disable: true }
10
- ) do %>
11
- <%= icon("check", class: "icon--small") %>
12
- <%= t("going", scope: "decidim.meetings.meetings.show") %>
13
- <% end %>
13
+ class: button_classes,
14
+ data: { disable: true, confirm: t("leave_confirmation", scope: "decidim.meetings.meetings.show") }
15
+ ) %>
14
16
  <% else %>
15
17
  <% if model.registration_form_enabled? %>
16
18
  <%= action_authorized_link_to(
@@ -64,6 +64,10 @@ module Decidim
64
64
  def show_footer_actions?
65
65
  options[:show_footer_actions]
66
66
  end
67
+
68
+ def statuses
69
+ [:follow, :comments_count]
70
+ end
67
71
  end
68
72
  end
69
73
  end
@@ -6,8 +6,13 @@
6
6
  <li class="card-data__item">
7
7
  <div class="text-left">
8
8
  <div class="card__icondata--address">
9
- <span><%= link_to(model.online_meeting_url, model.online_meeting_url, target: "_blank") %></span><br>
10
- <span><%= translated_attribute model.location_hints %></span>
9
+ <% if future? %>
10
+ <span><%= t("link_available_soon", scope: "decidim.meetings.meetings.show") %></span>
11
+ <% elsif live? %>
12
+ <span><%= link_to(t("join", scope: "decidim.meetings.meetings.show"), live_event_url, target: "_blank") %></span><br>
13
+ <% else %>
14
+ <span><%= link_to(t("visit_finished", scope: "decidim.meetings.meetings.show"), live_event_url, target: "_blank") %></span><br>
15
+ <% end %>
11
16
  </div>
12
17
  </div>
13
18
  </li>
@@ -3,14 +3,26 @@
3
3
  module Decidim
4
4
  module Meetings
5
5
  # This cell renders the URL address of an online meeting.
6
- class MeetingUrlCell < Decidim::ViewModel
6
+ class MeetingUrlCell < Decidim::Meetings::OnlineMeetingCell
7
7
  include Cell::ViewModel::Partial
8
8
  include LayoutHelper
9
9
 
10
10
  private
11
11
 
12
12
  def resource_icon
13
- icon "video", class: "icon--big", role: "img", "aria-hidden": true
13
+ icon icon_name, class: "icon--big", role: "img", "aria-hidden": true
14
+ end
15
+
16
+ def icon_name
17
+ if has_meeting_url?
18
+ "video"
19
+ else
20
+ "timer"
21
+ end
22
+ end
23
+
24
+ def has_meeting_url?
25
+ @has_meeting_url ||= model.online_meeting_url.present?
14
26
  end
15
27
  end
16
28
  end
@@ -4,7 +4,7 @@
4
4
  <h3>${title}</h3>
5
5
  <div id="bodyContent">
6
6
  <p>{{html description}}</p>
7
- <div class="map__date-adress">
7
+ <div class="map__date-address">
8
8
  <div class="card__datetime">
9
9
  <div class="card__datetime__date">
10
10
  ${startTimeDay} <span class="card__datetime__month">${startTimeMonth} ${startTimeYear}</span>
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This cell defines methods required for other cells to render
6
+ # online meeting urls
7
+ class OnlineMeetingCell < Decidim::ViewModel
8
+ protected
9
+
10
+ def embedder
11
+ @embedder ||= MeetingIframeEmbedder.new(model.online_meeting_url)
12
+ end
13
+
14
+ delegate :embeddable?, to: :embedder
15
+
16
+ def live_event_url
17
+ if embeddable?
18
+ Decidim::EngineRouter.main_proxy(model.component).meeting_live_event_path(meeting_id: model.id)
19
+ else
20
+ model.online_meeting_url
21
+ end
22
+ end
23
+
24
+ def live?
25
+ model.start_time &&
26
+ model.end_time &&
27
+ Time.current >= (model.start_time - 10.minutes) &&
28
+ Time.current <= model.end_time
29
+ end
30
+
31
+ def future?
32
+ Time.current <= model.start_time && !live?
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,44 @@
1
+ <% if online_meeting_url? %>
2
+ <% if show_embed? || live? || future? %>
3
+ <div class="card card--secondary">
4
+ <div class="card__content text-center">
5
+ <% if live? %>
6
+ <div class="heading1 text-primary">
7
+ <%= icon "audio", class: "heading4" %>
8
+ </div>
9
+ <div>
10
+ <strong class="heading5"><%= t("live_event", scope: "decidim.meetings.meetings.show") %></strong>
11
+ <% unless show_embed? %>
12
+ <p><small><%= t("micro_camera_permissions_warning", scope: "decidim.meetings.meetings.show") %></small></p>
13
+ <% end %>
14
+ </div>
15
+ <% end %>
16
+
17
+ <% if show_embed? %>
18
+ <div class="<%= "margin-top-3" if live? %> absolutes aspect-ratio-16-9">
19
+ <%== embed_code(request.host) %>
20
+ </div>
21
+ <% elsif live? || future? %>
22
+ <div class="absolutes">
23
+ <% if live? %>
24
+ <%= link_to t("join", scope: "decidim.meetings.meetings.show"), live_event_url, target: "_blank", class: "button button--sc" %>
25
+ <% elsif future? %>
26
+ <span><%= t("link_closed", scope: "decidim.meetings.meetings.show") %></span>
27
+ <% end %>
28
+ </div>
29
+ <% end %>
30
+ </div>
31
+ </div>
32
+ <% end %>
33
+ <% else %>
34
+ <div class="card card--secondary">
35
+ <div class="card__content address">
36
+ <div class="address__info">
37
+ <%= icon "timer", role: "img", "aria-hidden": true, remove_icon_class: true, width: 40, height: 70 %>
38
+ <div class="address__details">
39
+ <span><%= t("link_available_soon", scope: "decidim.meetings.meetings.show") %></span>
40
+ </div>
41
+ </div>
42
+ </div>
43
+ </div>
44
+ <% end %>
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This cell renders the online meeting link section
6
+ # of a online or both type of meeting.
7
+ class OnlineMeetingLinkCell < Decidim::Meetings::OnlineMeetingCell
8
+ include Decidim::LayoutHelper
9
+
10
+ def show
11
+ render
12
+ end
13
+
14
+ def online_meeting_url?
15
+ model.online_meeting_url.present?
16
+ end
17
+
18
+ delegate :embed_code, to: :embedder
19
+
20
+ private
21
+
22
+ def show_embed?
23
+ model.show_embedded_iframe? && embedder.embeddable?
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,16 @@
1
+ <div id="list-of-public-participants" class="section">
2
+ <div class="row">
3
+ <div class="columns large-12">
4
+ <h4 class="section-heading"><%= t("attending_participants", scope: "decidim.meetings.public_participants_list") %></h4>
5
+ </div>
6
+ <div class="columns large-12">
7
+ <%= cell(
8
+ "decidim/collapsible_list",
9
+ public_participants,
10
+ cell_name: "decidim/author",
11
+ cell_options: { extra_classes: ["author-data--small"] },
12
+ hidden_elements_count_i18n_key: "decidim.meetings.public_participants_list.hidden_participants_count"
13
+ ) %>
14
+ </div>
15
+ </div>
16
+ </div>
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "cell/partial"
4
+
5
+ module Decidim
6
+ module Meetings
7
+ # This cell renders the list of public participants of a meeting.
8
+ #
9
+ # Example:
10
+ #
11
+ # cell("decidim/public_participants_list", meeting)
12
+ class PublicParticipantsListCell < Decidim::ViewModel
13
+ include ApplicationHelper
14
+
15
+ def show
16
+ return if public_participants.blank?
17
+
18
+ render
19
+ end
20
+
21
+ private
22
+
23
+ # Finds the public participants (as users) of meeting
24
+ #
25
+ # Returns an Array of presented Users
26
+ def public_participants
27
+ @public_participants ||= model.public_participants.map { |user| present(user) }
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,7 @@
1
+ <% answer_options_with_percentages.each do |(answer_option_body, answer_percentage)| %>
2
+ <label><%= translated_attribute(answer_option_body) %></label>
3
+ <div class="meeting-polls__answer">
4
+ <div class="meeting-polls__answer--value"><%= answer_percentage %></div>
5
+ <div class="meeting-polls__answer--bar"><div style="width: <%= answer_percentage %>"></div></div>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This cell renders the percentage of responses which chose
6
+ # the given answer option in a meeting poll question
7
+ class QuestionResponsesCell < Decidim::ViewModel
8
+ include ActionView::Helpers::NumberHelper
9
+
10
+ def show
11
+ render
12
+ end
13
+
14
+ private
15
+
16
+ # Returns an array of arrays, where the internal array contains
17
+ # - the body of the answer option
18
+ # - the percentage of answers for that option
19
+ #
20
+ def answer_options_with_percentages
21
+ # This query joins answer options with answer choices and answers
22
+ # and returns for each answer option the count of times it has been answered
23
+ # grouping by answer options and answers.
24
+ #
25
+ # This calculation is a bit complex because of multiple option answers
26
+ question_answers_choices = Decidim::Meetings::AnswerOption.where(decidim_question_id: model.id)
27
+ .joins([choices: :answer])
28
+ .group("#{answers_table_name}.id, #{answer_options_table_name}.id")
29
+ .select(<<~SELECT
30
+ #{answer_options_table_name}.id AS id,
31
+ #{answer_options_table_name}.body,
32
+ #{answers_table_name}.id AS answer_id,
33
+ COUNT(decidim_answer_option_id) AS count
34
+ SELECT
35
+ )
36
+
37
+ # Extract the number of uniq answers by the answer_id attribute
38
+ total_answers = question_answers_choices.map(&:answer_id).compact.uniq.size
39
+
40
+ # A second grouping is necessary to count the number of answers for each answer_option id
41
+ # and calculate the percentages
42
+ options_with_percentages = []
43
+ question_answers_choices.group_by(&:id).each do |_id, values|
44
+ answers_count = values.sum(&:count)
45
+ options_with_percentages << [values.first.body, calculate_and_format_percentage(answers_count, total_answers)]
46
+ end
47
+
48
+ options_with_percentages
49
+ end
50
+
51
+ def format_percentage(raw_percentage)
52
+ "#{number_with_precision(raw_percentage, precision: 2, significant: true)}%"
53
+ end
54
+
55
+ def calculate_percentage(part, total)
56
+ total.zero? ? 0 : ((part.to_f / total) * 100).round(2)
57
+ end
58
+
59
+ def calculate_and_format_percentage(part, total)
60
+ format_percentage(calculate_percentage(part, total))
61
+ end
62
+
63
+ def answer_options_table_name
64
+ @answer_options_table_name ||= Decidim::Meetings::AnswerOption.table_name
65
+ end
66
+
67
+ def answers_table_name
68
+ @answers_table_name ||= Decidim::Meetings::Answer.table_name
69
+ end
70
+ end
71
+ end
72
+ end
@@ -41,6 +41,9 @@ module Decidim
41
41
  ) do
42
42
  meeting.update!(
43
43
  closing_report: form.closing_report,
44
+ video_url: form.video_url,
45
+ audio_url: form.audio_url,
46
+ closing_visible: form.closing_visible,
44
47
  attendees_count: form.attendees_count,
45
48
  contributions_count: form.contributions_count,
46
49
  attending_organizations: form.attending_organizations,
@@ -27,7 +27,6 @@ module Decidim
27
27
  transaction do
28
28
  copy_meeting!
29
29
  copy_services!
30
- schedule_upcoming_meeting_notification
31
30
  send_notification
32
31
  end
33
32
 
@@ -77,14 +76,6 @@ module Decidim
77
76
  end
78
77
  end
79
78
 
80
- def schedule_upcoming_meeting_notification
81
- checksum = Decidim::Meetings::UpcomingMeetingNotificationJob.generate_checksum(copied_meeting)
82
-
83
- Decidim::Meetings::UpcomingMeetingNotificationJob
84
- .set(wait_until: copied_meeting.start_time - 2.days)
85
- .perform_later(copied_meeting.id, checksum)
86
- end
87
-
88
79
  def send_notification
89
80
  Decidim::EventsManager.publish(
90
81
  event: "decidim.events.meetings.meeting_created",
@@ -19,8 +19,6 @@ module Decidim
19
19
  transaction do
20
20
  create_meeting!
21
21
  create_services!
22
- schedule_upcoming_meeting_notification
23
- send_notification
24
22
  end
25
23
 
26
24
  broadcast(:ok, meeting)
@@ -55,7 +53,10 @@ module Decidim
55
53
  author: form.current_organization,
56
54
  registration_terms: form.current_component.settings.default_registration_terms,
57
55
  component: form.current_component,
58
- questionnaire: Decidim::Forms::Questionnaire.new
56
+ questionnaire: Decidim::Forms::Questionnaire.new,
57
+ customize_registration_email: form.customize_registration_email,
58
+ registration_email_custom_content: form.registration_email_custom_content,
59
+ show_embedded_iframe: form.show_embedded_iframe
59
60
  }
60
61
 
61
62
  @meeting = Decidim.traceability.create!(
@@ -75,23 +76,6 @@ module Decidim
75
76
  )
76
77
  end
77
78
  end
78
-
79
- def schedule_upcoming_meeting_notification
80
- checksum = Decidim::Meetings::UpcomingMeetingNotificationJob.generate_checksum(meeting)
81
-
82
- Decidim::Meetings::UpcomingMeetingNotificationJob
83
- .set(wait_until: meeting.start_time - 2.days)
84
- .perform_later(meeting.id, checksum)
85
- end
86
-
87
- def send_notification
88
- Decidim::EventsManager.publish(
89
- event: "decidim.events.meetings.meeting_created",
90
- event_class: Decidim::Meetings::CreateMeetingEvent,
91
- resource: meeting,
92
- followers: meeting.participatory_space.followers
93
- )
94
- end
95
79
  end
96
80
  end
97
81
  end
@@ -40,6 +40,8 @@ module Decidim
40
40
  end
41
41
 
42
42
  def proposals
43
+ return [] unless Decidim::Meetings.enable_proposal_linking
44
+
43
45
  @proposals ||= meeting.authored_proposals.load
44
46
  end
45
47
  end
@@ -0,0 +1,72 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ module Admin
6
+ # A command with all the business logic that publishes an
7
+ # existing meeting.
8
+ class PublishMeeting < Rectify::Command
9
+ # Public: Initializes the command.
10
+ #
11
+ # meeting - Decidim::Meetings::Meeting
12
+ # current_user - the user performing the action
13
+ def initialize(meeting, current_user)
14
+ @meeting = meeting
15
+ @current_user = current_user
16
+ end
17
+
18
+ # Executes the command. Broadcasts these events:
19
+ #
20
+ # - :ok when everything is valid.
21
+ # - :invalid if the form wasn't valid and we couldn't proceed.
22
+ #
23
+ # Returns nothing.
24
+ def call
25
+ return broadcast(:invalid) if meeting.published?
26
+
27
+ transaction do
28
+ publish_meeting
29
+ send_notification
30
+ schedule_upcoming_meeting_notification
31
+ end
32
+
33
+ broadcast(:ok, meeting)
34
+ end
35
+
36
+ private
37
+
38
+ attr_reader :meeting, :current_user
39
+
40
+ def publish_meeting
41
+ @meeting = Decidim.traceability.perform_action!(
42
+ :publish,
43
+ meeting,
44
+ current_user,
45
+ visibility: "all"
46
+ ) do
47
+ meeting.publish!
48
+ meeting
49
+ end
50
+ end
51
+
52
+ def send_notification
53
+ Decidim::EventsManager.publish(
54
+ event: "decidim.events.meetings.meeting_created",
55
+ event_class: Decidim::Meetings::CreateMeetingEvent,
56
+ resource: meeting,
57
+ followers: meeting.participatory_space.followers,
58
+ force_send: true
59
+ )
60
+ end
61
+
62
+ def schedule_upcoming_meeting_notification
63
+ checksum = Decidim::Meetings::UpcomingMeetingNotificationJob.generate_checksum(meeting)
64
+
65
+ Decidim::Meetings::UpcomingMeetingNotificationJob
66
+ .set(wait_until: meeting.start_time - 2.days)
67
+ .perform_later(meeting.id, checksum)
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ module Admin
6
+ # A command with all the business logic that unpublishes an
7
+ # existing meeting.
8
+ class UnpublishMeeting < Rectify::Command
9
+ # Public: Initializes the command.
10
+ #
11
+ # meeting - Decidim::Meetings::Meeting
12
+ # current_user - the user performing the action
13
+ def initialize(meeting, current_user)
14
+ @meeting = meeting
15
+ @current_user = current_user
16
+ end
17
+
18
+ # Executes the command. Broadcasts these events:
19
+ #
20
+ # - :ok when everything is valid.
21
+ # - :invalid if the form wasn't valid and we couldn't proceed.
22
+ #
23
+ # Returns nothing.
24
+ def call
25
+ return broadcast(:invalid) unless meeting.published?
26
+
27
+ @meeting = Decidim.traceability.perform_action!(
28
+ :unpublish,
29
+ meeting,
30
+ current_user,
31
+ visibility: "all"
32
+ ) do
33
+ meeting.unpublish!
34
+ meeting
35
+ end
36
+ broadcast(:ok, meeting)
37
+ end
38
+
39
+ private
40
+
41
+ attr_reader :meeting, :current_user
42
+ end
43
+ end
44
+ end
45
+ end
@@ -24,7 +24,7 @@ module Decidim
24
24
  transaction do
25
25
  update_meeting!
26
26
  send_notification if should_notify_followers?
27
- schedule_upcoming_meeting_notification if start_time_changed?
27
+ schedule_upcoming_meeting_notification if meeting.published? && start_time_changed?
28
28
  update_services!
29
29
  end
30
30
 
@@ -59,7 +59,10 @@ module Decidim
59
59
  location: form.location,
60
60
  location_hints: form.location_hints,
61
61
  private_meeting: form.private_meeting,
62
- transparent: form.transparent
62
+ transparent: form.transparent,
63
+ customize_registration_email: form.customize_registration_email,
64
+ registration_email_custom_content: form.registration_email_custom_content,
65
+ show_embedded_iframe: form.show_embedded_iframe
63
66
  )
64
67
  end
65
68
 
@@ -80,7 +83,7 @@ module Decidim
80
83
  end
81
84
 
82
85
  def should_notify_followers?
83
- important_attributes.any? { |attr| meeting.previous_changes[attr].present? }
86
+ meeting.published? && important_attributes.any? { |attr| meeting.previous_changes[attr].present? }
84
87
  end
85
88
 
86
89
  def important_attributes
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ module Admin
6
+ # This command is executed when the user changes a Questionnaire from the admin
7
+ # panel.
8
+ class UpdateQuestionStatus < Rectify::Command
9
+ class InvalidStatus < StandardError; end
10
+
11
+ # Initializes a UpdateQuestionnaire Command.
12
+ #
13
+ # form - The form from which to get the data.
14
+ # questionnaire - The current instance of the questionnaire to be updated.
15
+ def initialize(question, current_user)
16
+ @question = question
17
+ @current_user = current_user
18
+ end
19
+
20
+ # Updates the questionnaire if valid.
21
+ #
22
+ # Broadcasts :ok if successful, :invalid otherwise.
23
+ def call
24
+ Decidim::Meetings::Question.transaction do
25
+ update_question
26
+ end
27
+
28
+ broadcast(:ok)
29
+ rescue InvalidStatus
30
+ broadcast(:invalid)
31
+ end
32
+
33
+ private
34
+
35
+ attr_reader :question, :current_user
36
+
37
+ def update_question
38
+ Decidim.traceability.update!(
39
+ question,
40
+ current_user,
41
+ status: new_status(question)
42
+ )
43
+ end
44
+
45
+ def new_status(question)
46
+ if question.unpublished?
47
+ Decidim::Meetings::Question.statuses[:published]
48
+ elsif question.published?
49
+ Decidim::Meetings::Question.statuses[:closed]
50
+ else
51
+ raise InvalidStatus
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end