decidim-meetings 0.23.6 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) 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 +5 -13
  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 +9 -5
  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 +52 -1
  40. data/app/permissions/decidim/meetings/permissions.rb +12 -2
  41. data/app/presenters/decidim/meetings/meeting_presenter.rb +33 -0
  42. data/app/services/decidim/meetings/meeting_search.rb +20 -0
  43. data/app/views/decidim/meetings/admin/invite_join_meeting_mailer/invite.html.erb +1 -1
  44. data/app/views/decidim/meetings/admin/invites/index.html.erb +1 -1
  45. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +31 -1
  46. data/app/views/decidim/meetings/admin/meetings/edit.html.erb +2 -2
  47. data/app/views/decidim/meetings/admin/meetings/index.html.erb +23 -1
  48. data/app/views/decidim/meetings/admin/meetings/new.html.erb +2 -2
  49. data/app/views/decidim/meetings/admin/minutes/edit.html.erb +1 -1
  50. data/app/views/decidim/meetings/admin/registrations/edit.html.erb +20 -18
  51. data/app/views/decidim/meetings/directory/meetings/index.html.erb +1 -0
  52. data/app/views/decidim/meetings/directory/meetings/index.js.erb +0 -3
  53. data/app/views/decidim/meetings/meeting_closes/_form.html.erb +7 -0
  54. data/app/views/decidim/meetings/meeting_closes/edit.html.erb +25 -0
  55. data/app/views/decidim/meetings/meeting_closes/proposals_picker.html.erb +1 -0
  56. data/app/views/decidim/meetings/meetings/_filters.html.erb +6 -0
  57. data/app/views/decidim/meetings/meetings/_form.html.erb +36 -2
  58. data/app/views/decidim/meetings/meetings/_online_meeting_link.html.erb +11 -0
  59. data/app/views/decidim/meetings/meetings/edit.html.erb +1 -1
  60. data/app/views/decidim/meetings/meetings/index.js.erb +0 -3
  61. data/app/views/decidim/meetings/meetings/new.html.erb +1 -1
  62. data/app/views/decidim/meetings/meetings/show.html.erb +25 -21
  63. data/app/views/decidim/meetings/registration_mailer/confirmation.html.erb +3 -1
  64. data/app/views/decidim/participatory_spaces/_upcoming_meeting_for_card.html.erb +1 -1
  65. data/config/locales/ar.yml +0 -7
  66. data/config/locales/ca.yml +8 -10
  67. data/config/locales/cs.yml +53 -16
  68. data/config/locales/de.yml +45 -8
  69. data/config/locales/el.yml +0 -10
  70. data/config/locales/en.yml +47 -10
  71. data/config/locales/es-MX.yml +18 -10
  72. data/config/locales/es-PY.yml +18 -10
  73. data/config/locales/es.yml +18 -10
  74. data/config/locales/eu.yml +0 -7
  75. data/config/locales/fi-plain.yml +45 -8
  76. data/config/locales/fi.yml +47 -10
  77. data/config/locales/fr-CA.yml +47 -10
  78. data/config/locales/fr.yml +49 -12
  79. data/config/locales/gl.yml +0 -12
  80. data/config/locales/hu.yml +0 -10
  81. data/config/locales/id-ID.yml +0 -7
  82. data/config/locales/is-IS.yml +0 -6
  83. data/config/locales/it.yml +0 -9
  84. data/config/locales/ja.yml +0 -9
  85. data/config/locales/lv.yml +0 -10
  86. data/config/locales/nl.yml +43 -9
  87. data/config/locales/no.yml +11 -10
  88. data/config/locales/pl.yml +39 -13
  89. data/config/locales/pt-BR.yml +0 -7
  90. data/config/locales/pt.yml +0 -9
  91. data/config/locales/ro-RO.yml +0 -22
  92. data/config/locales/ru.yml +0 -7
  93. data/config/locales/sk.yml +0 -10
  94. data/config/locales/sl.yml +0 -4
  95. data/config/locales/sv.yml +11 -11
  96. data/config/locales/tr-TR.yml +44 -9
  97. data/config/locales/uk.yml +0 -6
  98. data/config/locales/zh-CN.yml +0 -9
  99. data/db/migrate/20180809134748_add_upcoming_events_as_content_block.rb +1 -1
  100. data/db/migrate/20201006140511_add_online_meeting_url.rb +7 -0
  101. data/db/migrate/20201009124057_add_type_of_meeting.rb +7 -0
  102. data/db/migrate/20201016112641_add_registration_type_and_url_to_meetings.rb +19 -0
  103. data/lib/decidim/api/agenda_item_type.rb +22 -0
  104. data/lib/decidim/api/agenda_type.rb +19 -0
  105. data/lib/decidim/api/linked_resources_interface.rb +7 -6
  106. data/lib/decidim/api/meeting_type.rb +63 -0
  107. data/lib/decidim/api/meetings_type.rb +26 -0
  108. data/lib/decidim/api/minutes_type.rb +20 -0
  109. data/{app/types/decidim/meetings → lib/decidim/api}/service_type.rb +4 -4
  110. data/lib/decidim/api/services_interface.rb +3 -3
  111. data/lib/decidim/meetings/api.rb +6 -0
  112. data/lib/decidim/meetings/component.rb +53 -23
  113. data/lib/decidim/meetings/engine.rb +3 -17
  114. data/lib/decidim/meetings/test/factories.rb +16 -3
  115. data/lib/decidim/meetings/version.rb +1 -1
  116. data/lib/decidim/meetings.rb +1 -1
  117. metadata +43 -40
  118. data/app/types/decidim/meetings/agenda_item_type.rb +0 -28
  119. data/app/types/decidim/meetings/agenda_type.rb +0 -25
  120. data/app/types/decidim/meetings/meeting_type.rb +0 -65
  121. data/app/types/decidim/meetings/meetings_type.rb +0 -32
  122. data/app/types/decidim/meetings/minutes_type.rb +0 -26
  123. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_meetings.html.erb +0 -15
  124. 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: a842085b879c1a1623553767730254c6867ddf2fe3395b74ba93d7a1de819c37
4
- data.tar.gz: 70d4bfa767518e8ad406a21530455f240c6e175137ca6263177f7893607798a1
3
+ metadata.gz: 18653e1c242daed19b47a1986fbd8e12c6dc89d40b66a3264741d32459528e11
4
+ data.tar.gz: 7260be8c1a3f99993319db38067d463cdf66daa65629a13e9e11d71f6fb08c3e
5
5
  SHA512:
6
- metadata.gz: 13d26d2fbb27b2201811407c228abf6288a3db91e2be80cd532257fc26513ec2e0bc88210eb4112c91c6e4ad75fa34fed7594f923ba213265a3296fbd0b9252e
7
- data.tar.gz: 5994a313372a42c316bb0b3c2748d37b47dc71fa42ab7d93712dc7595fe82db27cbb2558a7da2b239b9d879095b868e12286b76ed3c1c9da1678ceaf05454d6e
6
+ metadata.gz: 8a1659b38d0e6b3cc197c029d4bc39531385685941a78f7977bf3cb93538de4a7b35e70f1d6aba581cbd13efdd48bdc1b29152d09092bfee21858a4c4ac7fda1
7
+ data.tar.gz: 1aca577ee9db9cb104b747a11200874154e19c6f4503e0a788602449b750776432381fc767f8468ffc010775b4ed580661faaea668c6c23b894c591300c74123
@@ -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,21 +2,13 @@
2
2
 
3
3
  module Decidim
4
4
  module Meetings
5
- # A cell to display when actions happen on a meeting.
5
+ # A cell to display when a meeting has been created.
6
6
  class MeetingActivityCell < ActivityCell
7
7
  def title
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
8
+ I18n.t(
9
+ "decidim.meetings.last_activity.new_meeting_at_html",
10
+ link: participatory_space_link
11
+ )
20
12
  end
21
13
 
22
14
  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
@@ -45,7 +45,13 @@ module Decidim
45
45
  location_hints: { I18n.locale => form.location_hints },
46
46
  author: form.current_user,
47
47
  decidim_user_group_id: form.user_group_id,
48
- registration_terms: form.current_component.settings.default_registration_terms,
48
+ online_meeting_url: form.online_meeting_url,
49
+ registration_type: form.registration_type,
50
+ registration_url: form.registration_url,
51
+ available_slots: form.available_slots,
52
+ registration_terms: { I18n.locale => form.registration_terms },
53
+ registrations_enabled: form.registrations_enabled,
54
+ type_of_meeting: form.clean_type_of_meeting,
49
55
  component: form.current_component
50
56
  }
51
57
 
@@ -40,11 +40,11 @@ module Decidim
40
40
 
41
41
  def questionnaire_answers
42
42
  questionnaire = Decidim::Forms::Questionnaire.find_by(questionnaire_for_id: @meeting)
43
- questionnaire.answers.where(user: @user)
43
+ questionnaire.answers.where(user: @user) if questionnaire.present?
44
44
  end
45
45
 
46
46
  def destroy_questionnaire_answers
47
- questionnaire_answers.destroy_all
47
+ questionnaire_answers.try(:destroy_all)
48
48
  end
49
49
 
50
50
  def decrement_score
@@ -55,7 +55,14 @@ module Decidim
55
55
  location: { I18n.locale => form.location },
56
56
  location_hints: { I18n.locale => form.location_hints },
57
57
  author: form.current_user,
58
- decidim_user_group_id: form.user_group_id
58
+ decidim_user_group_id: form.user_group_id,
59
+ registration_type: form.registration_type,
60
+ registration_url: form.registration_url,
61
+ available_slots: form.available_slots,
62
+ registration_terms: { I18n.locale => form.registration_terms },
63
+ registrations_enabled: form.registrations_enabled,
64
+ type_of_meeting: form.clean_type_of_meeting,
65
+ online_meeting_url: form.online_meeting_url
59
66
  },
60
67
  visibility: "public-only"
61
68
  )
@@ -13,7 +13,7 @@ module Decidim
13
13
  helper_method :meetings, :meeting
14
14
 
15
15
  def meetings
16
- @meetings ||= Meeting.where(component: current_component).order("created_at DESC").page(params[:page]).per(15)
16
+ @meetings ||= Meeting.where(component: current_component).order(:start_time).page(params[:page]).per(15)
17
17
  end
18
18
 
19
19
  def meeting
@@ -12,13 +12,13 @@ module Decidim
12
12
  def edit
13
13
  enforce_permission_to :close, :meeting, meeting: meeting
14
14
 
15
- @form = form(CloseMeetingForm).from_model(meeting)
15
+ @form = form(Admin::CloseMeetingForm).from_model(meeting)
16
16
  end
17
17
 
18
18
  def update
19
19
  enforce_permission_to :close, :meeting, meeting: meeting
20
20
 
21
- @form = form(CloseMeetingForm).from_params(params.merge(proposals: meeting.sibling_scope(:proposals)))
21
+ @form = form(Admin::CloseMeetingForm).from_params(params.merge(proposals: meeting.sibling_scope(:proposals)))
22
22
 
23
23
  CloseMeeting.call(@form, meeting) do
24
24
  on(:ok) do
@@ -25,7 +25,7 @@ module Decidim
25
25
  @meeting_spaces = @meeting_spaces.sort_by do |_param, name|
26
26
  name
27
27
  end
28
- @meeting_spaces = @meeting_spaces.prepend(["all", t(".all")])
28
+ @meeting_spaces.prepend(["all", t(".all")])
29
29
  end
30
30
 
31
31
  def calendar
@@ -53,7 +53,7 @@ module Decidim
53
53
 
54
54
  def default_search_params
55
55
  {
56
- scope: Meeting.visible_meeting_for(current_user)
56
+ scope: Meeting.not_hidden.visible_meeting_for(current_user)
57
57
  }
58
58
  end
59
59
 
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This controller allows a participant to update the closing_report and the linked proposals of a closed meeting
6
+ class MeetingClosesController < Decidim::Meetings::ApplicationController
7
+ include Decidim::Proposals::Admin::Picker
8
+ include FormFactory
9
+
10
+ helper_method :meeting
11
+
12
+ def edit
13
+ enforce_permission_to :close, :meeting, meeting: meeting
14
+
15
+ @form = form(CloseMeetingForm).from_model(meeting)
16
+ end
17
+
18
+ def update
19
+ enforce_permission_to :close, :meeting, meeting: meeting
20
+
21
+ @form = form(CloseMeetingForm).from_params(params.merge(proposals: meeting.sibling_scope(:proposals)))
22
+
23
+ CloseMeeting.call(@form, meeting) do
24
+ on(:ok) do
25
+ flash[:notice] = I18n.t("meetings.close.success", scope: "decidim.meetings.admin")
26
+ redirect_to meeting_path(meeting)
27
+ end
28
+
29
+ on(:invalid) do
30
+ flash.now[:alert] = I18n.t("meetings.close.invalid", scope: "decidim.meetings.admin")
31
+ render action: "edit"
32
+ end
33
+ end
34
+ end
35
+
36
+ private
37
+
38
+ def meeting
39
+ @meeting ||= Meeting.where(component: current_component).find(params[:id])
40
+ end
41
+ end
42
+ end
43
+ end
@@ -53,8 +53,6 @@ module Decidim
53
53
  def show
54
54
  raise ActionController::RoutingError, "Not Found" unless meeting
55
55
 
56
- @report_form = form(Decidim::ReportForm).from_params(reason: "spam")
57
-
58
56
  return if meeting.current_user_can_visit_meeting?(current_user)
59
57
 
60
58
  flash[:alert] = I18n.t("meeting.not_allowed", scope: "decidim.meetings")
@@ -92,7 +90,7 @@ module Decidim
92
90
  end
93
91
 
94
92
  def meetings
95
- @meetings ||= paginate(search.results.not_hidden)
93
+ @meetings ||= paginate(search.results.order(:start_time))
96
94
  end
97
95
 
98
96
  def registration
@@ -111,9 +109,11 @@ module Decidim
111
109
  {
112
110
  search_text: "",
113
111
  date: %w(upcoming),
112
+ activity: "all",
114
113
  scope_id: default_filter_scope_params,
115
114
  category_id: default_filter_category_params,
116
- origin: default_filter_origin_params
115
+ origin: default_filter_origin_params,
116
+ type: default_filter_type_params
117
117
  }
118
118
  end
119
119
 
@@ -124,9 +124,13 @@ module Decidim
124
124
  filter_origin_params
125
125
  end
126
126
 
127
+ def default_filter_type_params
128
+ %w(all) + Decidim::Meetings::Meeting::TYPE_OF_MEETING
129
+ end
130
+
127
131
  def default_search_params
128
132
  {
129
- scope: Meeting.visible_meeting_for(current_user)
133
+ scope: Meeting.not_hidden.visible_meeting_for(current_user)
130
134
  }
131
135
  end
132
136
  end
@@ -28,10 +28,10 @@ module Decidim
28
28
  end
29
29
 
30
30
  def proposals
31
- @proposals ||= Decidim.find_resource_manifest(:proposals)
32
- .try(:resource_scope, current_component)
33
- &.where(id: proposal_ids)
34
- &.order(title: :asc)
31
+ @proposals = Decidim.find_resource_manifest(:proposals)
32
+ .try(:resource_scope, current_component)
33
+ &.where(id: proposal_ids)
34
+ &.order(title: :asc)
35
35
  end
36
36
  end
37
37
  end