decidim-meetings 0.24.1 → 0.25.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) 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/meetings_map_cell.rb +1 -1
  9. data/app/cells/decidim/meetings/online_meeting_cell.rb +36 -0
  10. data/app/cells/decidim/meetings/online_meeting_link/show.erb +44 -0
  11. data/app/cells/decidim/meetings/online_meeting_link_cell.rb +27 -0
  12. data/app/cells/decidim/meetings/public_participants_list/show.erb +16 -0
  13. data/app/cells/decidim/meetings/public_participants_list_cell.rb +31 -0
  14. data/app/cells/decidim/meetings/question_responses/show.erb +7 -0
  15. data/app/cells/decidim/meetings/question_responses_cell.rb +72 -0
  16. data/app/commands/decidim/meetings/admin/close_meeting.rb +3 -0
  17. data/app/commands/decidim/meetings/admin/copy_meeting.rb +0 -9
  18. data/app/commands/decidim/meetings/admin/create_meeting.rb +4 -20
  19. data/app/commands/decidim/meetings/admin/destroy_meeting.rb +2 -0
  20. data/app/commands/decidim/meetings/admin/publish_meeting.rb +72 -0
  21. data/app/commands/decidim/meetings/admin/unpublish_meeting.rb +45 -0
  22. data/app/commands/decidim/meetings/admin/update_meeting.rb +6 -3
  23. data/app/commands/decidim/meetings/admin/update_question_status.rb +57 -0
  24. data/app/commands/decidim/meetings/admin/update_questionnaire.rb +93 -0
  25. data/app/commands/decidim/meetings/close_meeting.rb +2 -0
  26. data/app/commands/decidim/meetings/create_answer.rb +52 -0
  27. data/app/commands/decidim/meetings/create_meeting.rb +3 -1
  28. data/app/commands/decidim/meetings/join_meeting.rb +2 -1
  29. data/app/commands/decidim/meetings/update_meeting.rb +2 -1
  30. data/app/controllers/concerns/decidim/meetings/admin/filterable.rb +55 -0
  31. data/app/controllers/concerns/decidim/meetings/polls_resources.rb +29 -0
  32. data/app/controllers/decidim/meetings/admin/application_controller.rb +6 -2
  33. data/app/controllers/decidim/meetings/admin/invites_controller.rb +0 -2
  34. data/app/controllers/decidim/meetings/admin/meeting_closes_controller.rb +1 -1
  35. data/app/controllers/decidim/meetings/admin/meetings_controller.rb +46 -1
  36. data/app/controllers/decidim/meetings/admin/meetings_poll_controller.rb +107 -0
  37. data/app/controllers/decidim/meetings/calendars_controller.rb +8 -0
  38. data/app/controllers/decidim/meetings/live_events_controller.rb +29 -0
  39. data/app/controllers/decidim/meetings/meeting_closes_controller.rb +1 -1
  40. data/app/controllers/decidim/meetings/polls/answers_controller.rb +37 -0
  41. data/app/controllers/decidim/meetings/polls/questions_controller.rb +45 -0
  42. data/app/events/decidim/meetings/create_meeting_event.rb +16 -0
  43. data/app/forms/decidim/meetings/admin/answer_option_form.rb +24 -0
  44. data/app/forms/decidim/meetings/admin/close_meeting_form.rb +3 -1
  45. data/app/forms/decidim/meetings/admin/meeting_form.rb +12 -1
  46. data/app/forms/decidim/meetings/admin/question_form.rb +44 -0
  47. data/app/forms/decidim/meetings/admin/questionnaire_form.rb +19 -0
  48. data/app/forms/decidim/meetings/answer_choice_form.rb +14 -0
  49. data/app/forms/decidim/meetings/answer_form.rb +65 -0
  50. data/app/forms/decidim/meetings/close_meeting_form.rb +4 -0
  51. data/app/forms/decidim/meetings/join_meeting_form.rb +1 -0
  52. data/app/forms/decidim/meetings/meeting_form.rb +9 -0
  53. data/app/helpers/decidim/meetings/admin/filterable_helper.rb +13 -0
  54. data/app/helpers/decidim/meetings/application_helper.rb +3 -2
  55. data/app/helpers/decidim/meetings/map_helper.rb +1 -1
  56. data/app/helpers/decidim/meetings/meetings_helper.rb +21 -0
  57. data/app/models/decidim/meetings/answer.rb +48 -0
  58. data/app/models/decidim/meetings/answer_choice.rb +15 -0
  59. data/app/models/decidim/meetings/answer_option.rb +24 -0
  60. data/app/models/decidim/meetings/meeting.rb +88 -42
  61. data/app/models/decidim/meetings/poll.rb +19 -0
  62. data/app/models/decidim/meetings/question.rb +54 -0
  63. data/app/models/decidim/meetings/questionnaire.rb +23 -0
  64. data/app/models/decidim/meetings/registration.rb +2 -0
  65. data/app/packs/entrypoints/decidim_meetings.js +6 -0
  66. data/app/packs/entrypoints/decidim_meetings_admin.js +5 -0
  67. data/app/{assets/images/decidim/gamification/badges/attended_meetings.svg → packs/images/decidim/gamification/badges/decidim_gamification_badges_attended_meetings.svg} +0 -0
  68. data/app/{assets/images/decidim/meetings/icon.svg → packs/images/decidim/meetings/decidim_meetings.svg} +0 -0
  69. data/app/packs/src/decidim/meetings/admin/agendas.js +159 -0
  70. data/app/{assets/javascripts/decidim/meetings/admin/destroy_meeting_alert.js.es6 → packs/src/decidim/meetings/admin/destroy_meeting_alert.js} +0 -0
  71. data/app/{assets/javascripts/decidim/meetings/admin/meetings_form.js.es6 → packs/src/decidim/meetings/admin/meetings_form.js} +7 -4
  72. data/app/{assets/javascripts/decidim/meetings/admin/registrations_form.js.es6 → packs/src/decidim/meetings/admin/registrations_form.js} +0 -0
  73. data/app/{assets/javascripts/decidim/meetings/admin/registrations_invite_form.es6 → packs/src/decidim/meetings/admin/registrations_invite_form.js} +3 -3
  74. data/app/packs/src/decidim/meetings/meetings_form.js +54 -0
  75. data/app/packs/src/decidim/meetings/meetings_polls.js +41 -0
  76. data/app/packs/src/decidim/meetings/poll.component.js +166 -0
  77. data/app/packs/stylesheets/decidim/meetings/_header.scss +52 -0
  78. data/app/packs/stylesheets/decidim/meetings/_main.scss +178 -0
  79. data/app/packs/stylesheets/decidim/meetings/_meetings.scss +2 -0
  80. data/app/permissions/decidim/meetings/admin/permissions.rb +16 -8
  81. data/app/permissions/decidim/meetings/permissions.rb +42 -17
  82. data/app/presenters/decidim/meetings/admin_log/meeting_presenter.rb +5 -1
  83. data/app/presenters/decidim/meetings/meeting_presenter.rb +25 -25
  84. data/app/queries/decidim/meetings/filtered_meetings.rb +1 -1
  85. data/app/queries/decidim/meetings/metrics/meetings_metric_manage.rb +1 -1
  86. data/app/queries/decidim/meetings/questionnaire_user_answers.rb +29 -0
  87. data/app/serializers/decidim/meetings/data_portability_invite_serializer.rb +2 -1
  88. data/app/serializers/decidim/meetings/data_portability_registration_serializer.rb +2 -1
  89. data/app/serializers/decidim/meetings/registration_serializer.rb +3 -12
  90. data/app/services/decidim/meetings/calendar/component_calendar.rb +2 -2
  91. data/app/services/decidim/meetings/calendar/meeting_calendar.rb +33 -0
  92. data/app/services/decidim/meetings/calendar_renderer.rb +2 -0
  93. data/app/services/decidim/meetings/meeting_iframe_embedder.rb +86 -0
  94. data/app/services/decidim/meetings/meeting_search.rb +2 -2
  95. data/app/views/decidim/meetings/admin/agenda/_form.html.erb +1 -1
  96. data/app/views/decidim/meetings/admin/invite_join_meeting_mailer/invite.html.erb +4 -4
  97. data/app/views/decidim/meetings/admin/invites/_form.html.erb +1 -1
  98. data/app/views/decidim/meetings/admin/meeting_closes/_form.html.erb +16 -1
  99. data/app/views/decidim/meetings/admin/meeting_copies/_form.html.erb +1 -1
  100. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +16 -1
  101. data/app/views/decidim/meetings/admin/meetings/index.html.erb +39 -11
  102. data/app/views/decidim/meetings/admin/poll/_answer_option.html.erb +34 -0
  103. data/app/views/decidim/meetings/admin/poll/_answer_option_template.html.erb +7 -0
  104. data/app/views/decidim/meetings/admin/poll/_form.html.erb +63 -0
  105. data/app/views/decidim/meetings/admin/poll/_question.html.erb +96 -0
  106. data/app/views/decidim/meetings/admin/poll/edit.html.erb +9 -0
  107. data/app/views/decidim/meetings/admin/registrations/_form.html.erb +1 -1
  108. data/app/views/decidim/meetings/directory/meetings/index.html.erb +4 -4
  109. data/app/views/decidim/meetings/directory/meetings/index.js.erb +2 -0
  110. data/app/views/decidim/meetings/layouts/live_event.html.erb +50 -0
  111. data/app/views/decidim/meetings/live_events/show.html.erb +12 -0
  112. data/app/views/decidim/meetings/meeting_closes/_form.html.erb +8 -1
  113. data/app/views/decidim/meetings/meeting_closes/edit.html.erb +1 -1
  114. data/app/views/decidim/meetings/meetings/_calendar_modal.html.erb +26 -0
  115. data/app/views/decidim/meetings/meetings/_filters.html.erb +1 -1
  116. data/app/views/decidim/meetings/meetings/_form.html.erb +6 -1
  117. data/app/views/decidim/meetings/meetings/_linked_meetings.html.erb +1 -1
  118. data/app/views/decidim/meetings/meetings/_meeting_minutes.html.erb +7 -18
  119. data/app/views/decidim/meetings/meetings/edit.html.erb +1 -1
  120. data/app/views/decidim/meetings/meetings/index.html.erb +4 -4
  121. data/app/views/decidim/meetings/meetings/index.js.erb +1 -1
  122. data/app/views/decidim/meetings/meetings/new.html.erb +1 -1
  123. data/app/views/decidim/meetings/meetings/show.html.erb +13 -14
  124. data/app/views/decidim/meetings/polls/answers/_multiple_option.html.erb +13 -0
  125. data/app/views/decidim/meetings/polls/answers/_single_option.html.erb +19 -0
  126. data/app/views/decidim/meetings/polls/answers/create.js.erb +5 -0
  127. data/app/views/decidim/meetings/polls/questions/_closed_question.html.erb +7 -0
  128. data/app/views/decidim/meetings/polls/questions/_index.html.erb +5 -0
  129. data/app/views/decidim/meetings/polls/questions/_index_admin.html.erb +43 -0
  130. data/app/views/decidim/meetings/polls/questions/_published_question.html.erb +29 -0
  131. data/app/views/decidim/meetings/polls/questions/_question.html.erb +7 -0
  132. data/app/views/decidim/meetings/polls/questions/index.js.erb +5 -0
  133. data/app/views/decidim/meetings/polls/questions/index_admin.js.erb +5 -0
  134. data/app/views/decidim/meetings/registration_mailer/confirmation.html.erb +5 -2
  135. data/app/views/devise/mailer/join_meeting.html.erb +6 -6
  136. data/config/assets.rb +11 -0
  137. data/config/locales/ar.yml +3 -24
  138. data/config/locales/ca.yml +36 -27
  139. data/config/locales/cs.yml +74 -28
  140. data/config/locales/de.yml +22 -27
  141. data/config/locales/el.yml +3 -24
  142. data/config/locales/en.yml +112 -26
  143. data/config/locales/es-MX.yml +13 -27
  144. data/config/locales/es-PY.yml +13 -27
  145. data/config/locales/es.yml +13 -27
  146. data/config/locales/eu.yml +3 -24
  147. data/config/locales/fi-plain.yml +70 -26
  148. data/config/locales/fi.yml +72 -28
  149. data/config/locales/fr-CA.yml +19 -26
  150. data/config/locales/fr-LU.yml +534 -0
  151. data/config/locales/fr.yml +19 -26
  152. data/config/locales/gl.yml +46 -24
  153. data/config/locales/hu.yml +5 -24
  154. data/config/locales/id-ID.yml +3 -24
  155. data/config/locales/is-IS.yml +2 -22
  156. data/config/locales/it.yml +117 -23
  157. data/config/locales/ja.yml +148 -58
  158. data/config/locales/lb-LU.yml +1 -0
  159. data/config/locales/lv.yml +3 -24
  160. data/config/locales/nl.yml +70 -25
  161. data/config/locales/no.yml +5 -26
  162. data/config/locales/pl.yml +27 -38
  163. data/config/locales/pt-BR.yml +178 -23
  164. data/config/locales/pt.yml +3 -24
  165. data/config/locales/ro-RO.yml +38 -27
  166. data/config/locales/ru.yml +3 -24
  167. data/config/locales/sk.yml +3 -24
  168. data/config/locales/sv.yml +36 -27
  169. data/config/locales/tr-TR.yml +5 -27
  170. data/config/locales/uk.yml +3 -24
  171. data/config/locales/zh-CN.yml +3 -24
  172. data/db/migrate/20210217124802_add_registration_custom_content_to_meetings.rb +8 -0
  173. data/db/migrate/20210413050756_add_published_at_to_meetings.rb +7 -0
  174. data/db/migrate/20210413050917_update_published_at_to_existing_meetings.rb +20 -0
  175. data/db/migrate/20210430123416_add_public_participation_to_decidim_meetings_registrations.rb +7 -0
  176. data/db/migrate/20210506180226_merge_meetings_minutes_into_meetings_table.rb +48 -0
  177. data/db/migrate/20210512055802_create_decidim_meetings_polls.rb +10 -0
  178. data/db/migrate/20210512100333_drop_decidim_meetings_minutes_table.rb +77 -0
  179. data/db/migrate/20210518133236_merge_minutes_with_closing_report_in_meetings_table.rb +57 -0
  180. data/db/migrate/20210520084247_create_decidim_meetings_questionnaires.rb +11 -0
  181. data/db/migrate/20210520084253_create_decidim_meetings_questions.rb +15 -0
  182. data/db/migrate/20210520084321_create_decidim_meetings_answers.rb +13 -0
  183. data/db/migrate/20210520084330_create_decidim_meetings_answer_options.rb +10 -0
  184. data/db/migrate/20210520084337_create_decidim_meetings_answer_choices.rb +13 -0
  185. data/db/migrate/20210520134834_add_status_to_meetings_questions.rb +7 -0
  186. data/db/migrate/20210602040614_add_setting_embed_iframe_to_meetings.rb +7 -0
  187. data/lib/decidim/api/linked_resources_interface.rb +8 -1
  188. data/lib/decidim/api/meeting_type.rb +19 -4
  189. data/lib/decidim/api/meetings_type.rb +2 -2
  190. data/lib/decidim/meetings/admin_engine.rb +5 -1
  191. data/lib/decidim/meetings/api.rb +0 -1
  192. data/lib/decidim/meetings/component.rb +41 -6
  193. data/lib/decidim/meetings/data_portability_user_answers_serializer.rb +33 -0
  194. data/lib/decidim/meetings/engine.rb +10 -11
  195. data/lib/decidim/meetings/meeting_serializer.rb +1 -0
  196. data/lib/decidim/meetings/polls.rb +10 -0
  197. data/lib/decidim/meetings/test/factories.rb +85 -9
  198. data/lib/decidim/meetings/user_answers_serializer.rb +47 -0
  199. data/lib/decidim/meetings/version.rb +1 -1
  200. data/lib/decidim/meetings.rb +10 -0
  201. metadata +103 -113
  202. data/app/assets/config/decidim_meetings_manifest.js +0 -9
  203. data/app/assets/javascripts/decidim/meetings/admin/agendas.js.es6 +0 -158
  204. data/app/assets/javascripts/decidim/meetings/meetings_form.js.es6 +0 -54
  205. data/app/commands/decidim/meetings/admin/create_minutes.rb +0 -55
  206. data/app/commands/decidim/meetings/admin/update_minutes.rb +0 -63
  207. data/app/controllers/decidim/meetings/admin/minutes_controller.rb +0 -69
  208. data/app/forms/decidim/meetings/admin/minutes_form.rb +0 -20
  209. data/app/models/decidim/meetings/minutes.rb +0 -22
  210. data/app/presenters/decidim/meetings/admin_log/minutes_presenter.rb +0 -42
  211. data/app/views/decidim/meetings/admin/minutes/_form.html.erb +0 -23
  212. data/app/views/decidim/meetings/admin/minutes/edit.html.erb +0 -7
  213. data/app/views/decidim/meetings/admin/minutes/new.html.erb +0 -7
  214. data/app/views/decidim/meetings/meetings/_online_meeting_link.html.erb +0 -11
  215. data/config/locales/ja-JP.yml +0 -494
  216. data/lib/decidim/api/minutes_type.rb +0 -20
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateDecidimMeetingsQuestionnaires < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :decidim_meetings_questionnaires do |t|
6
+ t.references :questionnaire_for, polymorphic: true, index: { name: "index_decidim_meetings_questionnaires_questionnaire_for" }
7
+
8
+ t.timestamps
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateDecidimMeetingsQuestions < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :decidim_meetings_questions do |t|
6
+ t.references :decidim_questionnaire, index: true
7
+ t.integer :position, index: true
8
+ t.string :question_type
9
+ t.jsonb :body
10
+ t.integer :max_choices
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateDecidimMeetingsAnswers < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :decidim_meetings_answers do |t|
6
+ t.references :decidim_user, index: true
7
+ t.references :decidim_questionnaire, index: true
8
+ t.references :decidim_question, index: { name: "index_decidim_meetings_answers_question_id" }
9
+
10
+ t.timestamps
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateDecidimMeetingsAnswerOptions < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :decidim_meetings_answer_options do |t|
6
+ t.references :decidim_question, index: { name: "index_decidim_meetings_answer_options_question_id" }
7
+ t.jsonb :body
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ class CreateDecidimMeetingsAnswerChoices < ActiveRecord::Migration[6.0]
4
+ def change
5
+ create_table :decidim_meetings_answer_choices do |t|
6
+ t.references :decidim_answer, index: { name: "index_decidim_meetings_answer_choices_answer_id" }
7
+ t.references :decidim_answer_option, index: { name: "index_decidim_meetings_answer_choices_answer_option_id" }
8
+ t.integer :position
9
+ t.jsonb :body
10
+ t.text :custom_body
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddStatusToMeetingsQuestions < ActiveRecord::Migration[6.0]
4
+ def change
5
+ add_column :decidim_meetings_questions, :status, :integer, default: 0, index: true
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddSettingEmbedIframeToMeetings < ActiveRecord::Migration[6.0]
4
+ def change
5
+ add_column :decidim_meetings_meetings, :show_embedded_iframe, :boolean, default: false
6
+ end
7
+ end
@@ -8,7 +8,14 @@ module Decidim
8
8
  graphql_name "MeetinsLinkedResourcewInterface"
9
9
  description "An interface that can be used with Resourceable models."
10
10
 
11
- field :proposals_from_meeting, [Decidim::Proposals::ProposalType, { null: true }], "Proposals created in this meeting", null: false
11
+ if Decidim::Meetings.enable_proposal_linking
12
+ field(
13
+ :proposals_from_meeting,
14
+ [Decidim::Proposals::ProposalType, { null: true }],
15
+ "Proposals created in this meeting",
16
+ null: false
17
+ )
18
+ end
12
19
 
13
20
  def proposals_from_meeting
14
21
  object.linked_resources(:proposals, :proposals_from_meeting)
@@ -29,14 +29,28 @@ module Decidim
29
29
 
30
30
  field :closed, GraphQL::Types::Boolean, "Whether this meeting is closed or not.", method: :closed?, null: false
31
31
  field :closing_report, Decidim::Core::TranslatedFieldType, "The closing report of this meeting.", null: true
32
+ field :video_url, GraphQL::Types::String, "URL for the video of the session, if any", null: true
33
+ field :audio_url, GraphQL::Types::String, "URL for the audio of the session, if any", null: true
34
+
35
+ def closing_report
36
+ object.closing_report if object.closing_visible?
37
+ end
38
+
39
+ def video_url
40
+ object.video_url if object.closing_visible?
41
+ end
42
+
43
+ def audio_url
44
+ object.audio_url if object.closing_visible?
45
+ end
46
+
47
+ field :created_at, Decidim::Core::DateTimeType, description: "The date and time this minutes was created", null: true
48
+ field :updated_at, Decidim::Core::DateTimeType, description: "The date and time this minutes was updated", null: true
49
+
32
50
  field :attending_organizations, GraphQL::Types::String, "list of attending organizations", null: true
33
51
  field :attendee_count, GraphQL::Types::Int, "Amount of attendees to this meeting", method: :attendees_count, null: true
34
52
  field :contribution_count, GraphQL::Types::Int, "Amount of contributions to this meeting", method: :contributions_count, null: true
35
- field :minutes, Decidim::Meetings::MinutesType, "Minutes for this meeting, if available", null: true
36
53
 
37
- def minutes
38
- object.minutes if object.minutes&.visible?
39
- end
40
54
  field :private_meeting, GraphQL::Types::Boolean, "Whether the meeting is private or not (it can only be true if transparent)", null: false
41
55
  field :transparent, GraphQL::Types::Boolean, "For private meetings, information is public if transparent", null: false
42
56
  field :registrations_enabled, GraphQL::Types::Boolean, "Whether the registrations are enabled or not", null: false
@@ -58,6 +72,7 @@ module Decidim
58
72
  end
59
73
  field :type_of_meeting, GraphQL::Types::String, "The type of the meeting (online or in-person)", null: false
60
74
  field :online_meeting_url, GraphQL::Types::String, "The URL of the meeting (when the type is online)", null: false
75
+ field :show_embedded_iframe, GraphQL::Types::Boolean, "Whether show or not the iframe", null: false
61
76
  end
62
77
  end
63
78
  end
@@ -11,7 +11,7 @@ module Decidim
11
11
  field :meetings, Decidim::Meetings::MeetingType.connection_type, null: true, connection: true
12
12
 
13
13
  def meetings
14
- Meeting.visible.where(component: object).includes(:component)
14
+ Meeting.published.visible.where(component: object).includes(:component)
15
15
  end
16
16
 
17
17
  field :meeting, Decidim::Meetings::MeetingType, null: true do
@@ -19,7 +19,7 @@ module Decidim
19
19
  end
20
20
 
21
21
  def meeting(**args)
22
- Meeting.visible.where(component: object).find_by(id: args[:id])
22
+ Meeting.published.visible.where(component: object).find_by(id: args[:id])
23
23
  end
24
24
  end
25
25
  end
@@ -15,6 +15,10 @@ module Decidim
15
15
  get "/answer_options", to: "registration_form#answer_options", as: :answer_options_meeting
16
16
 
17
17
  resources :meetings do
18
+ member do
19
+ put :publish
20
+ put :unpublish
21
+ end
18
22
  resources :meeting_closes, only: [:edit, :update] do
19
23
  get :proposals_picker, on: :collection
20
24
  end
@@ -30,7 +34,7 @@ module Decidim
30
34
  resources :attachment_collections
31
35
  resources :attachments
32
36
  resources :copies, controller: "meeting_copies", only: [:new, :create]
33
- resources :minutes, except: [:show, :index]
37
+ resource :poll, only: [:edit, :update], controller: "meetings_poll"
34
38
  end
35
39
  root to: "meetings#index"
36
40
  end
@@ -6,7 +6,6 @@ module Decidim
6
6
  autoload :AgendaType, "decidim/api/agenda_type"
7
7
  autoload :MeetingType, "decidim/api/meeting_type"
8
8
  autoload :MeetingsType, "decidim/api/meetings_type"
9
- autoload :MinutesType, "decidim/api/minutes_type"
10
9
  autoload :ServiceType, "decidim/api/service_type"
11
10
  autoload :LinkedResourcesInterface, "decidim/api/linked_resources_interface"
12
11
  autoload :ServicesInterface, "decidim/api/services_interface"
@@ -5,7 +5,7 @@ require "decidim/components/namer"
5
5
  Decidim.register_component(:meetings) do |component|
6
6
  component.engine = Decidim::Meetings::Engine
7
7
  component.admin_engine = Decidim::Meetings::AdminEngine
8
- component.icon = "decidim/meetings/icon.svg"
8
+ component.icon = "media/images/decidim_meetings.svg"
9
9
  component.permissions_class_name = "Decidim::Meetings::Permissions"
10
10
 
11
11
  component.query_type = "Decidim::Meetings::MeetingsType"
@@ -20,7 +20,7 @@ Decidim.register_component(:meetings) do |component|
20
20
  resource.template = "decidim/meetings/meetings/linked_meetings"
21
21
  resource.card = "decidim/meetings/meeting"
22
22
  resource.reported_content_cell = "decidim/meetings/reported_content"
23
- resource.actions = %w(join)
23
+ resource.actions = %w(join comment)
24
24
  resource.searchable = true
25
25
  end
26
26
 
@@ -34,9 +34,15 @@ Decidim.register_component(:meetings) do |component|
34
34
  Decidim::Follow.where(decidim_followable_type: "Decidim::Meetings::Meeting", decidim_followable_id: meetings_ids).count
35
35
  end
36
36
 
37
+ component.register_stat :comments_count, tag: :comments do |components, start_at, end_at|
38
+ meetings = Decidim::Meetings::FilteredMeetings.for(components, start_at, end_at).not_hidden
39
+ meetings.sum(:comments_count)
40
+ end
41
+
37
42
  component.exports :meetings do |exports|
38
43
  exports.collection do |component_instance|
39
44
  Decidim::Meetings::Meeting
45
+ .published
40
46
  .not_hidden
41
47
  .visible
42
48
  .where(component: component_instance)
@@ -60,7 +66,17 @@ Decidim.register_component(:meetings) do |component|
60
66
  exports.serializer Decidim::Comments::CommentSerializer
61
67
  end
62
68
 
63
- component.actions = %w(join)
69
+ component.exports :answers do |exports|
70
+ exports.collection do |_component, _user, resource_id|
71
+ Decidim::Meetings::QuestionnaireUserAnswers.for(resource_id)
72
+ end
73
+
74
+ exports.formats %w(CSV JSON Excel FormPDF)
75
+
76
+ exports.serializer Decidim::Meetings::UserAnswersSerializer
77
+ end
78
+
79
+ component.actions = %w(join comment)
64
80
 
65
81
  component.settings(:global) do |settings|
66
82
  settings.attribute :scopes_enabled, type: :boolean, default: false
@@ -73,6 +89,7 @@ Decidim.register_component(:meetings) do |component|
73
89
  settings.attribute :resources_permissions_enabled, type: :boolean, default: true
74
90
  settings.attribute :enable_pads_creation, type: :boolean, default: false
75
91
  settings.attribute :creation_enabled_for_participants, type: :boolean, default: false
92
+ settings.attribute :maps_enabled, type: :boolean, default: true
76
93
  end
77
94
 
78
95
  component.settings(:step) do |settings|
@@ -209,19 +226,37 @@ Decidim.register_component(:meetings) do |component|
209
226
  description: Decidim::Faker::Localized.sentence(word_count: 5),
210
227
  attachment_collection: attachment_collection,
211
228
  attached_to: meeting,
212
- file: File.new(File.join(__dir__, "seeds", "Exampledocument.pdf")) # Keep after attached_to
229
+ content_type: "application/pdf",
230
+ file: ActiveStorage::Blob.create_after_upload!(
231
+ io: File.open(File.join(__dir__, "seeds", "Exampledocument.pdf")),
232
+ filename: "Exampledocument.pdf",
233
+ content_type: "application/pdf",
234
+ metadata: nil
235
+ ) # Keep after attached_to
213
236
  )
214
237
  Decidim::Attachment.create!(
215
238
  title: Decidim::Faker::Localized.sentence(word_count: 2),
216
239
  description: Decidim::Faker::Localized.sentence(word_count: 5),
217
240
  attached_to: meeting,
218
- file: File.new(File.join(__dir__, "seeds", "city.jpeg")) # Keep after attached_to
241
+ content_type: "image/jpeg",
242
+ file: ActiveStorage::Blob.create_after_upload!(
243
+ io: File.open(File.join(__dir__, "seeds", "city.jpeg")),
244
+ filename: "city.jpeg",
245
+ content_type: "image/jpeg",
246
+ metadata: nil
247
+ ) # Keep after attached_to
219
248
  )
220
249
  Decidim::Attachment.create!(
221
250
  title: Decidim::Faker::Localized.sentence(word_count: 2),
222
251
  description: Decidim::Faker::Localized.sentence(word_count: 5),
223
252
  attached_to: meeting,
224
- file: File.new(File.join(__dir__, "seeds", "Exampledocument.pdf")) # Keep after attached_to
253
+ content_type: "application/pdf",
254
+ file: ActiveStorage::Blob.create_after_upload!(
255
+ io: File.open(File.join(__dir__, "seeds", "Exampledocument.pdf")),
256
+ filename: "Exampledocument.pdf",
257
+ content_type: "application/pdf",
258
+ metadata: nil
259
+ ) # Keep after attached_to
225
260
  )
226
261
  end
227
262
 
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ class DataPortabilityUserAnswersSerializer < Decidim::Exporters::Serializer
6
+ include Decidim::TranslationsHelper
7
+ # Serializes an user answer for data portability
8
+ def serialize
9
+ {
10
+ id: resource.id,
11
+ user: {
12
+ name: resource.user.name,
13
+ email: resource.user.email
14
+ },
15
+ questionnaire: {
16
+ id: resource.question.questionnaire.id
17
+ },
18
+ question: {
19
+ id: resource.question.id,
20
+ body: translated_attribute(resource.question.body)
21
+ },
22
+ answer: normalize_body(resource)
23
+ }
24
+ end
25
+
26
+ private
27
+
28
+ def normalize_body(resource)
29
+ resource.choices.pluck(:body)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,12 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "searchlight"
4
- require "kaminari"
5
- require "jquery-tmpl-rails"
6
3
  require "icalendar"
7
- require "cells/rails"
8
- require "cells-erb"
9
- require "cell/partial"
4
+
5
+ require "decidim/core"
10
6
 
11
7
  module Decidim
12
8
  module Meetings
@@ -31,9 +27,16 @@ module Decidim
31
27
  end
32
28
  resources :versions, only: [:show, :index]
33
29
  resource :widget, only: :show, path: "embed"
30
+ resource :live_event, only: :show
31
+ namespace :polls do
32
+ resources :questions, only: [:index, :update]
33
+ resources :answers, only: [:index, :create]
34
+ end
34
35
  end
35
36
  root to: "meetings#index"
36
- resource :calendar, only: [:show], format: :text
37
+ resource :calendar, only: [:show], format: :text do
38
+ resources :meetings, only: [:show], controller: :calendars, action: :meeting_calendar
39
+ end
37
40
  end
38
41
 
39
42
  initializer "decidim_meetings.view_hooks" do
@@ -103,10 +106,6 @@ module Decidim
103
106
  metric_operation.manager_class = "Decidim::Meetings::Metrics::MeetingFollowersMetricMeasure"
104
107
  end
105
108
  end
106
-
107
- initializer "decidim_meetings.assets" do |app|
108
- app.config.assets.precompile += %w(decidim_meetings_manifest.js)
109
- end
110
109
  end
111
110
  end
112
111
  end
@@ -52,6 +52,7 @@ module Decidim
52
52
  private
53
53
 
54
54
  attr_reader :meeting
55
+ alias resource meeting
55
56
 
56
57
  def component
57
58
  meeting.component
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This module contains all the domain logic associated to Decidim's Meetings
6
+ # associated poll.
7
+ module Polls
8
+ end
9
+ end
10
+ end
@@ -3,7 +3,6 @@
3
3
  require "decidim/core/test/factories"
4
4
  require "decidim/forms/test/factories"
5
5
  require "decidim/participatory_processes/test/factories"
6
- require "decidim/assemblies/test/factories"
7
6
 
8
7
  FactoryBot.define do
9
8
  factory :meeting_component, parent: :component do
@@ -38,11 +37,20 @@ FactoryBot.define do
38
37
  registration_type { :on_this_platform }
39
38
  type_of_meeting { :in_person }
40
39
  component { build(:component, manifest_name: "meetings") }
40
+ show_embedded_iframe { false }
41
41
 
42
42
  author do
43
43
  component.try(:organization)
44
44
  end
45
45
 
46
+ trait :published do
47
+ published_at { Time.current }
48
+ end
49
+
50
+ trait :in_person do
51
+ type_of_meeting { :in_person }
52
+ end
53
+
46
54
  trait :online do
47
55
  type_of_meeting { :online }
48
56
  online_meeting_url { "https://decidim.org" }
@@ -88,6 +96,14 @@ FactoryBot.define do
88
96
  contributions_count { rand(50) }
89
97
  attending_organizations { Array.new(3) { Faker::TvShows::GameOfThrones.house }.join(", ") }
90
98
  closed_at { Time.current }
99
+ closing_visible { true }
100
+ end
101
+
102
+ trait :closed_with_minutes do
103
+ closed
104
+ video_url { Faker::Internet.url }
105
+ audio_url { Faker::Internet.url }
106
+ closing_visible { true }
91
107
  end
92
108
 
93
109
  trait :with_registrations_enabled do
@@ -105,6 +121,23 @@ FactoryBot.define do
105
121
  trait :upcoming do
106
122
  start_time { Faker::Time.between(from: 1.day.from_now, to: 10.days.from_now) }
107
123
  end
124
+
125
+ trait :live do
126
+ start_time { 1.day.ago }
127
+ end_time { 1.day.from_now }
128
+ end
129
+
130
+ trait :embeddable do
131
+ online_meeting_url { "https://www.youtube.com/watch?v=pj_2G3x6-Zk" }
132
+ end
133
+
134
+ factory :published_meeting do
135
+ published_at { Time.current }
136
+ end
137
+
138
+ trait :show_embedded_iframe do
139
+ show_embedded_iframe { true }
140
+ end
108
141
  end
109
142
 
110
143
  factory :registration, class: "Decidim::Meetings::Registration" do
@@ -142,14 +175,6 @@ FactoryBot.define do
142
175
  end
143
176
  end
144
177
 
145
- factory :minutes, class: "Decidim::Meetings::Minutes" do
146
- description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
147
- video_url { Faker::Internet.url }
148
- audio_url { Faker::Internet.url }
149
- visible { true }
150
- meeting
151
- end
152
-
153
178
  factory :invite, class: "Decidim::Meetings::Invite" do
154
179
  meeting
155
180
  user
@@ -171,4 +196,55 @@ FactoryBot.define do
171
196
  title { generate_localized_title }
172
197
  description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
173
198
  end
199
+
200
+ factory :poll, class: "Decidim::Meetings::Poll" do
201
+ meeting
202
+ end
203
+
204
+ factory :meetings_poll_questionnaire, class: "Decidim::Meetings::Questionnaire" do
205
+ questionnaire_for { build(:poll) }
206
+ end
207
+
208
+ factory :meetings_poll_question, class: "Decidim::Meetings::Question" do
209
+ transient do
210
+ options { [] }
211
+ end
212
+
213
+ body { generate_localized_title }
214
+ position { 0 }
215
+ status { 0 }
216
+ question_type { Decidim::Meetings::Question::QUESTION_TYPES.first }
217
+ questionnaire factory: :meetings_poll_questionnaire
218
+ answer_options do
219
+ Array.new(3).collect { build(:meetings_poll_answer_option, question: nil) }
220
+ end
221
+
222
+ trait :unpublished do
223
+ status { 0 }
224
+ end
225
+
226
+ trait :published do
227
+ status { 1 }
228
+ end
229
+
230
+ trait :closed do
231
+ status { 2 }
232
+ end
233
+ end
234
+
235
+ factory :meetings_poll_answer, class: "Decidim::Meetings::Answer" do
236
+ questionnaire factory: :meetings_poll_questionnaire
237
+ question { create(:meetings_poll_question, questionnaire: questionnaire) }
238
+ user { create(:user, organization: questionnaire.questionnaire_for.organization) }
239
+ end
240
+
241
+ factory :meetings_poll_answer_option, class: "Decidim::Meetings::AnswerOption" do
242
+ question { create(:meetings_poll_question) }
243
+ body { generate_localized_title }
244
+ end
245
+
246
+ factory :meetings_poll_answer_choice, class: "Decidim::Meetings::AnswerChoice" do
247
+ answer factory: :meetings_poll_answer
248
+ answer_option { create(:meetings_poll_answer_option, question: answer.question) }
249
+ end
174
250
  end