decidim-meetings 0.23.0 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) 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_cell.rb +2 -4
  10. data/app/cells/decidim/meetings/meeting_highlighted_list_item/show.erb +21 -0
  11. data/app/cells/decidim/meetings/meeting_highlighted_list_item_cell.rb +10 -0
  12. data/app/cells/decidim/meetings/meeting_m/address.erb +5 -1
  13. data/app/cells/decidim/meetings/meeting_m_cell.rb +2 -0
  14. data/app/cells/decidim/meetings/meeting_url/show.erb +15 -0
  15. data/app/cells/decidim/meetings/meeting_url_cell.rb +17 -0
  16. data/app/cells/decidim/meetings/reported_content/show.erb +3 -0
  17. data/app/cells/decidim/meetings/reported_content_cell.rb +13 -0
  18. data/app/commands/decidim/meetings/admin/create_meeting.rb +5 -0
  19. data/app/commands/decidim/meetings/admin/invite_user_to_join_meeting.rb +1 -1
  20. data/app/commands/decidim/meetings/admin/update_meeting.rb +5 -0
  21. data/app/commands/decidim/meetings/admin/validate_registration_code.rb +2 -0
  22. data/app/commands/decidim/meetings/close_meeting.rb +66 -0
  23. data/app/commands/decidim/meetings/create_meeting.rb +7 -1
  24. data/app/commands/decidim/meetings/leave_meeting.rb +2 -2
  25. data/app/commands/decidim/meetings/update_meeting.rb +8 -1
  26. data/app/controllers/decidim/meetings/admin/application_controller.rb +1 -1
  27. data/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb +2 -2
  28. data/app/controllers/decidim/meetings/directory/meetings_controller.rb +2 -2
  29. data/app/controllers/decidim/meetings/meeting_closes_controller.rb +43 -0
  30. data/app/controllers/decidim/meetings/meetings_controller.rb +10 -6
  31. data/app/forms/decidim/meetings/admin/close_meeting_form.rb +4 -4
  32. data/app/forms/decidim/meetings/admin/meeting_form.rb +62 -4
  33. data/app/forms/decidim/meetings/close_meeting_form.rb +31 -0
  34. data/app/forms/decidim/meetings/meeting_form.rb +71 -3
  35. data/app/helpers/decidim/meetings/application_helper.rb +20 -0
  36. data/app/helpers/decidim/meetings/map_helper.rb +1 -1
  37. data/app/models/decidim/meetings/agenda_item.rb +1 -1
  38. data/app/models/decidim/meetings/meeting.rb +95 -8
  39. data/app/permissions/decidim/meetings/permissions.rb +12 -2
  40. data/app/presenters/decidim/meetings/admin_log/meeting_presenter.rb +2 -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 +31 -25
  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 -9
  67. data/config/locales/cs.yml +51 -13
  68. data/config/locales/de.yml +111 -73
  69. data/config/locales/el.yml +0 -10
  70. data/config/locales/en.yml +47 -9
  71. data/config/locales/es-MX.yml +18 -9
  72. data/config/locales/es-PY.yml +18 -9
  73. data/config/locales/es.yml +18 -9
  74. data/config/locales/eu.yml +0 -7
  75. data/config/locales/fi-plain.yml +45 -7
  76. data/config/locales/fi.yml +178 -140
  77. data/config/locales/fr-CA.yml +47 -9
  78. data/config/locales/fr.yml +47 -9
  79. data/config/locales/gl.yml +0 -7
  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 -7
  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 -8
  87. data/config/locales/no.yml +23 -11
  88. data/config/locales/pl.yml +40 -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 -9
  92. data/config/locales/ru.yml +0 -7
  93. data/config/locales/si-LK.yml +1 -0
  94. data/config/locales/sk.yml +0 -10
  95. data/config/locales/sv.yml +11 -9
  96. data/config/locales/sw-KE.yml +1 -0
  97. data/config/locales/tr-TR.yml +196 -97
  98. data/config/locales/uk.yml +0 -7
  99. data/config/locales/zh-CN.yml +0 -9
  100. data/db/migrate/20180809134748_add_upcoming_events_as_content_block.rb +1 -1
  101. data/db/migrate/20201006140511_add_online_meeting_url.rb +7 -0
  102. data/db/migrate/20201009124057_add_type_of_meeting.rb +7 -0
  103. data/db/migrate/20201016112641_add_registration_type_and_url_to_meetings.rb +19 -0
  104. data/db/migrate/20201111133246_add_salt_to_decidim_meetings.rb +8 -0
  105. data/lib/decidim/api/agenda_item_type.rb +22 -0
  106. data/lib/decidim/api/agenda_type.rb +19 -0
  107. data/lib/decidim/api/linked_resources_interface.rb +7 -6
  108. data/lib/decidim/api/meeting_type.rb +63 -0
  109. data/lib/decidim/api/meetings_type.rb +26 -0
  110. data/lib/decidim/api/minutes_type.rb +20 -0
  111. data/{app/types/decidim/meetings → lib/decidim/api}/service_type.rb +4 -4
  112. data/lib/decidim/api/services_interface.rb +3 -3
  113. data/lib/decidim/meetings.rb +1 -1
  114. data/lib/decidim/meetings/api.rb +6 -0
  115. data/lib/decidim/meetings/component.rb +53 -23
  116. data/lib/decidim/meetings/engine.rb +3 -17
  117. data/lib/decidim/meetings/test/factories.rb +16 -3
  118. data/lib/decidim/meetings/version.rb +1 -1
  119. metadata +49 -43
  120. data/app/types/decidim/meetings/agenda_item_type.rb +0 -28
  121. data/app/types/decidim/meetings/agenda_type.rb +0 -25
  122. data/app/types/decidim/meetings/meeting_type.rb +0 -65
  123. data/app/types/decidim/meetings/meetings_type.rb +0 -32
  124. data/app/types/decidim/meetings/minutes_type.rb +0 -26
  125. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_meetings.html.erb +0 -15
  126. data/app/views/decidim/participatory_processes/participatory_process_groups/_meeting.html.erb +0 -10
@@ -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,12 +53,10 @@ 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")
61
- redirect_to action: "index"
59
+ redirect_to(ResourceLocatorPresenter.new(meeting).index)
62
60
  end
63
61
 
64
62
  def edit
@@ -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
@@ -17,6 +17,11 @@ module Decidim
17
17
  attribute :decidim_category_id, Integer
18
18
  attribute :private_meeting, Boolean
19
19
  attribute :transparent, Boolean
20
+ attribute :online_meeting_url, String
21
+ attribute :type_of_meeting, String
22
+ attribute :registration_type, String
23
+ attribute :registration_url, String
24
+ attribute :available_slots, Integer, default: 0
20
25
 
21
26
  translatable_attribute :title, String
22
27
  translatable_attribute :description, String
@@ -25,10 +30,15 @@ module Decidim
25
30
 
26
31
  validates :title, translatable_presence: true
27
32
  validates :description, translatable_presence: true
28
- validates :location, translatable_presence: true
29
-
30
- validates :address, presence: true
31
- validates :address, geocoding: true, if: ->(form) { form.has_address? && !form.geocoded? }
33
+ validates :registration_type, presence: true
34
+ validates :available_slots, numericality: { greater_than_or_equal_to: 0 }, presence: true, if: ->(form) { form.on_this_platform? }
35
+ validates :registration_url, presence: true, url: true, if: ->(form) { form.on_different_platform? }
36
+ validates :type_of_meeting, presence: true
37
+ validates :location, translatable_presence: true, if: ->(form) { form.in_person_meeting? || form.hybrid_meeting? }
38
+
39
+ validates :address, presence: true, if: ->(form) { form.needs_address? }
40
+ validates :address, geocoding: true, if: ->(form) { form.has_address? && !form.geocoded? && form.needs_address? }
41
+ validates :online_meeting_url, presence: true, url: true, if: ->(form) { form.online_meeting? || form.hybrid_meeting? }
32
42
  validates :start_time, presence: true, date: { before: :end_time }
33
43
  validates :end_time, presence: true, date: { after: :start_time }
34
44
 
@@ -36,6 +46,7 @@ module Decidim
36
46
  validates :category, presence: true, if: ->(form) { form.decidim_category_id.present? }
37
47
  validates :scope, presence: true, if: ->(form) { form.decidim_scope_id.present? }
38
48
  validates :decidim_scope_id, scope_belongs_to_component: true, if: ->(form) { form.decidim_scope_id.present? }
49
+ validates :clean_type_of_meeting, presence: true
39
50
 
40
51
  delegate :categories, to: :current_component
41
52
 
@@ -49,6 +60,7 @@ module Decidim
49
60
 
50
61
  self.title = presenter.title(all_locales: title.is_a?(Hash))
51
62
  self.description = presenter.description(all_locales: description.is_a?(Hash))
63
+ self.type_of_meeting = model.type_of_meeting
52
64
  end
53
65
 
54
66
  def services_to_persist
@@ -89,9 +101,55 @@ module Decidim
89
101
  geocoding_enabled? && address.present?
90
102
  end
91
103
 
104
+ def needs_address?
105
+ in_person_meeting? || hybrid_meeting?
106
+ end
107
+
92
108
  def geocoded?
93
109
  latitude.present? && longitude.present?
94
110
  end
111
+
112
+ def online_meeting?
113
+ type_of_meeting == "online"
114
+ end
115
+
116
+ def in_person_meeting?
117
+ type_of_meeting == "in_person"
118
+ end
119
+
120
+ def hybrid_meeting?
121
+ type_of_meeting == "hybrid"
122
+ end
123
+
124
+ def clean_type_of_meeting
125
+ type_of_meeting.presence
126
+ end
127
+
128
+ def type_of_meeting_select
129
+ Decidim::Meetings::Meeting::TYPE_OF_MEETING.map do |type|
130
+ [
131
+ I18n.t("type_of_meeting.#{type}", scope: "decidim.meetings"),
132
+ type
133
+ ]
134
+ end
135
+ end
136
+
137
+ def on_this_platform?
138
+ registration_type == "on_this_platform"
139
+ end
140
+
141
+ def on_different_platform?
142
+ registration_type == "on_different_platform"
143
+ end
144
+
145
+ def registration_type_select
146
+ Decidim::Meetings::Meeting::REGISTRATION_TYPE.map do |type|
147
+ [
148
+ I18n.t("registration_type.#{type}", scope: "decidim.meetings"),
149
+ type
150
+ ]
151
+ end
152
+ end
95
153
  end
96
154
  end
97
155
  end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This class holds a Form to close a meeting from Decidim's public views.
6
+ class CloseMeetingForm < Decidim::Form
7
+ attribute :closing_report, String
8
+ attribute :proposal_ids, Array[Integer]
9
+ attribute :proposals
10
+ attribute :closed_at, Decidim::Attributes::TimeWithZone, default: ->(_form, _attribute) { Time.current }
11
+
12
+ validates :closing_report, presence: true
13
+
14
+ # Private: Gets the proposals from the meeting and injects them to the form.
15
+ #
16
+ # Returns nothing.
17
+ def map_model(model)
18
+ self.proposal_ids = model.linked_resources(:proposals, "proposals_from_meeting").pluck(:id)
19
+ presenter = MeetingPresenter.new(model)
20
+ self.closing_report = presenter.closing_report(all_locales: false)
21
+ end
22
+
23
+ def proposals
24
+ @proposals ||= Decidim.find_resource_manifest(:proposals)
25
+ .try(:resource_scope, current_component)
26
+ &.where(id: proposal_ids)
27
+ &.order(title: :asc)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -17,12 +17,25 @@ module Decidim
17
17
  attribute :decidim_scope_id, Integer
18
18
  attribute :decidim_category_id, Integer
19
19
  attribute :user_group_id, Integer
20
+ attribute :online_meeting_url, String
21
+ attribute :type_of_meeting, String
22
+ attribute :registration_type, String
23
+ attribute :registrations_enabled, Boolean, default: false
24
+ attribute :registration_url, String
25
+ attribute :available_slots, Integer, default: 0
26
+ attribute :registration_terms, String
20
27
 
21
28
  validates :title, presence: true
22
29
  validates :description, presence: true
23
- validates :location, presence: true
24
- validates :address, presence: true
25
- validates :address, geocoding: true, if: ->(form) { form.has_address? && !form.geocoded? }
30
+ validates :type_of_meeting, presence: true
31
+ validates :location, presence: true, if: ->(form) { form.in_person_meeting? || form.hybrid_meeting? }
32
+ validates :address, presence: true, if: ->(form) { form.needs_address? }
33
+ validates :address, geocoding: true, if: ->(form) { form.has_address? && !form.geocoded? && form.needs_address? }
34
+ validates :online_meeting_url, presence: true, url: true, if: ->(form) { form.online_meeting? || form.hybrid_meeting? }
35
+ validates :registration_type, presence: true
36
+ validates :available_slots, numericality: { greater_than_or_equal_to: 0 }, presence: true, if: ->(form) { form.on_this_platform? }
37
+ validates :registration_terms, presence: true, if: ->(form) { form.on_this_platform? }
38
+ validates :registration_url, presence: true, url: true, if: ->(form) { form.on_different_platform? }
26
39
  validates :start_time, presence: true, date: { before: :end_time }
27
40
  validates :end_time, presence: true, date: { after: :start_time }
28
41
 
@@ -30,6 +43,7 @@ module Decidim
30
43
  validates :category, presence: true, if: ->(form) { form.decidim_category_id.present? }
31
44
  validates :scope, presence: true, if: ->(form) { form.decidim_scope_id.present? }
32
45
  validates :decidim_scope_id, scope_belongs_to_component: true, if: ->(form) { form.decidim_scope_id.present? }
46
+ validates :clean_type_of_meeting, presence: true
33
47
 
34
48
  delegate :categories, to: :current_component
35
49
 
@@ -38,6 +52,10 @@ module Decidim
38
52
  presenter = MeetingPresenter.new(model)
39
53
  self.title = presenter.title(all_locales: false)
40
54
  self.description = presenter.description(all_locales: false)
55
+ self.location = presenter.location(all_locales: false)
56
+ self.location_hints = presenter.location_hints(all_locales: false)
57
+ self.registration_terms = presenter.registration_terms(all_locales: false)
58
+ self.type_of_meeting = model.type_of_meeting
41
59
  end
42
60
 
43
61
  alias component current_component
@@ -70,9 +88,59 @@ module Decidim
70
88
  geocoding_enabled? && address.present?
71
89
  end
72
90
 
91
+ def needs_address?
92
+ in_person_meeting? || hybrid_meeting?
93
+ end
94
+
73
95
  def geocoded?
74
96
  latitude.present? && longitude.present?
75
97
  end
98
+
99
+ def online_meeting?
100
+ type_of_meeting == "online"
101
+ end
102
+
103
+ def in_person_meeting?
104
+ type_of_meeting == "in_person"
105
+ end
106
+
107
+ def hybrid_meeting?
108
+ type_of_meeting == "hybrid"
109
+ end
110
+
111
+ def clean_type_of_meeting
112
+ type_of_meeting.presence
113
+ end
114
+
115
+ def type_of_meeting_select
116
+ Decidim::Meetings::Meeting::TYPE_OF_MEETING.map do |type|
117
+ [
118
+ I18n.t("type_of_meeting.#{type}", scope: "decidim.meetings"),
119
+ type
120
+ ]
121
+ end
122
+ end
123
+
124
+ def on_this_platform?
125
+ registration_type == "on_this_platform"
126
+ end
127
+
128
+ def on_different_platform?
129
+ registration_type == "on_different_platform"
130
+ end
131
+
132
+ def registration_type_select
133
+ Decidim::Meetings::Meeting::REGISTRATION_TYPE.map do |type|
134
+ [
135
+ I18n.t("registration_type.#{type}", scope: "decidim.meetings"),
136
+ type
137
+ ]
138
+ end
139
+ end
140
+
141
+ def registrations_enabled
142
+ on_this_platform?
143
+ end
76
144
  end
77
145
  end
78
146
  end
@@ -27,6 +27,18 @@ module Decidim
27
27
  )
28
28
  end
29
29
 
30
+ def filter_type_values
31
+ type_values = []
32
+ Decidim::Meetings::Meeting::TYPE_OF_MEETING.each do |type|
33
+ type_values << TreePoint.new(type, t("decidim.meetings.meetings.filters.type_values.#{type}"))
34
+ end
35
+
36
+ TreeNode.new(
37
+ TreePoint.new("", t("decidim.meetings.meetings.filters.type_values.all")),
38
+ type_values
39
+ )
40
+ end
41
+
30
42
  def filter_date_values
31
43
  TreeNode.new(
32
44
  TreePoint.new("", t("decidim.meetings.meetings.filters.date_values.all")),
@@ -36,6 +48,14 @@ module Decidim
36
48
  ]
37
49
  )
38
50
  end
51
+
52
+ # Options to filter meetings by activity.
53
+ def activity_filter_values
54
+ [
55
+ ["all", t("decidim.meetings.meetings.filters.all")],
56
+ ["my_meetings", t("decidim.meetings.meetings.filters.my_meetings")]
57
+ ]
58
+ end
39
59
  end
40
60
  end
41
61
  end