decidim-meetings 0.23.1 → 0.24.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_meetings_manifest.js +1 -0
  3. data/app/assets/javascripts/decidim/meetings/admin/meetings_form.js.es6 +47 -0
  4. data/app/assets/javascripts/decidim/meetings/meetings_form.js.es6 +45 -0
  5. data/app/cells/decidim/meetings/content_blocks/highlighted_meetings/elements.erb +16 -0
  6. data/app/cells/decidim/meetings/content_blocks/highlighted_meetings/heading.erb +1 -0
  7. data/app/cells/decidim/meetings/content_blocks/highlighted_meetings_cell.rb +27 -0
  8. data/app/cells/decidim/meetings/join_meeting_button/show.erb +7 -0
  9. data/app/cells/decidim/meetings/meeting_activity_cell.rb +13 -5
  10. data/app/cells/decidim/meetings/meeting_cell.rb +2 -4
  11. data/app/cells/decidim/meetings/meeting_highlighted_list_item/show.erb +21 -0
  12. data/app/cells/decidim/meetings/meeting_highlighted_list_item_cell.rb +10 -0
  13. data/app/cells/decidim/meetings/meeting_m/address.erb +5 -1
  14. data/app/cells/decidim/meetings/meeting_m_cell.rb +2 -0
  15. data/app/cells/decidim/meetings/meeting_url/show.erb +15 -0
  16. data/app/cells/decidim/meetings/meeting_url_cell.rb +17 -0
  17. data/app/cells/decidim/meetings/reported_content/show.erb +3 -0
  18. data/app/cells/decidim/meetings/reported_content_cell.rb +13 -0
  19. data/app/commands/decidim/meetings/admin/create_meeting.rb +5 -0
  20. data/app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb +1 -1
  21. data/app/commands/decidim/meetings/admin/update_meeting.rb +5 -0
  22. data/app/commands/decidim/meetings/admin/validate_registration_code.rb +2 -0
  23. data/app/commands/decidim/meetings/close_meeting.rb +66 -0
  24. data/app/commands/decidim/meetings/create_meeting.rb +7 -1
  25. data/app/commands/decidim/meetings/leave_meeting.rb +2 -2
  26. data/app/commands/decidim/meetings/update_meeting.rb +8 -1
  27. data/app/controllers/decidim/meetings/admin/application_controller.rb +1 -1
  28. data/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb +2 -2
  29. data/app/controllers/decidim/meetings/directory/meetings_controller.rb +2 -2
  30. data/app/controllers/decidim/meetings/meeting_closes_controller.rb +43 -0
  31. data/app/controllers/decidim/meetings/meetings_controller.rb +10 -6
  32. data/app/forms/decidim/meetings/admin/close_meeting_form.rb +4 -4
  33. data/app/forms/decidim/meetings/admin/meeting_form.rb +62 -4
  34. data/app/forms/decidim/meetings/close_meeting_form.rb +31 -0
  35. data/app/forms/decidim/meetings/meeting_form.rb +71 -3
  36. data/app/helpers/decidim/meetings/application_helper.rb +20 -0
  37. data/app/helpers/decidim/meetings/map_helper.rb +1 -1
  38. data/app/models/decidim/meetings/agenda_item.rb +1 -1
  39. data/app/models/decidim/meetings/meeting.rb +95 -8
  40. data/app/permissions/decidim/meetings/permissions.rb +12 -2
  41. data/app/presenters/decidim/meetings/admin_log/meeting_presenter.rb +2 -2
  42. data/app/presenters/decidim/meetings/meeting_presenter.rb +33 -0
  43. data/app/services/decidim/meetings/meeting_search.rb +20 -0
  44. data/app/views/decidim/meetings/admin/invite_join_meeting_mailer/invite.html.erb +1 -1
  45. data/app/views/decidim/meetings/admin/invites/index.html.erb +1 -1
  46. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +31 -1
  47. data/app/views/decidim/meetings/admin/meetings/edit.html.erb +2 -2
  48. data/app/views/decidim/meetings/admin/meetings/index.html.erb +23 -1
  49. data/app/views/decidim/meetings/admin/meetings/new.html.erb +2 -2
  50. data/app/views/decidim/meetings/admin/minutes/edit.html.erb +1 -1
  51. data/app/views/decidim/meetings/admin/registrations/edit.html.erb +20 -18
  52. data/app/views/decidim/meetings/directory/meetings/index.html.erb +1 -0
  53. data/app/views/decidim/meetings/directory/meetings/index.js.erb +0 -3
  54. data/app/views/decidim/meetings/meeting_closes/_form.html.erb +7 -0
  55. data/app/views/decidim/meetings/meeting_closes/edit.html.erb +25 -0
  56. data/app/views/decidim/meetings/meeting_closes/proposals_picker.html.erb +1 -0
  57. data/app/views/decidim/meetings/meetings/_filters.html.erb +6 -0
  58. data/app/views/decidim/meetings/meetings/_filters_small_view.html.erb +1 -1
  59. data/app/views/decidim/meetings/meetings/_form.html.erb +36 -2
  60. data/app/views/decidim/meetings/meetings/_online_meeting_link.html.erb +11 -0
  61. data/app/views/decidim/meetings/meetings/edit.html.erb +1 -1
  62. data/app/views/decidim/meetings/meetings/index.js.erb +0 -3
  63. data/app/views/decidim/meetings/meetings/new.html.erb +1 -1
  64. data/app/views/decidim/meetings/meetings/show.html.erb +31 -25
  65. data/app/views/decidim/meetings/registration_mailer/confirmation.html.erb +3 -1
  66. data/app/views/decidim/participatory_spaces/_upcoming_meeting_for_card.html.erb +1 -1
  67. data/config/locales/ar.yml +0 -7
  68. data/config/locales/ca.yml +48 -9
  69. data/config/locales/cs.yml +52 -13
  70. data/config/locales/de.yml +112 -73
  71. data/config/locales/el.yml +0 -10
  72. data/config/locales/en.yml +48 -9
  73. data/config/locales/es-MX.yml +47 -9
  74. data/config/locales/es-PY.yml +47 -9
  75. data/config/locales/es.yml +47 -9
  76. data/config/locales/eu.yml +0 -7
  77. data/config/locales/fi-plain.yml +46 -7
  78. data/config/locales/fi.yml +179 -140
  79. data/config/locales/fr-CA.yml +48 -9
  80. data/config/locales/fr.yml +50 -11
  81. data/config/locales/gl.yml +0 -7
  82. data/config/locales/hu.yml +0 -10
  83. data/config/locales/id-ID.yml +0 -7
  84. data/config/locales/is-IS.yml +0 -7
  85. data/config/locales/it.yml +0 -9
  86. data/config/locales/ja.yml +0 -9
  87. data/config/locales/lv.yml +0 -10
  88. data/config/locales/nl.yml +44 -8
  89. data/config/locales/no.yml +23 -11
  90. data/config/locales/pl.yml +54 -16
  91. data/config/locales/pt-BR.yml +0 -7
  92. data/config/locales/pt.yml +0 -9
  93. data/config/locales/ro-RO.yml +0 -9
  94. data/config/locales/ru.yml +0 -7
  95. data/config/locales/si-LK.yml +1 -0
  96. data/config/locales/sk.yml +0 -10
  97. data/config/locales/sv.yml +11 -9
  98. data/config/locales/sw-KE.yml +1 -0
  99. data/config/locales/tr-TR.yml +196 -97
  100. data/config/locales/uk.yml +0 -7
  101. data/config/locales/zh-CN.yml +0 -9
  102. data/db/migrate/20180809134748_add_upcoming_events_as_content_block.rb +1 -1
  103. data/db/migrate/20201006140511_add_online_meeting_url.rb +7 -0
  104. data/db/migrate/20201009124057_add_type_of_meeting.rb +7 -0
  105. data/db/migrate/20201016112641_add_registration_type_and_url_to_meetings.rb +19 -0
  106. data/db/migrate/20201111133246_add_salt_to_decidim_meetings.rb +8 -0
  107. data/lib/decidim/api/agenda_item_type.rb +22 -0
  108. data/lib/decidim/api/agenda_type.rb +19 -0
  109. data/lib/decidim/api/linked_resources_interface.rb +7 -6
  110. data/lib/decidim/api/meeting_type.rb +63 -0
  111. data/lib/decidim/api/meetings_type.rb +26 -0
  112. data/lib/decidim/api/minutes_type.rb +20 -0
  113. data/{app/types/decidim/meetings → lib/decidim/api}/service_type.rb +4 -4
  114. data/lib/decidim/api/services_interface.rb +3 -3
  115. data/lib/decidim/meetings.rb +1 -1
  116. data/lib/decidim/meetings/api.rb +6 -0
  117. data/lib/decidim/meetings/component.rb +53 -23
  118. data/lib/decidim/meetings/engine.rb +3 -17
  119. data/lib/decidim/meetings/test/factories.rb +16 -3
  120. data/lib/decidim/meetings/version.rb +1 -1
  121. metadata +49 -43
  122. data/app/types/decidim/meetings/agenda_item_type.rb +0 -28
  123. data/app/types/decidim/meetings/agenda_type.rb +0 -25
  124. data/app/types/decidim/meetings/meeting_type.rb +0 -65
  125. data/app/types/decidim/meetings/meetings_type.rb +0 -32
  126. data/app/types/decidim/meetings/minutes_type.rb +0 -26
  127. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_meetings.html.erb +0 -15
  128. data/app/views/decidim/participatory_processes/participatory_process_groups/_meeting.html.erb +0 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a7109623e0747edf93ab6d6b5c7ba149e9a7b912690a65cbebea8d70469ac6a
4
- data.tar.gz: bd33c46e4cf80b94950a97bc300bb784c79f9fdb6da90b5a350ac8eb8412e940
3
+ metadata.gz: bb7ad73d81e7d2af81157d3ef70546e30fc05787fb9d8d6b30e80306a1ea034e
4
+ data.tar.gz: 9b269123dda6cc111d83a12fbd7477392f0e698862a56d1210ea4a3eec59ab62
5
5
  SHA512:
6
- metadata.gz: 5794650b937a6fa7b9a8f224855b3096ce9f552a71b19599eff9f1299dca206fb376855903045eddbe0d8124ce8cde0e9a7dd3953d08122b1d496aaddeb089fa
7
- data.tar.gz: 8dbb31a798feafa94a0780ba6fa74f87479f1e6337f7593f1890c685666f19b9f12f3695d3dcc89fee12dcf7eb6bd519b647069f419b6488083b5d3a690f512d
6
+ metadata.gz: 15aa43c12c3f4dadcd85bab77a25a091ca2ba3ae1d57795a344e8af0551150c92f16bd02cdb80023a80d26c65c4b955c24d12f712dc7607ca545e7208b59b2c1
7
+ data.tar.gz: a7f5d414b32d1c76c02e7925b2071923814cbc066e5a76d312cda0fe371e6dade4411013eb438a15be7c2fa3f1b85d986efc7e2b61876818808f91a4f55dedb2
@@ -3,6 +3,7 @@
3
3
  //= link decidim/meetings/admin/registrations_form.js
4
4
  //= link decidim/meetings/admin/registrations_invite_form.js
5
5
  //= link decidim/meetings/admin/meetings_form.js
6
+ //= link decidim/meetings/meetings_form.js
6
7
  //= link decidim/meetings/admin/agendas.js
7
8
  //= link decidim/meetings/admin/destroy_meeting_alert.js
8
9
  //= link_tree ../images/decidim
@@ -96,5 +96,52 @@
96
96
  toggleDisabledHiddenFields();
97
97
 
98
98
  attachGeocoding($form.find("#meeting_address"));
99
+
100
+ const $meetingRegistrationType = $form.find("#meeting_registration_type");
101
+ const $meetingRegistrationTerms = $form.find("#meeting_registration_terms");
102
+ const $meetingRegistrationUrl = $form.find("#meeting_registration_url");
103
+ const $meetingAvailableSlots = $form.find("#meeting_available_slots");
104
+
105
+ const toggleDependsOnSelect = ($target, $showDiv, type) => {
106
+ const value = $target.val();
107
+ $showDiv.toggle(value === type);
108
+ };
109
+
110
+ $meetingRegistrationType.on("change", (ev) => {
111
+ const $target = $(ev.target);
112
+ toggleDependsOnSelect($target, $meetingAvailableSlots, "on_this_platform");
113
+ toggleDependsOnSelect($target, $meetingRegistrationTerms, "on_this_platform");
114
+ toggleDependsOnSelect($target, $meetingRegistrationUrl, "on_different_platform");
115
+ });
116
+
117
+ $meetingRegistrationType.trigger("change");
118
+ }
119
+
120
+ const $meetingForm = $(".meetings_form");
121
+ if ($meetingForm.length > 0) {
122
+ const $meetingTypeOfMeeting = $meetingForm.find("#meeting_type_of_meeting");
123
+ const $meetingOnlineFields = $meetingForm.find(".field[data-meeting-type='online']");
124
+ const $meetingInPersonFields = $meetingForm.find(".field[data-meeting-type='in_person']");
125
+
126
+ const toggleDependsOnSelect = ($target, $showDiv, type) => {
127
+ const value = $target.val();
128
+ if (value === "hybrid") {
129
+ $showDiv.show();
130
+ } else {
131
+ $showDiv.hide();
132
+ if (value === type) {
133
+ $showDiv.show();
134
+ }
135
+ }
136
+ };
137
+
138
+ $meetingTypeOfMeeting.on("change", (ev) => {
139
+ const $target = $(ev.target);
140
+ toggleDependsOnSelect($target, $meetingOnlineFields, "online");
141
+ toggleDependsOnSelect($target, $meetingInPersonFields, "in_person");
142
+ });
143
+
144
+ toggleDependsOnSelect($meetingTypeOfMeeting, $meetingOnlineFields, "online");
145
+ toggleDependsOnSelect($meetingTypeOfMeeting, $meetingInPersonFields, "in_person");
99
146
  }
100
147
  })(window);
@@ -5,5 +5,50 @@
5
5
  $(() => {
6
6
  // Adds the latitude/longitude inputs after the geocoding is done
7
7
  attachGeocoding($("#meeting_address"));
8
+
9
+ const $form = $(".meetings_form");
10
+ if ($form.length > 0) {
11
+ const $meetingTypeOfMeeting = $form.find("#meeting_type_of_meeting");
12
+ const $meetingOnlineFields = $form.find(".field[data-meeting-type='online']");
13
+ const $meetingInPersonFields = $form.find(".field[data-meeting-type='in_person']");
14
+
15
+ const toggleDependsOnSelect = ($target, $showDiv, type) => {
16
+ const value = $target.val();
17
+ if (value === "hybrid") {
18
+ $showDiv.show();
19
+ } else {
20
+ $showDiv.hide();
21
+ if (value === type) {
22
+ $showDiv.show();
23
+ }
24
+ }
25
+ };
26
+
27
+ $meetingTypeOfMeeting.on("change", (ev) => {
28
+ const $target = $(ev.target);
29
+ toggleDependsOnSelect($target, $meetingOnlineFields, "online");
30
+ toggleDependsOnSelect($target, $meetingInPersonFields, "in_person");
31
+ });
32
+
33
+ toggleDependsOnSelect($meetingTypeOfMeeting, $meetingOnlineFields, "online");
34
+ toggleDependsOnSelect($meetingTypeOfMeeting, $meetingInPersonFields, "in_person");
35
+
36
+
37
+ const $meetingRegistrationType = $form.find("#meeting_registration_type");
38
+ const $meetingRegistrationTerms = $form.find("#meeting_registration_terms");
39
+ const $meetingRegistrationUrl = $form.find("#meeting_registration_url");
40
+ const $meetingAvailableSlots = $form.find("#meeting_available_slots");
41
+
42
+ $meetingRegistrationType.on("change", (ev) => {
43
+ const $target = $(ev.target);
44
+ toggleDependsOnSelect($target, $meetingAvailableSlots, "on_this_platform");
45
+ toggleDependsOnSelect($target, $meetingRegistrationTerms, "on_this_platform");
46
+ toggleDependsOnSelect($target, $meetingRegistrationUrl, "on_different_platform");
47
+ });
48
+
49
+ toggleDependsOnSelect($meetingRegistrationType, $meetingAvailableSlots, "on_this_platform");
50
+ toggleDependsOnSelect($meetingRegistrationType, $meetingRegistrationTerms, "on_this_platform");
51
+ toggleDependsOnSelect($meetingRegistrationType, $meetingRegistrationUrl, "on_different_platform");
52
+ }
8
53
  });
9
54
  })(window);
@@ -0,0 +1,16 @@
1
+ <div class="row">
2
+ <div class="column medium-6">
3
+ <% elements.first(4).each do |element| %>
4
+ <%= card_for element, size: :highlighted_list_item %>
5
+ <% end %>
6
+ </div>
7
+ <div class="columns medium-6">
8
+ <% if geolocation_enabled? %>
9
+ <%= cell "decidim/meetings/meetings_map", elements %>
10
+ <% else %>
11
+ <% elements.offset(4).first(4).each do |element| %>
12
+ <%= card_for element, size: :highlighted_list_item %>
13
+ <% end %>
14
+ <% end %>
15
+ </div>
16
+ </div>
@@ -0,0 +1 @@
1
+ <h2 class="section-heading"><%= t("decidim.meetings.content_blocks.upcoming_events.upcoming_events") %></h2>
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ module ContentBlocks
6
+ class HighlightedMeetingsCell < Decidim::ContentBlocks::HighlightedElementsCell
7
+ def base_relation
8
+ Decidim::Meetings::Meeting.where(component: published_components)
9
+ end
10
+
11
+ def elements
12
+ @elements ||= base_relation.order(start_time: :asc).limit(limit)
13
+ end
14
+
15
+ def geolocation_enabled?
16
+ Decidim::Map.available?(:geocoding)
17
+ end
18
+
19
+ private
20
+
21
+ def limit
22
+ geolocation_enabled? ? 4 : 8
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -35,4 +35,11 @@
35
35
  <% if shows_remaining_slots? %>
36
36
  <span><%= t("remaining_slots", scope: "decidim.meetings.meetings.show", count: model.remaining_slots) %></span>
37
37
  <% end %>
38
+ <% elsif model.on_different_platform? %>
39
+ <%= action_authorized_link_to(
40
+ :join,
41
+ i18n_join_text,
42
+ model.registration_url,
43
+ class: button_classes
44
+ ) %>
38
45
  <% end %>
@@ -2,13 +2,21 @@
2
2
 
3
3
  module Decidim
4
4
  module Meetings
5
- # A cell to display when a meeting has been created.
5
+ # A cell to display when actions happen on a meeting.
6
6
  class MeetingActivityCell < ActivityCell
7
7
  def title
8
- I18n.t(
9
- "decidim.meetings.last_activity.new_meeting_at_html",
10
- link: participatory_space_link
11
- )
8
+ case action
9
+ when "update"
10
+ I18n.t(
11
+ "decidim.meetings.last_activity.meeting_updated_at_html",
12
+ link: participatory_space_link
13
+ )
14
+ else
15
+ I18n.t(
16
+ "decidim.meetings.last_activity.new_meeting_at_html",
17
+ link: participatory_space_link
18
+ )
19
+ end
12
20
  end
13
21
 
14
22
  def resource_link_text
@@ -18,6 +18,8 @@ module Decidim
18
18
 
19
19
  def card_size
20
20
  case @options[:size]
21
+ when :highlighted_list_item
22
+ "decidim/meetings/meeting_highlighted_list_item"
21
23
  when :list_item
22
24
  "decidim/meetings/meeting_list_item"
23
25
  when :s
@@ -27,10 +29,6 @@ module Decidim
27
29
  end
28
30
  end
29
31
 
30
- def title
31
- present(model).title
32
- end
33
-
34
32
  def resource_icon
35
33
  icon "meetings", remove_icon_class: true, width: 40, height: 70
36
34
  end
@@ -0,0 +1,21 @@
1
+ <article class="card">
2
+ <div class="card__content">
3
+ <div class="card__header">
4
+ <%= link_to meeting_path, class: "card__link" do %>
5
+ <h5 class="card__title">
6
+ <%= title %>
7
+ </h5>
8
+ <% end %>
9
+ </div>
10
+ <div class="row">
11
+ <time datetime="<%= l(model.start_time, format: :long_dashed) %>" class="column medium-4 text-muted">
12
+ <%= icon "datetime", class: "mr-xs", role: "img", "aria-hidden": true %>
13
+ <%= l start_date, format: :decidim_with_month_name %>
14
+ </time>
15
+ <div class="column medium-8 text-muted">
16
+ <%= participatory_space_class_name %>
17
+ <%= link_to participatory_space_title, participatory_space_path %>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </article>
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This cell renders the Highlighted List Item Card (:highlighted_list_item)
6
+ # meeting card for an instance of a Meeting. This card is used in the
7
+ # content block of Highlighted Meetings and is based on :s size card
8
+ class MeetingHighlightedListItemCell < MeetingSCell; end
9
+ end
10
+ end
@@ -1 +1,5 @@
1
- <%= cell "decidim/address", model %>
1
+ <% if online_meeting? %>
2
+ <%= cell "decidim/meetings/meeting_url", model %>
3
+ <% else %>
4
+ <%= cell "decidim/address", model %>
5
+ <% end %>
@@ -27,6 +27,8 @@ module Decidim
27
27
  present(model).title
28
28
  end
29
29
 
30
+ delegate :online_meeting?, to: :model
31
+
30
32
  private
31
33
 
32
34
  def spans_multiple_dates?
@@ -0,0 +1,15 @@
1
+ <div class="card__icondata">
2
+ <ul class="card-data">
3
+ <li class="card-data__item">
4
+ <%= resource_icon %>
5
+ </li>
6
+ <li class="card-data__item">
7
+ <div class="text-left">
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>
11
+ </div>
12
+ </div>
13
+ </li>
14
+ </ul>
15
+ </div>
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This cell renders the URL address of an online meeting.
6
+ class MeetingUrlCell < Decidim::ViewModel
7
+ include Cell::ViewModel::Partial
8
+ include LayoutHelper
9
+
10
+ private
11
+
12
+ def resource_icon
13
+ icon "video", class: "icon--big", role: "img", "aria-hidden": true
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ <blockquote>
2
+ <%= render_value model.description %>
3
+ </blockquote>
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This cells renders a small preview of the `Meeting` that is
6
+ # used in the moderations panel.
7
+ class ReportedContentCell < Decidim::ReportedContentCell
8
+ def show
9
+ render :show
10
+ end
11
+ end
12
+ end
13
+ end
@@ -40,6 +40,11 @@ module Decidim
40
40
  description: parsed_description,
41
41
  end_time: form.end_time,
42
42
  start_time: form.start_time,
43
+ online_meeting_url: form.online_meeting_url,
44
+ registration_type: form.registration_type,
45
+ registration_url: form.registration_url,
46
+ available_slots: form.available_slots,
47
+ type_of_meeting: form.clean_type_of_meeting,
43
48
  address: form.address,
44
49
  latitude: form.latitude,
45
50
  longitude: form.longitude,
@@ -37,7 +37,7 @@ module Decidim
37
37
 
38
38
  def already_invited?
39
39
  return false unless user.persisted?
40
- return false unless meeting.invites.where(user: user).exists?
40
+ return false unless meeting.invites.exists?(user: user)
41
41
 
42
42
  form.errors.add(:email, :already_invited)
43
43
  true
@@ -48,6 +48,11 @@ module Decidim
48
48
  description: parsed_description,
49
49
  end_time: form.end_time,
50
50
  start_time: form.start_time,
51
+ online_meeting_url: form.online_meeting_url,
52
+ registration_type: form.registration_type,
53
+ registration_url: form.registration_url,
54
+ available_slots: form.available_slots,
55
+ type_of_meeting: form.clean_type_of_meeting,
51
56
  address: form.address,
52
57
  latitude: form.latitude,
53
58
  longitude: form.longitude,
@@ -35,6 +35,8 @@ module Decidim
35
35
  end
36
36
 
37
37
  def send_notification
38
+ return unless meeting.component.settings.registration_code_enabled
39
+
38
40
  Decidim::EventsManager.publish(
39
41
  event: "decidim.events.meetings.registration_code_validated",
40
42
  event_class: Decidim::Meetings::RegistrationCodeValidatedEvent,
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This command is executed when the user closes a Meeting from the public
6
+ # views.
7
+ class CloseMeeting < Rectify::Command
8
+ # Initializes a CloseMeeting Command.
9
+ #
10
+ # form - The form from which to get the data.
11
+ # meeting - The current instance of the page to be closed.
12
+ def initialize(form, meeting)
13
+ @form = form
14
+ @meeting = meeting
15
+ end
16
+
17
+ # Closes the meeting if valid.
18
+ #
19
+ # Broadcasts :ok if successful, :invalid otherwise.
20
+ def call
21
+ return broadcast(:invalid) if form.invalid?
22
+
23
+ transaction do
24
+ close_meeting
25
+ link_proposals
26
+ end
27
+
28
+ broadcast(:ok)
29
+ end
30
+
31
+ private
32
+
33
+ attr_reader :form, :meeting
34
+
35
+ def close_meeting
36
+ parsed_closing_report = Decidim::ContentProcessor.parse(form.closing_report, current_organization: form.current_organization).rewrite
37
+
38
+ Decidim.traceability.perform_action!(
39
+ :close,
40
+ meeting,
41
+ form.current_user
42
+ ) do
43
+ meeting.update!(
44
+ closed_at: form.closed_at,
45
+ closing_report: { I18n.locale => parsed_closing_report }
46
+ )
47
+ end
48
+
49
+ Decidim::EventsManager.publish(
50
+ event: "decidim.events.meetings.meeting_closed",
51
+ event_class: Decidim::Meetings::CloseMeetingEvent,
52
+ resource: meeting,
53
+ followers: meeting.followers
54
+ )
55
+ end
56
+
57
+ def proposals
58
+ meeting.sibling_scope(:proposals).where(id: @form.proposal_ids)
59
+ end
60
+
61
+ def link_proposals
62
+ meeting.link_resources(proposals, "proposals_from_meeting")
63
+ end
64
+ end
65
+ end
66
+ end