decidim-meetings 0.23.3 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) 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 +9 -5
  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 +52 -1
  39. data/app/permissions/decidim/meetings/permissions.rb +12 -2
  40. data/app/presenters/decidim/meetings/meeting_presenter.rb +33 -0
  41. data/app/services/decidim/meetings/meeting_search.rb +20 -0
  42. data/app/views/decidim/meetings/admin/invite_join_meeting_mailer/invite.html.erb +1 -1
  43. data/app/views/decidim/meetings/admin/invites/index.html.erb +1 -1
  44. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +31 -1
  45. data/app/views/decidim/meetings/admin/meetings/edit.html.erb +2 -2
  46. data/app/views/decidim/meetings/admin/meetings/index.html.erb +23 -1
  47. data/app/views/decidim/meetings/admin/meetings/new.html.erb +2 -2
  48. data/app/views/decidim/meetings/admin/minutes/edit.html.erb +1 -1
  49. data/app/views/decidim/meetings/admin/registrations/edit.html.erb +20 -18
  50. data/app/views/decidim/meetings/directory/meetings/index.html.erb +1 -0
  51. data/app/views/decidim/meetings/directory/meetings/index.js.erb +0 -3
  52. data/app/views/decidim/meetings/meeting_closes/_form.html.erb +7 -0
  53. data/app/views/decidim/meetings/meeting_closes/edit.html.erb +25 -0
  54. data/app/views/decidim/meetings/meeting_closes/proposals_picker.html.erb +1 -0
  55. data/app/views/decidim/meetings/meetings/_filters.html.erb +6 -0
  56. data/app/views/decidim/meetings/meetings/_form.html.erb +36 -2
  57. data/app/views/decidim/meetings/meetings/_online_meeting_link.html.erb +11 -0
  58. data/app/views/decidim/meetings/meetings/edit.html.erb +1 -1
  59. data/app/views/decidim/meetings/meetings/index.js.erb +0 -3
  60. data/app/views/decidim/meetings/meetings/new.html.erb +1 -1
  61. data/app/views/decidim/meetings/meetings/show.html.erb +25 -21
  62. data/app/views/decidim/meetings/registration_mailer/confirmation.html.erb +3 -1
  63. data/app/views/decidim/participatory_spaces/_upcoming_meeting_for_card.html.erb +1 -1
  64. data/config/locales/ar.yml +0 -7
  65. data/config/locales/ca.yml +8 -9
  66. data/config/locales/cs.yml +47 -9
  67. data/config/locales/de.yml +45 -7
  68. data/config/locales/el.yml +0 -10
  69. data/config/locales/en.yml +47 -9
  70. data/config/locales/es-MX.yml +18 -9
  71. data/config/locales/es-PY.yml +18 -9
  72. data/config/locales/es.yml +18 -9
  73. data/config/locales/eu.yml +0 -7
  74. data/config/locales/fi-plain.yml +45 -7
  75. data/config/locales/fi.yml +45 -7
  76. data/config/locales/fr-CA.yml +47 -9
  77. data/config/locales/fr.yml +47 -9
  78. data/config/locales/gl.yml +0 -11
  79. data/config/locales/hu.yml +0 -10
  80. data/config/locales/id-ID.yml +0 -7
  81. data/config/locales/is-IS.yml +0 -6
  82. data/config/locales/it.yml +0 -9
  83. data/config/locales/ja.yml +0 -9
  84. data/config/locales/lv.yml +0 -10
  85. data/config/locales/nl.yml +43 -8
  86. data/config/locales/no.yml +11 -10
  87. data/config/locales/pl.yml +40 -13
  88. data/config/locales/pt-BR.yml +0 -7
  89. data/config/locales/pt.yml +0 -9
  90. data/config/locales/ro-RO.yml +0 -9
  91. data/config/locales/ru.yml +0 -7
  92. data/config/locales/sk.yml +0 -10
  93. data/config/locales/sl.yml +0 -4
  94. data/config/locales/sv.yml +11 -9
  95. data/config/locales/tr-TR.yml +44 -9
  96. data/config/locales/uk.yml +0 -6
  97. data/config/locales/zh-CN.yml +0 -9
  98. data/db/migrate/20180809134748_add_upcoming_events_as_content_block.rb +1 -1
  99. data/db/migrate/20201006140511_add_online_meeting_url.rb +7 -0
  100. data/db/migrate/20201009124057_add_type_of_meeting.rb +7 -0
  101. data/db/migrate/20201016112641_add_registration_type_and_url_to_meetings.rb +19 -0
  102. data/lib/decidim/api/agenda_item_type.rb +22 -0
  103. data/lib/decidim/api/agenda_type.rb +19 -0
  104. data/lib/decidim/api/linked_resources_interface.rb +7 -6
  105. data/lib/decidim/api/meeting_type.rb +63 -0
  106. data/lib/decidim/api/meetings_type.rb +26 -0
  107. data/lib/decidim/api/minutes_type.rb +20 -0
  108. data/{app/types/decidim/meetings → lib/decidim/api}/service_type.rb +4 -4
  109. data/lib/decidim/api/services_interface.rb +3 -3
  110. data/lib/decidim/meetings.rb +1 -1
  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. metadata +43 -40
  117. data/app/types/decidim/meetings/agenda_item_type.rb +0 -28
  118. data/app/types/decidim/meetings/agenda_type.rb +0 -25
  119. data/app/types/decidim/meetings/meeting_type.rb +0 -65
  120. data/app/types/decidim/meetings/meetings_type.rb +0 -32
  121. data/app/types/decidim/meetings/minutes_type.rb +0 -26
  122. data/app/views/decidim/participatory_processes/participatory_process_groups/_highlighted_meetings.html.erb +0 -15
  123. data/app/views/decidim/participatory_processes/participatory_process_groups/_meeting.html.erb +0 -10
@@ -11,7 +11,7 @@ class AddUpcomingEventsAsContentBlock < ActiveRecord::Migration[5.2]
11
11
 
12
12
  def change
13
13
  Organization.find_each do |organization|
14
- next if ContentBlock.where(decidim_organization_id: organization.id).where(manifest_name: "upcoming_events").exists?
14
+ next if ContentBlock.where(decidim_organization_id: organization.id).exists?(manifest_name: "upcoming_events")
15
15
 
16
16
  last_weight = ContentBlock.where(decidim_organization_id: organization.id).order("weight DESC").limit(1).pluck(:weight).last.to_i
17
17
 
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddOnlineMeetingUrl < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_meetings_meetings, :online_meeting_url, :string
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddTypeOfMeeting < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_column :decidim_meetings_meetings, :type_of_meeting, :string, default: "in_person"
6
+ end
7
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddRegistrationTypeAndUrlToMeetings < ActiveRecord::Migration[5.2]
4
+ class Meetings < ApplicationRecord
5
+ self.table_name = :decidim_meetings_meetings
6
+ include Decidim::HasComponent
7
+ end
8
+
9
+ def change
10
+ add_column :decidim_meetings_meetings, :registration_type, :string, null: false, default: "registration_disabled"
11
+ add_column :decidim_meetings_meetings, :registration_url, :string
12
+
13
+ Meetings.reset_column_information
14
+ Meetings.find_each do |meeting|
15
+ meeting.registration_type = "on_this_platform" if meeting.decidim_author_type == "Decidim::Organization"
16
+ meeting.save!
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ class AgendaItemType < Decidim::Api::Types::BaseObject
6
+ graphql_name "MeetingAgendaItem"
7
+ description "A meeting agenda item"
8
+
9
+ field :id, GraphQL::Types::ID, "The ID for this agenda item", null: false
10
+ field :title, Decidim::Core::TranslatedFieldType, "The title for this agenda item", null: true
11
+ field :description, Decidim::Core::TranslatedFieldType, "The description for this agenda item", null: true
12
+ field :items, [Decidim::Meetings::AgendaItemType, { null: true }], "Sub-items (children) of this agenda item", method: :agenda_item_children, null: false
13
+ field :parent, Decidim::Meetings::AgendaItemType, "Parent agenda item, if available", null: true
14
+ field :agenda, Decidim::Meetings::AgendaType, "Belonging agenda", null: true
15
+ field :duration, GraphQL::Types::Int, "Duration in number of minutes for this item in this agenda", null: false
16
+ field :position, GraphQL::Types::Int, "Order position for this agenda item", null: false
17
+
18
+ field :created_at, Decidim::Core::DateTimeType, description: "The date and time this agenda item was created", null: true
19
+ field :updated_at, Decidim::Core::DateTimeType, description: "The date and time this agenda item was updated", null: true
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ class AgendaType < Decidim::Api::Types::BaseObject
6
+ graphql_name "MeetingAgenda"
7
+ description "A meeting agenda"
8
+
9
+ field :id, GraphQL::Types::ID, "The ID for the agenda", null: false
10
+ field :title, Decidim::Core::TranslatedFieldType, "The title for the agenda", null: true
11
+ field :items, [Decidim::Meetings::AgendaItemType, { null: true }], "Items and sub-items of the agenda", method: :agenda_items, null: false
12
+ # probably useful in the future, when handling user permissions
13
+ # field :visible, !types.Boolean, "Whether this minutes is public or not", property: :visible
14
+
15
+ field :created_at, Decidim::Core::DateTimeType, description: "The date and time this agenda was created", null: true
16
+ field :updated_at, Decidim::Core::DateTimeType, description: "The date and time this agenda was updated", null: true
17
+ end
18
+ end
19
+ end
@@ -3,14 +3,15 @@
3
3
  module Decidim
4
4
  module Meetings
5
5
  # This interface represents all linked resources available in the module meetings
6
- LinkedResourcesInterface = GraphQL::InterfaceType.define do
7
- name "MeetinsLinkedResourcewInterface"
6
+ module LinkedResourcesInterface
7
+ include Decidim::Api::Types::BaseInterface
8
+ graphql_name "MeetinsLinkedResourcewInterface"
8
9
  description "An interface that can be used with Resourceable models."
9
10
 
10
- field :proposalsFromMeeting, !types[Decidim::Proposals::ProposalType], "Proposals created in this meeting" do
11
- resolve ->(meeting, _args, _ctx) {
12
- meeting.linked_resources(:proposals, :proposals_from_meeting)
13
- }
11
+ field :proposals_from_meeting, [Decidim::Proposals::ProposalType, { null: true }], "Proposals created in this meeting", null: false
12
+
13
+ def proposals_from_meeting
14
+ object.linked_resources(:proposals, :proposals_from_meeting)
14
15
  end
15
16
  end
16
17
  end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ class MeetingType < Decidim::Api::Types::BaseObject
6
+ description "A meeting"
7
+
8
+ implements Decidim::Comments::CommentableInterface
9
+ implements Decidim::Core::CategorizableInterface
10
+ implements Decidim::Core::ScopableInterface
11
+ implements Decidim::Core::AttachableInterface
12
+ implements Decidim::Core::TimestampsInterface
13
+ implements Decidim::Meetings::ServicesInterface
14
+ implements Decidim::Meetings::LinkedResourcesInterface
15
+ implements Decidim::Forms::QuestionnaireEntityInterface
16
+
17
+ field :id, GraphQL::Types::ID, "ID of this meeting", null: false
18
+ field :reference, GraphQL::Types::String, "Reference for this meeting", null: false
19
+ field :title, Decidim::Core::TranslatedFieldType, "The title of this meeting.", null: false
20
+ field :description, Decidim::Core::TranslatedFieldType, "The description of this meeting.", null: true
21
+ field :start_time, Decidim::Core::DateTimeType, "The time this meeting starts", null: false
22
+ field :end_time, Decidim::Core::DateTimeType, "The time this meeting ends", null: false
23
+ field :author, Decidim::Core::AuthorInterface, "If specified, the author of this meeting", null: true
24
+ field :agenda, Decidim::Meetings::AgendaType, "Agenda for this meeting, if available", null: true
25
+
26
+ def agenda
27
+ object.agenda if object.agenda&.visible?
28
+ end
29
+
30
+ field :closed, GraphQL::Types::Boolean, "Whether this meeting is closed or not.", method: :closed?, null: false
31
+ field :closing_report, Decidim::Core::TranslatedFieldType, "The closing report of this meeting.", null: true
32
+ field :attending_organizations, GraphQL::Types::String, "list of attending organizations", null: true
33
+ field :attendee_count, GraphQL::Types::Int, "Amount of attendees to this meeting", method: :attendees_count, null: true
34
+ 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
+
37
+ def minutes
38
+ object.minutes if object.minutes&.visible?
39
+ end
40
+ field :private_meeting, GraphQL::Types::Boolean, "Whether the meeting is private or not (it can only be true if transparent)", null: false
41
+ field :transparent, GraphQL::Types::Boolean, "For private meetings, information is public if transparent", null: false
42
+ field :registrations_enabled, GraphQL::Types::Boolean, "Whether the registrations are enabled or not", null: false
43
+ field :registration_terms, Decidim::Core::TranslatedFieldType, "The registration terms", null: true
44
+ field :remaining_slots, GraphQL::Types::Int, "Amount of slots available for this meeting", null: true
45
+ field :registration_form_enabled, GraphQL::Types::Boolean, "Whether the registrations have a form or not", null: false
46
+ field :registration_form, Decidim::Forms::QuestionnaireType, description: "If registration requires to fill a form, this is the questionnaire", null: true
47
+
48
+ def registration_form
49
+ object.questionnaire if object.registration_form_enabled?
50
+ end
51
+ field :location, Decidim::Core::TranslatedFieldType, "The location of this meeting (free format)", null: true
52
+ field :location_hints, Decidim::Core::TranslatedFieldType, "The location of this meeting (free format)", null: true
53
+ field :address, GraphQL::Types::String, "The physical address of this meeting (used for geolocation)", null: true
54
+ field :coordinates, Decidim::Core::CoordinatesType, "Physical coordinates for this meeting", null: true
55
+
56
+ def coordinates
57
+ [object.latitude, object.longitude]
58
+ end
59
+ field :type_of_meeting, GraphQL::Types::String, "The type of the meeting (online or in-person)", null: false
60
+ field :online_meeting_url, GraphQL::Types::String, "The URL of the meeting (when the type is online)", null: false
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ class MeetingsType < Decidim::Api::Types::BaseObject
6
+ implements Decidim::Core::ComponentInterface
7
+
8
+ graphql_name "Meetings"
9
+ description "A meetings component of a participatory space."
10
+
11
+ field :meetings, Decidim::Meetings::MeetingType.connection_type, null: true, connection: true
12
+
13
+ def meetings
14
+ Meeting.visible.where(component: object).includes(:component)
15
+ end
16
+
17
+ field :meeting, Decidim::Meetings::MeetingType, null: true do
18
+ argument :id, GraphQL::Types::ID, required: true
19
+ end
20
+
21
+ def meeting(**args)
22
+ Meeting.visible.where(component: object).find_by(id: args[:id])
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ class MinutesType < Decidim::Api::Types::BaseObject
6
+ description "A meeting minutes"
7
+
8
+ field :id, GraphQL::Types::ID, "The ID for the minutes", null: false
9
+ field :description, Decidim::Core::TranslatedFieldType, "The description for the minutes", null: true
10
+ field :video_url, GraphQL::Types::String, "URL for the video of the session, if any", null: true
11
+ field :audio_url, GraphQL::Types::String, "URL for the audio of the session, if any", null: true
12
+
13
+ # probably useful in the future, when handling user permissions
14
+ # field :visible, !types.Boolean, "Whether this minutes is public or not", property: :visible
15
+ #
16
+ field :created_at, Decidim::Core::DateTimeType, description: "The date and time this minutes was created", null: true
17
+ field :updated_at, Decidim::Core::DateTimeType, description: "The date and time this minutes was updated", null: true
18
+ end
19
+ end
20
+ end
@@ -2,12 +2,12 @@
2
2
 
3
3
  module Decidim
4
4
  module Meetings
5
- ServiceType = GraphQL::ObjectType.define do
6
- name "MeetingService"
5
+ class ServiceType < Decidim::Api::Types::BaseObject
6
+ graphql_name "MeetingService"
7
7
  description "A meeting service"
8
8
 
9
- field :title, Decidim::Core::TranslatedFieldType, "The title for the service"
10
- field :description, Decidim::Core::TranslatedFieldType, "The description for the service"
9
+ field :title, Decidim::Core::TranslatedFieldType, "The title for the service", null: true
10
+ field :description, Decidim::Core::TranslatedFieldType, "The description for the service", null: true
11
11
  end
12
12
  end
13
13
  end
@@ -3,11 +3,11 @@
3
3
  module Decidim
4
4
  module Meetings
5
5
  # This interface represents a categorizable object.
6
- ServicesInterface = GraphQL::InterfaceType.define do
7
- name "ServicesInterface"
6
+ module ServicesInterface
7
+ include Decidim::Api::Types::BaseInterface
8
8
  description "An interface that can be used with services."
9
9
 
10
- field :services, !types[ServiceType], "The object's services"
10
+ field :services, [Decidim::Meetings::ServiceType, { null: true }], "The object's services", null: false
11
11
  end
12
12
  end
13
13
  end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "decidim/meetings/admin"
4
+ require "decidim/meetings/api"
4
5
  require "decidim/meetings/engine"
5
6
  require "decidim/meetings/admin_engine"
6
7
  require "decidim/meetings/directory"
7
8
  require "decidim/meetings/directory_engine"
8
9
  require "decidim/meetings/component"
9
- require "decidim/meetings/api"
10
10
 
11
11
  module Decidim
12
12
  # Base module for this engine.
@@ -2,6 +2,12 @@
2
2
 
3
3
  module Decidim
4
4
  module Meetings
5
+ autoload :AgendaItemType, "decidim/api/agenda_item_type"
6
+ autoload :AgendaType, "decidim/api/agenda_type"
7
+ autoload :MeetingType, "decidim/api/meeting_type"
8
+ autoload :MeetingsType, "decidim/api/meetings_type"
9
+ autoload :MinutesType, "decidim/api/minutes_type"
10
+ autoload :ServiceType, "decidim/api/service_type"
5
11
  autoload :LinkedResourcesInterface, "decidim/api/linked_resources_interface"
6
12
  autoload :ServicesInterface, "decidim/api/services_interface"
7
13
  end
@@ -19,6 +19,7 @@ Decidim.register_component(:meetings) do |component|
19
19
  resource.model_class_name = "Decidim::Meetings::Meeting"
20
20
  resource.template = "decidim/meetings/meetings/linked_meetings"
21
21
  resource.card = "decidim/meetings/meeting"
22
+ resource.reported_content_cell = "decidim/meetings/reported_content"
22
23
  resource.actions = %w(join)
23
24
  resource.searchable = true
24
25
  end
@@ -47,6 +48,18 @@ Decidim.register_component(:meetings) do |component|
47
48
  exports.serializer Decidim::Meetings::MeetingSerializer
48
49
  end
49
50
 
51
+ component.exports :meeting_comments do |exports|
52
+ exports.collection do |component_instance|
53
+ Decidim::Comments::Export.comments_for_resource(
54
+ Decidim::Meetings::Meeting, component_instance
55
+ )
56
+ end
57
+
58
+ exports.include_in_open_data = true
59
+
60
+ exports.serializer Decidim::Comments::CommentSerializer
61
+ end
62
+
50
63
  component.actions = %w(join)
51
64
 
52
65
  component.settings(:global) do |settings|
@@ -56,6 +69,7 @@ Decidim.register_component(:meetings) do |component|
56
69
  settings.attribute :default_registration_terms, type: :text, translated: true, editor: true
57
70
  settings.attribute :comments_enabled, type: :boolean, default: true
58
71
  settings.attribute :comments_max_length, type: :integer, required: false
72
+ settings.attribute :registration_code_enabled, type: :boolean, default: true
59
73
  settings.attribute :resources_permissions_enabled, type: :boolean, default: true
60
74
  settings.attribute :enable_pads_creation, type: :boolean, default: false
61
75
  settings.attribute :creation_enabled_for_participants, type: :boolean, default: false
@@ -97,18 +111,19 @@ Decidim.register_component(:meetings) do |component|
97
111
  end
98
112
 
99
113
  2.times do
114
+ start_time = [rand(1..20).weeks.from_now, rand(1..20).weeks.ago].sample
100
115
  params = {
101
116
  component: component,
102
- scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
117
+ scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
103
118
  category: participatory_space.categories.sample,
104
- title: Decidim::Faker::Localized.sentence(2),
119
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
105
120
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
106
- Decidim::Faker::Localized.paragraph(3)
121
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
107
122
  end,
108
123
  location: Decidim::Faker::Localized.sentence,
109
124
  location_hints: Decidim::Faker::Localized.sentence,
110
- start_time: 3.weeks.from_now,
111
- end_time: 3.weeks.from_now + 4.hours,
125
+ start_time: start_time,
126
+ end_time: start_time + rand(1..4).hours,
112
127
  address: "#{Faker::Address.street_address} #{Faker::Address.zip} #{Faker::Address.city}",
113
128
  latitude: Faker::Address.latitude,
114
129
  longitude: Faker::Address.longitude,
@@ -116,10 +131,24 @@ Decidim.register_component(:meetings) do |component|
116
131
  available_slots: (10..50).step(10).to_a.sample,
117
132
  author: participatory_space.organization,
118
133
  registration_terms: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
119
- Decidim::Faker::Localized.paragraph(3)
134
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
120
135
  end
121
136
  }
122
137
 
138
+ _hybrid_meeting = Decidim.traceability.create!(
139
+ Decidim::Meetings::Meeting,
140
+ admin_user,
141
+ params.merge(type_of_meeting: :hybrid, online_meeting_url: "http://example.org"),
142
+ visibility: "all"
143
+ )
144
+
145
+ _online_meeting = Decidim.traceability.create!(
146
+ Decidim::Meetings::Meeting,
147
+ admin_user,
148
+ params.merge(type_of_meeting: :online, online_meeting_url: "http://example.org"),
149
+ visibility: "all"
150
+ )
151
+
123
152
  meeting = Decidim.traceability.create!(
124
153
  Decidim::Meetings::Meeting,
125
154
  admin_user,
@@ -130,18 +159,18 @@ Decidim.register_component(:meetings) do |component|
130
159
  2.times do
131
160
  Decidim::Meetings::Service.create!(
132
161
  meeting: meeting,
133
- title: Decidim::Faker::Localized.sentence(2),
134
- description: Decidim::Faker::Localized.sentence(5)
162
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
163
+ description: Decidim::Faker::Localized.sentence(word_count: 5)
135
164
  )
136
165
  end
137
166
 
138
167
  Decidim::Forms::Questionnaire.create!(
139
168
  title: Decidim::Faker::Localized.paragraph,
140
169
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
141
- Decidim::Faker::Localized.paragraph(3)
170
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
142
171
  end,
143
172
  tos: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
144
- Decidim::Faker::Localized.paragraph(2)
173
+ Decidim::Faker::Localized.paragraph(sentence_count: 2)
145
174
  end,
146
175
  questionnaire_for: meeting
147
176
  )
@@ -160,7 +189,7 @@ Decidim.register_component(:meetings) do |component|
160
189
  tos_agreement: "1",
161
190
  confirmed_at: Time.current,
162
191
  personal_url: Faker::Internet.url,
163
- about: Faker::Lorem.paragraph(2)
192
+ about: Faker::Lorem.paragraph(sentence_count: 2)
164
193
  )
165
194
 
166
195
  Decidim::Meetings::Registration.create!(
@@ -171,26 +200,26 @@ Decidim.register_component(:meetings) do |component|
171
200
 
172
201
  attachment_collection = Decidim::AttachmentCollection.create!(
173
202
  name: Decidim::Faker::Localized.word,
174
- description: Decidim::Faker::Localized.sentence(5),
203
+ description: Decidim::Faker::Localized.sentence(word_count: 5),
175
204
  collection_for: meeting
176
205
  )
177
206
 
178
207
  Decidim::Attachment.create!(
179
- title: Decidim::Faker::Localized.sentence(2),
180
- description: Decidim::Faker::Localized.sentence(5),
208
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
209
+ description: Decidim::Faker::Localized.sentence(word_count: 5),
181
210
  attachment_collection: attachment_collection,
182
211
  attached_to: meeting,
183
212
  file: File.new(File.join(__dir__, "seeds", "Exampledocument.pdf")) # Keep after attached_to
184
213
  )
185
214
  Decidim::Attachment.create!(
186
- title: Decidim::Faker::Localized.sentence(2),
187
- description: Decidim::Faker::Localized.sentence(5),
215
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
216
+ description: Decidim::Faker::Localized.sentence(word_count: 5),
188
217
  attached_to: meeting,
189
218
  file: File.new(File.join(__dir__, "seeds", "city.jpeg")) # Keep after attached_to
190
219
  )
191
220
  Decidim::Attachment.create!(
192
- title: Decidim::Faker::Localized.sentence(2),
193
- description: Decidim::Faker::Localized.sentence(5),
221
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
222
+ description: Decidim::Faker::Localized.sentence(word_count: 5),
194
223
  attached_to: meeting,
195
224
  file: File.new(File.join(__dir__, "seeds", "Exampledocument.pdf")) # Keep after attached_to
196
225
  )
@@ -209,18 +238,19 @@ Decidim.register_component(:meetings) do |component|
209
238
  author = user_group.users.sample
210
239
  end
211
240
 
241
+ start_time = [rand(1..20).weeks.from_now, rand(1..20).weeks.ago].sample
212
242
  params = {
213
243
  component: component,
214
- scope: Faker::Boolean.boolean(0.5) ? global : scopes.sample,
244
+ scope: Faker::Boolean.boolean(true_ratio: 0.5) ? global : scopes.sample,
215
245
  category: participatory_space.categories.sample,
216
- title: Decidim::Faker::Localized.sentence(2),
246
+ title: Decidim::Faker::Localized.sentence(word_count: 2),
217
247
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
218
- Decidim::Faker::Localized.paragraph(3)
248
+ Decidim::Faker::Localized.paragraph(sentence_count: 3)
219
249
  end,
220
250
  location: Decidim::Faker::Localized.sentence,
221
251
  location_hints: Decidim::Faker::Localized.sentence,
222
- start_time: 3.weeks.from_now,
223
- end_time: 3.weeks.from_now + 4.hours,
252
+ start_time: start_time,
253
+ end_time: start_time + rand(1..4).hours,
224
254
  address: "#{Faker::Address.street_address} #{Faker::Address.zip} #{Faker::Address.city}",
225
255
  latitude: Faker::Address.latitude,
226
256
  longitude: Faker::Address.longitude,