decidim-assemblies 0.27.8 → 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/assemblies/assemblies/show.erb +16 -0
- data/app/cells/decidim/assemblies/assemblies_cell.rb +24 -0
- data/app/cells/decidim/assemblies/assembly_cell.rb +7 -2
- data/app/cells/decidim/assemblies/assembly_dropdown_metadata_cell.rb +19 -0
- data/app/cells/decidim/assemblies/assembly_g_cell.rb +23 -0
- data/app/cells/decidim/assemblies/assembly_member/data.erb +19 -0
- data/app/cells/decidim/assemblies/assembly_member/name_and_position.erb +11 -0
- data/app/cells/decidim/assemblies/assembly_member/show.erb +8 -52
- data/app/cells/decidim/assemblies/assembly_metadata_g_cell.rb +46 -0
- data/app/cells/decidim/assemblies/assembly_s_cell.rb +15 -0
- data/app/cells/decidim/assemblies/content_block_cell.rb +21 -0
- data/app/cells/decidim/assemblies/content_blocks/children_assemblies_cell.rb +27 -0
- data/app/cells/decidim/assemblies/content_blocks/dates_metadata_cell.rb +23 -0
- data/app/cells/decidim/assemblies/content_blocks/extra_data_cell.rb +39 -0
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb +15 -23
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_settings_form/show.erb +1 -1
- data/app/cells/decidim/assemblies/content_blocks/main_data_cell.rb +52 -0
- data/app/cells/decidim/assemblies/content_blocks/metadata_cell.rb +23 -0
- data/app/cells/decidim/assemblies/content_blocks/related_assemblies/content.erb +1 -0
- data/app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb +34 -0
- data/app/cells/decidim/assemblies/content_blocks/stats_cell.rb +15 -0
- data/app/commands/decidim/assemblies/admin/copy_assembly.rb +2 -2
- data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +2 -1
- data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +3 -3
- data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/destroy_assembly_member.rb +1 -1
- data/app/commands/decidim/assemblies/admin/import_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +1 -1
- data/app/commands/decidim/assemblies/admin/update_assembly_member.rb +1 -1
- data/app/constraints/decidim/assemblies/current_assembly.rb +1 -1
- data/app/controllers/concerns/decidim/assemblies/admin/assembly_context.rb +1 -1
- data/app/controllers/concerns/decidim/assemblies/admin/assembly_members/filterable.rb +39 -0
- data/app/controllers/concerns/decidim/assemblies/assembly_breadcrumb.rb +36 -0
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +1 -0
- data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +1 -1
- data/app/controllers/decidim/assemblies/admin/assembly_attachment_collections_controller.rb +5 -0
- data/app/controllers/decidim/assemblies/admin/assembly_attachments_controller.rb +5 -0
- data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +2 -0
- data/app/controllers/decidim/assemblies/admin/assembly_landing_page_content_blocks_controller.rb +35 -0
- data/app/controllers/decidim/assemblies/admin/assembly_landing_page_controller.rb +37 -0
- data/app/controllers/decidim/assemblies/admin/assembly_members_controller.rb +2 -6
- data/app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb +9 -29
- data/app/controllers/decidim/assemblies/admin/assembly_user_roles_controller.rb +8 -91
- data/app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb +1 -1
- data/app/controllers/decidim/assemblies/assemblies_controller.rb +12 -7
- data/app/controllers/decidim/assemblies/assembly_members_controller.rb +2 -0
- data/app/events/decidim/assemblies/create_assembly_member_event.rb +1 -1
- data/app/events/decidim/role_assigned_to_assembly_event.rb +11 -6
- data/app/forms/decidim/assemblies/admin/assembly_copy_form.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_form.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +1 -1
- data/app/forms/decidim/assemblies/admin/assembly_user_role_form.rb +2 -18
- data/app/helpers/decidim/assemblies/admin/assembly_members_helper.rb +11 -0
- data/app/helpers/decidim/assemblies/application_helper.rb +12 -0
- data/app/helpers/decidim/assemblies/assemblies_helper.rb +21 -19
- data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +15 -30
- data/app/models/decidim/assembly.rb +6 -5
- data/app/models/decidim/assembly_user_role.rb +5 -33
- data/app/packs/entrypoints/decidim_assemblies.js +0 -1
- data/app/packs/src/decidim/assemblies/admin/assemblies.js +2 -2
- data/app/packs/src/decidim/assemblies/orgchart.js +0 -701
- data/app/permissions/decidim/assemblies/permissions.rb +14 -27
- data/app/presenters/decidim/assemblies/admin_log/assemblies_setting_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/admin_log/assembly_member_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/admin_log/assembly_user_role_presenter.rb +2 -2
- data/app/presenters/decidim/assemblies/assembly_presenter.rb +38 -0
- data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +2 -41
- data/app/presenters/decidim/assembly_member_presenter.rb +18 -4
- data/app/queries/decidim/assemblies/admin/admin_users.rb +1 -1
- data/app/queries/decidim/assemblies/assemblies_with_user_role.rb +2 -2
- data/app/serializers/decidim/assemblies/assembly_importer.rb +3 -3
- data/app/serializers/decidim/assemblies/assembly_serializer.rb +1 -1
- data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +218 -176
- data/app/views/decidim/assemblies/admin/assemblies/edit.html.erb +25 -11
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +105 -115
- data/app/views/decidim/assemblies/admin/assemblies/new.html.erb +16 -9
- data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +6 -8
- data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +11 -5
- data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +34 -35
- data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +16 -6
- data/app/views/decidim/assemblies/admin/assembly_copies/_form.html.erb +12 -20
- data/app/views/decidim/assemblies/admin/assembly_copies/new.html.erb +17 -5
- data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +28 -37
- data/app/views/decidim/assemblies/admin/assembly_imports/new.html.erb +17 -5
- data/app/views/decidim/assemblies/admin/assembly_members/_form.html.erb +45 -49
- data/app/views/decidim/assemblies/admin/assembly_members/edit.html.erb +17 -6
- data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +51 -88
- data/app/views/decidim/assemblies/admin/assembly_members/new.html.erb +17 -6
- data/app/views/decidim/assemblies/admin/assembly_user_roles/_form.html.erb +14 -18
- data/app/views/decidim/assemblies/admin/assembly_user_roles/edit.html.erb +17 -6
- data/app/views/decidim/assemblies/admin/assembly_user_roles/index.html.erb +54 -55
- data/app/views/decidim/assemblies/admin/assembly_user_roles/new.html.erb +17 -6
- data/app/views/decidim/assemblies/assemblies/_collection.html.erb +7 -0
- data/app/views/decidim/assemblies/assemblies/index.html.erb +20 -19
- data/app/views/decidim/assemblies/assemblies/index.js.erb +1 -8
- data/app/views/decidim/assemblies/assemblies/show.html.erb +17 -207
- data/app/views/decidim/assemblies/assembly_members/index.html.erb +7 -5
- data/app/views/decidim/assemblies/pages/user_profile/_member_of.html.erb +6 -9
- data/app/views/layouts/decidim/admin/_manage_assemblies.html.erb +36 -0
- data/app/views/layouts/decidim/admin/assemblies.html.erb +13 -11
- data/app/views/layouts/decidim/admin/assemblies_imports.html.erb +9 -0
- data/app/views/layouts/decidim/admin/assemblies_types.html.erb +17 -0
- data/app/views/layouts/decidim/admin/assembly.html.erb +12 -13
- data/app/views/layouts/decidim/assembly.html.erb +7 -14
- data/config/locales/ar.yml +7 -68
- data/config/locales/bg.yml +0 -466
- data/config/locales/ca.yml +60 -69
- data/config/locales/cs.yml +59 -66
- data/config/locales/de.yml +60 -69
- data/config/locales/el.yml +11 -61
- data/config/locales/en.yml +57 -66
- data/config/locales/es-MX.yml +57 -66
- data/config/locales/es-PY.yml +57 -66
- data/config/locales/es.yml +60 -69
- data/config/locales/eu.yml +57 -70
- data/config/locales/fi-plain.yml +58 -67
- data/config/locales/fi.yml +57 -66
- data/config/locales/fr-CA.yml +57 -66
- data/config/locales/fr.yml +57 -66
- data/config/locales/ga-IE.yml +4 -15
- data/config/locales/gl.yml +4 -62
- data/config/locales/hu.yml +33 -65
- data/config/locales/id-ID.yml +6 -47
- data/config/locales/is-IS.yml +5 -40
- data/config/locales/it.yml +5 -62
- data/config/locales/ja.yml +51 -66
- data/config/locales/kaa.yml +0 -8
- data/config/locales/ko.yml +0 -92
- data/config/locales/lb.yml +5 -61
- data/config/locales/lt.yml +40 -63
- data/config/locales/lv.yml +5 -57
- data/config/locales/nl.yml +4 -62
- data/config/locales/no.yml +5 -62
- data/config/locales/pl.yml +3 -93
- data/config/locales/pt-BR.yml +77 -132
- data/config/locales/pt.yml +5 -62
- data/config/locales/ro-RO.yml +20 -63
- data/config/locales/ru.yml +4 -44
- data/config/locales/sk.yml +0 -26
- data/config/locales/sl.yml +5 -48
- data/config/locales/sq-AL.yml +0 -364
- data/config/locales/sr-CS.yml +0 -5
- data/config/locales/sv.yml +18 -62
- data/config/locales/tr-TR.yml +8 -69
- data/config/locales/uk.yml +4 -44
- data/config/locales/zh-CN.yml +5 -60
- data/config/locales/zh-TW.yml +7 -63
- data/db/migrate/20200108123050_migrate_decidim_assembly_types.rb +1 -1
- data/lib/decidim/api/assemblies_type_type.rb +1 -1
- data/lib/decidim/api/assembly_member_type.rb +1 -1
- data/lib/decidim/api/assembly_type.rb +1 -1
- data/lib/decidim/assemblies/admin_engine.rb +21 -126
- data/lib/decidim/assemblies/content_blocks/registry_manager.rb +184 -0
- data/lib/decidim/assemblies/engine.rb +15 -21
- data/lib/decidim/assemblies/menu.rb +161 -0
- data/lib/decidim/assemblies/participatory_space.rb +7 -229
- data/lib/decidim/assemblies/query_extensions.rb +6 -6
- data/lib/decidim/assemblies/seeds.rb +161 -0
- data/lib/decidim/assemblies/test/factories.rb +47 -55
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +54 -51
- data/app/cells/decidim/assemblies/assembly_m/footer.erb +0 -15
- data/app/cells/decidim/assemblies/assembly_m/tags.erb +0 -1
- data/app/cells/decidim/assemblies/assembly_m_cell.rb +0 -77
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies/show.erb +0 -30
- data/app/commands/decidim/assemblies/admin/create_assembly_admin.rb +0 -54
- data/app/commands/decidim/assemblies/admin/destroy_assembly_admin.rb +0 -58
- data/app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb +0 -22
- data/app/commands/decidim/assemblies/admin/publish_assembly.rb +0 -39
- data/app/commands/decidim/assemblies/admin/unpublish_assembly.rb +0 -39
- data/app/commands/decidim/assemblies/admin/update_assemblies_setting.rb +0 -46
- data/app/commands/decidim/assemblies/admin/update_assembly_admin.rb +0 -53
- data/app/controllers/decidim/assemblies/admin/assemblies_settings_controller.rb +0 -49
- data/app/controllers/decidim/assemblies/widgets_controller.rb +0 -33
- data/app/forms/decidim/assemblies/admin/assemblies_setting_form.rb +0 -14
- data/app/models/decidim/assemblies_setting.rb +0 -17
- data/app/queries/decidim/assemblies/admin/assembly_members.rb +0 -56
- data/app/views/decidim/assemblies/_filter_by_type.html.erb +0 -19
- data/app/views/decidim/assemblies/admin/assemblies_settings/_form.html.erb +0 -10
- data/app/views/decidim/assemblies/admin/assemblies_settings/edit.html.erb +0 -7
- data/app/views/decidim/assemblies/assemblies/_count.html.erb +0 -1
- data/app/views/decidim/assemblies/assemblies/_nav_breadcumb.html.erb +0 -11
- data/app/views/decidim/assemblies/assemblies/_parent_assemblies.html.erb +0 -15
- data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +0 -27
- data/app/views/layouts/decidim/_assembly_header.html.erb +0 -27
- data/app/views/layouts/decidim/_assembly_navigation.html.erb +0 -24
- data/app/views/layouts/decidim/admin/assembly_members.html.erb +0 -18
- data/config/locales/he-IL.yml +0 -110
- data/db/seeds/Exampledocument.pdf +0 -0
- data/db/seeds/city.jpeg +0 -0
- data/db/seeds/city2.jpeg +0 -0
- data/db/seeds/homepage_image.jpg +0 -0
- data/decidim-assemblies.gemspec +0 -32
@@ -3,6 +3,7 @@
|
|
3
3
|
Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
4
4
|
participatory_space.icon = "media/images/decidim_assemblies.svg"
|
5
5
|
participatory_space.model_class_name = "Decidim::Assembly"
|
6
|
+
participatory_space.content_blocks_scope_name = "assembly_homepage"
|
6
7
|
|
7
8
|
participatory_space.participatory_spaces do |organization|
|
8
9
|
Decidim::Assemblies::OrganizationAssemblies.new(organization).query
|
@@ -12,6 +13,8 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
12
13
|
|
13
14
|
participatory_space.query_type = "Decidim::Assemblies::AssemblyType"
|
14
15
|
|
16
|
+
participatory_space.breadcrumb_cell = "decidim/assemblies/assembly_dropdown_metadata"
|
17
|
+
|
15
18
|
participatory_space.register_resource(:assembly) do |resource|
|
16
19
|
resource.model_class_name = "Decidim::Assembly"
|
17
20
|
resource.card = "decidim/assemblies/assembly"
|
@@ -37,238 +40,13 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
37
40
|
end
|
38
41
|
|
39
42
|
participatory_space.register_on_destroy_account do |user|
|
40
|
-
Decidim::AssemblyUserRole.where(user:
|
41
|
-
Decidim::AssemblyMember.where(user:
|
43
|
+
Decidim::AssemblyUserRole.where(user:).destroy_all
|
44
|
+
Decidim::AssemblyMember.where(user:).destroy_all
|
42
45
|
end
|
43
46
|
|
44
47
|
participatory_space.seeds do
|
45
|
-
|
46
|
-
seeds_root = File.join(__dir__, "..", "..", "..", "db", "seeds")
|
47
|
-
|
48
|
-
Decidim::ContentBlock.create(
|
49
|
-
organization: organization,
|
50
|
-
weight: 32,
|
51
|
-
scope_name: :homepage,
|
52
|
-
manifest_name: :highlighted_assemblies,
|
53
|
-
published_at: Time.current
|
54
|
-
)
|
55
|
-
|
56
|
-
2.times do |n|
|
57
|
-
params = {
|
58
|
-
title: Decidim::Faker::Localized.sentence(word_count: 5),
|
59
|
-
slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
|
60
|
-
subtitle: Decidim::Faker::Localized.sentence(word_count: 2),
|
61
|
-
hashtag: "##{Faker::Lorem.word}",
|
62
|
-
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
63
|
-
Decidim::Faker::Localized.sentence(word_count: 3)
|
64
|
-
end,
|
65
|
-
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
66
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
67
|
-
end,
|
68
|
-
organization: organization,
|
69
|
-
hero_image: ActiveStorage::Blob.create_and_upload!(
|
70
|
-
io: File.open(File.join(seeds_root, "city.jpeg")),
|
71
|
-
filename: "hero_image.jpeg",
|
72
|
-
content_type: "image/jpeg",
|
73
|
-
metadata: nil
|
74
|
-
), # Keep after organization
|
75
|
-
banner_image: ActiveStorage::Blob.create_and_upload!(
|
76
|
-
io: File.open(File.join(seeds_root, "city2.jpeg")),
|
77
|
-
filename: "banner_image.jpeg",
|
78
|
-
content_type: "image/jpeg",
|
79
|
-
metadata: nil
|
80
|
-
), # Keep after organization
|
81
|
-
promoted: true,
|
82
|
-
published_at: 2.weeks.ago,
|
83
|
-
meta_scope: Decidim::Faker::Localized.word,
|
84
|
-
developer_group: Decidim::Faker::Localized.sentence(word_count: 1),
|
85
|
-
local_area: Decidim::Faker::Localized.sentence(word_count: 2),
|
86
|
-
target: Decidim::Faker::Localized.sentence(word_count: 3),
|
87
|
-
participatory_scope: Decidim::Faker::Localized.sentence(word_count: 1),
|
88
|
-
participatory_structure: Decidim::Faker::Localized.sentence(word_count: 2),
|
89
|
-
scope: n.positive? ? Decidim::Scope.reorder(Arel.sql("RANDOM()")).first : nil,
|
90
|
-
purpose_of_action: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
91
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
92
|
-
end,
|
93
|
-
composition: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
94
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
95
|
-
end,
|
96
|
-
assembly_type: Decidim::AssembliesType.create!(organization: organization, title: Decidim::Faker::Localized.word),
|
97
|
-
creation_date: 1.day.from_now,
|
98
|
-
created_by: "others",
|
99
|
-
created_by_other: Decidim::Faker::Localized.word,
|
100
|
-
duration: 2.days.from_now,
|
101
|
-
included_at: 5.days.from_now,
|
102
|
-
closing_date: 5.days.from_now,
|
103
|
-
closing_date_reason: Decidim::Faker::Localized.sentence(word_count: 3),
|
104
|
-
internal_organisation: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
105
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
106
|
-
end,
|
107
|
-
is_transparent: true,
|
108
|
-
special_features: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
109
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
110
|
-
end,
|
111
|
-
twitter_handler: Faker::Lorem.word,
|
112
|
-
facebook_handler: Faker::Lorem.word,
|
113
|
-
instagram_handler: Faker::Lorem.word,
|
114
|
-
youtube_handler: Faker::Lorem.word,
|
115
|
-
github_handler: Faker::Lorem.word
|
116
|
-
}
|
117
|
-
|
118
|
-
assembly = Decidim.traceability.perform_action!(
|
119
|
-
"publish",
|
120
|
-
Decidim::Assembly,
|
121
|
-
organization.users.first,
|
122
|
-
visibility: "all"
|
123
|
-
) do
|
124
|
-
Decidim::Assembly.create!(params)
|
125
|
-
end
|
126
|
-
|
127
|
-
# Create users with specific roles
|
128
|
-
Decidim::AssemblyUserRole::ROLES.each do |role|
|
129
|
-
email = "assembly_#{assembly.id}_#{role}@example.org"
|
130
|
-
|
131
|
-
user = Decidim::User.find_or_initialize_by(email: email)
|
132
|
-
user.update!(
|
133
|
-
name: Faker::Name.name,
|
134
|
-
nickname: Faker::Twitter.unique.screen_name,
|
135
|
-
password: "decidim123456789",
|
136
|
-
password_confirmation: "decidim123456789",
|
137
|
-
organization: organization,
|
138
|
-
confirmed_at: Time.current,
|
139
|
-
locale: I18n.default_locale,
|
140
|
-
tos_agreement: true
|
141
|
-
)
|
142
|
-
|
143
|
-
Decidim::AssemblyUserRole.find_or_create_by!(
|
144
|
-
user: user,
|
145
|
-
assembly: assembly,
|
146
|
-
role: role
|
147
|
-
)
|
148
|
-
end
|
149
|
-
|
150
|
-
child = Decidim::Assembly.create!(
|
151
|
-
title: Decidim::Faker::Localized.sentence(word_count: 5),
|
152
|
-
slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
|
153
|
-
subtitle: Decidim::Faker::Localized.sentence(word_count: 2),
|
154
|
-
hashtag: "##{Faker::Lorem.word}",
|
155
|
-
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
156
|
-
Decidim::Faker::Localized.sentence(word_count: 3)
|
157
|
-
end,
|
158
|
-
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
159
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
160
|
-
end,
|
161
|
-
organization: organization,
|
162
|
-
hero_image: ActiveStorage::Blob.create_and_upload!(
|
163
|
-
io: File.open(File.join(seeds_root, "city.jpeg")),
|
164
|
-
filename: "hero_image.jpeg",
|
165
|
-
content_type: "image/jpeg",
|
166
|
-
metadata: nil
|
167
|
-
), # Keep after organization
|
168
|
-
banner_image: ActiveStorage::Blob.create_and_upload!(
|
169
|
-
io: File.open(File.join(seeds_root, "city2.jpeg")),
|
170
|
-
filename: "banner_image.jpeg",
|
171
|
-
content_type: "image/jpeg",
|
172
|
-
metadata: nil
|
173
|
-
), # Keep after organization
|
174
|
-
promoted: true,
|
175
|
-
published_at: 2.weeks.ago,
|
176
|
-
meta_scope: Decidim::Faker::Localized.word,
|
177
|
-
developer_group: Decidim::Faker::Localized.sentence(word_count: 1),
|
178
|
-
local_area: Decidim::Faker::Localized.sentence(word_count: 2),
|
179
|
-
target: Decidim::Faker::Localized.sentence(word_count: 3),
|
180
|
-
participatory_scope: Decidim::Faker::Localized.sentence(word_count: 1),
|
181
|
-
participatory_structure: Decidim::Faker::Localized.sentence(word_count: 2),
|
182
|
-
scope: n.positive? ? Decidim::Scope.reorder(Arel.sql("RANDOM()")).first : nil,
|
183
|
-
parent: assembly
|
184
|
-
)
|
48
|
+
require "decidim/assemblies/seeds"
|
185
49
|
|
186
|
-
|
187
|
-
current_assembly.add_to_index_as_search_resource
|
188
|
-
attachment_collection = Decidim::AttachmentCollection.create!(
|
189
|
-
name: Decidim::Faker::Localized.word,
|
190
|
-
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
191
|
-
collection_for: current_assembly
|
192
|
-
)
|
193
|
-
|
194
|
-
Decidim::Attachment.create!(
|
195
|
-
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
196
|
-
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
197
|
-
attachment_collection: attachment_collection,
|
198
|
-
attached_to: current_assembly,
|
199
|
-
content_type: "application/pdf",
|
200
|
-
file: ActiveStorage::Blob.create_and_upload!(
|
201
|
-
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
|
202
|
-
filename: "Exampledocument.pdf",
|
203
|
-
content_type: "application/pdf",
|
204
|
-
metadata: nil
|
205
|
-
) # Keep after attached_to
|
206
|
-
)
|
207
|
-
|
208
|
-
Decidim::Attachment.create!(
|
209
|
-
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
210
|
-
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
211
|
-
attached_to: current_assembly,
|
212
|
-
content_type: "image/jpeg",
|
213
|
-
file: ActiveStorage::Blob.create_and_upload!(
|
214
|
-
io: File.open(File.join(seeds_root, "city.jpeg")),
|
215
|
-
filename: "city.jpeg",
|
216
|
-
content_type: "image/jpeg",
|
217
|
-
metadata: nil
|
218
|
-
) # Keep after attached_to
|
219
|
-
)
|
220
|
-
|
221
|
-
Decidim::Attachment.create!(
|
222
|
-
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
223
|
-
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
224
|
-
attached_to: current_assembly,
|
225
|
-
content_type: "application/pdf",
|
226
|
-
file: ActiveStorage::Blob.create_and_upload!(
|
227
|
-
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
|
228
|
-
filename: "Exampledocument.pdf",
|
229
|
-
content_type: "application/pdf",
|
230
|
-
metadata: nil
|
231
|
-
) # Keep after attached_to
|
232
|
-
)
|
233
|
-
|
234
|
-
2.times do
|
235
|
-
Decidim::Category.create!(
|
236
|
-
name: Decidim::Faker::Localized.sentence(word_count: 5),
|
237
|
-
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
238
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
239
|
-
end,
|
240
|
-
participatory_space: current_assembly
|
241
|
-
)
|
242
|
-
end
|
243
|
-
|
244
|
-
Decidim::AssemblyMember::POSITIONS.each do |position|
|
245
|
-
Decidim::AssemblyMember.create!(
|
246
|
-
full_name: Faker::Name.name,
|
247
|
-
gender: Faker::Lorem.word,
|
248
|
-
birthday: Faker::Date.birthday(min_age: 18, max_age: 65),
|
249
|
-
birthplace: Faker::Demographic.demonym,
|
250
|
-
designation_date: Faker::Date.between(from: 1.year.ago, to: 1.month.ago),
|
251
|
-
position: position,
|
252
|
-
position_other: position == "other" ? Faker::Job.position : nil,
|
253
|
-
assembly: current_assembly
|
254
|
-
)
|
255
|
-
end
|
256
|
-
|
257
|
-
Decidim::AssemblyMember.create!(
|
258
|
-
user: current_assembly.organization.users.first,
|
259
|
-
gender: Faker::Lorem.word,
|
260
|
-
birthday: Faker::Date.birthday(min_age: 18, max_age: 65),
|
261
|
-
birthplace: Faker::Demographic.demonym,
|
262
|
-
designation_date: Faker::Date.between(from: 1.year.ago, to: 1.month.ago),
|
263
|
-
position: "other",
|
264
|
-
position_other: Faker::Job.position,
|
265
|
-
assembly: current_assembly
|
266
|
-
)
|
267
|
-
|
268
|
-
Decidim.component_manifests.each do |manifest|
|
269
|
-
manifest.seed!(current_assembly.reload)
|
270
|
-
end
|
271
|
-
end
|
272
|
-
end
|
50
|
+
Decidim::Assemblies::Seeds.new.call
|
273
51
|
end
|
274
52
|
end
|
@@ -20,14 +20,14 @@ module Decidim
|
|
20
20
|
[Decidim::Assemblies::AssemblyType],
|
21
21
|
null: true,
|
22
22
|
description: "Lists all assemblies" do
|
23
|
-
argument :filter, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputFilter, "This argument
|
24
|
-
argument :order, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputSort, "This argument
|
23
|
+
argument :filter, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputFilter, "This argument lets you filter the results", required: false
|
24
|
+
argument :order, Decidim::ParticipatoryProcesses::ParticipatoryProcessInputSort, "This argument lets you order the results", required: false
|
25
25
|
end
|
26
26
|
|
27
27
|
type.field :assembly,
|
28
28
|
Decidim::Assemblies::AssemblyType,
|
29
29
|
null: true,
|
30
|
-
description: "Finds
|
30
|
+
description: "Finds an assembly" do
|
31
31
|
argument :id, GraphQL::Types::ID, "The ID of the participatory space", required: false
|
32
32
|
end
|
33
33
|
end
|
@@ -41,18 +41,18 @@ module Decidim
|
|
41
41
|
def assemblies_type(id:)
|
42
42
|
Decidim::AssembliesType.find_by(
|
43
43
|
organization: context[:current_organization],
|
44
|
-
id:
|
44
|
+
id:
|
45
45
|
)
|
46
46
|
end
|
47
47
|
|
48
48
|
def assemblies(filter: {}, order: {})
|
49
49
|
manifest = Decidim.participatory_space_manifests.select { |m| m.name == :assemblies }.first
|
50
|
-
Decidim::Core::ParticipatorySpaceListBase.new(manifest:
|
50
|
+
Decidim::Core::ParticipatorySpaceListBase.new(manifest:).call(object, { filter:, order: }, context)
|
51
51
|
end
|
52
52
|
|
53
53
|
def assembly(id: nil)
|
54
54
|
manifest = Decidim.participatory_space_manifests.select { |m| m.name == :assemblies }.first
|
55
|
-
Decidim::Core::ParticipatorySpaceFinderBase.new(manifest:
|
55
|
+
Decidim::Core::ParticipatorySpaceFinderBase.new(manifest:).call(object, { id: }, context)
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/seeds"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Assemblies
|
7
|
+
class Seeds < Decidim::Seeds
|
8
|
+
def call
|
9
|
+
create_content_block!
|
10
|
+
|
11
|
+
2.times do |_n|
|
12
|
+
assembly = create_assembly!
|
13
|
+
|
14
|
+
create_assembly_user_roles!(assembly:)
|
15
|
+
|
16
|
+
child = create_assembly!(parent: assembly)
|
17
|
+
|
18
|
+
[assembly, child].each do |current_assembly|
|
19
|
+
current_assembly.add_to_index_as_search_resource
|
20
|
+
|
21
|
+
create_attachments!(attached_to: current_assembly)
|
22
|
+
|
23
|
+
2.times do
|
24
|
+
create_category!(participatory_space: current_assembly)
|
25
|
+
end
|
26
|
+
|
27
|
+
create_assembly_members!(assembly: current_assembly)
|
28
|
+
|
29
|
+
seed_components_manifests!(participatory_space: current_assembly)
|
30
|
+
|
31
|
+
Decidim::ContentBlocksCreator.new(current_assembly).create_default!
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def create_content_block!
|
37
|
+
Decidim::ContentBlock.create(
|
38
|
+
organization:,
|
39
|
+
weight: 32,
|
40
|
+
scope_name: :homepage,
|
41
|
+
manifest_name: :highlighted_assemblies,
|
42
|
+
published_at: Time.current
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def create_assembly!(parent: nil)
|
47
|
+
n = rand(2)
|
48
|
+
params = {
|
49
|
+
title: Decidim::Faker::Localized.sentence(word_count: 5),
|
50
|
+
slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
|
51
|
+
subtitle: Decidim::Faker::Localized.sentence(word_count: 2),
|
52
|
+
hashtag: "##{::Faker::Lorem.word}",
|
53
|
+
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
54
|
+
Decidim::Faker::Localized.sentence(word_count: 3)
|
55
|
+
end,
|
56
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
57
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
58
|
+
end,
|
59
|
+
organization:,
|
60
|
+
hero_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? hero_image : nil, # Keep after organization
|
61
|
+
banner_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? banner_image : nil, # Keep after organization
|
62
|
+
promoted: true,
|
63
|
+
published_at: 2.weeks.ago,
|
64
|
+
meta_scope: Decidim::Faker::Localized.word,
|
65
|
+
developer_group: Decidim::Faker::Localized.sentence(word_count: 1),
|
66
|
+
local_area: Decidim::Faker::Localized.sentence(word_count: 2),
|
67
|
+
target: Decidim::Faker::Localized.sentence(word_count: 3),
|
68
|
+
participatory_scope: Decidim::Faker::Localized.sentence(word_count: 1),
|
69
|
+
participatory_structure: Decidim::Faker::Localized.sentence(word_count: 2),
|
70
|
+
scope: n.positive? ? Decidim::Scope.all.sample : nil,
|
71
|
+
purpose_of_action: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
72
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
73
|
+
end,
|
74
|
+
composition: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
75
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
76
|
+
end,
|
77
|
+
assembly_type: Decidim::AssembliesType.create!(organization:, title: Decidim::Faker::Localized.word),
|
78
|
+
creation_date: 1.day.from_now,
|
79
|
+
created_by: "others",
|
80
|
+
created_by_other: Decidim::Faker::Localized.word,
|
81
|
+
duration: 2.days.from_now,
|
82
|
+
included_at: 5.days.from_now,
|
83
|
+
closing_date: 5.days.from_now,
|
84
|
+
closing_date_reason: Decidim::Faker::Localized.sentence(word_count: 3),
|
85
|
+
internal_organisation: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
86
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
87
|
+
end,
|
88
|
+
is_transparent: true,
|
89
|
+
special_features: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
90
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
91
|
+
end,
|
92
|
+
twitter_handler: ::Faker::Lorem.word,
|
93
|
+
facebook_handler: ::Faker::Lorem.word,
|
94
|
+
instagram_handler: ::Faker::Lorem.word,
|
95
|
+
youtube_handler: ::Faker::Lorem.word,
|
96
|
+
github_handler: ::Faker::Lorem.word,
|
97
|
+
parent:
|
98
|
+
}
|
99
|
+
|
100
|
+
Decidim.traceability.perform_action!(
|
101
|
+
"publish",
|
102
|
+
Decidim::Assembly,
|
103
|
+
organization.users.first,
|
104
|
+
visibility: "all"
|
105
|
+
) do
|
106
|
+
Decidim::Assembly.create!(params)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def create_assembly_user_roles!(assembly:)
|
111
|
+
# Create users with specific roles
|
112
|
+
Decidim::AssemblyUserRole::ROLES.each do |role|
|
113
|
+
email = "assembly_#{assembly.id}_#{role}@example.org"
|
114
|
+
|
115
|
+
user = Decidim::User.find_or_initialize_by(email:)
|
116
|
+
user.update!(
|
117
|
+
name: ::Faker::Name.name,
|
118
|
+
nickname: ::Faker::Twitter.unique.screen_name,
|
119
|
+
password: "decidim123456789",
|
120
|
+
organization:,
|
121
|
+
confirmed_at: Time.current,
|
122
|
+
locale: I18n.default_locale,
|
123
|
+
tos_agreement: true
|
124
|
+
)
|
125
|
+
|
126
|
+
Decidim::AssemblyUserRole.find_or_create_by!(
|
127
|
+
user:,
|
128
|
+
assembly:,
|
129
|
+
role:
|
130
|
+
)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
|
134
|
+
def create_assembly_members!(assembly:)
|
135
|
+
Decidim::AssemblyMember::POSITIONS.each do |position|
|
136
|
+
Decidim::AssemblyMember.create!(
|
137
|
+
full_name: ::Faker::Name.name,
|
138
|
+
gender: ::Faker::Lorem.word,
|
139
|
+
birthday: ::Faker::Date.birthday(min_age: 18, max_age: 65),
|
140
|
+
birthplace: ::Faker::Demographic.demonym,
|
141
|
+
designation_date: ::Faker::Date.between(from: 1.year.ago, to: 1.month.ago),
|
142
|
+
position:,
|
143
|
+
position_other: position == "other" ? ::Faker::Job.position : nil,
|
144
|
+
assembly:
|
145
|
+
)
|
146
|
+
end
|
147
|
+
|
148
|
+
Decidim::AssemblyMember.create!(
|
149
|
+
user: assembly.organization.users.first,
|
150
|
+
gender: ::Faker::Lorem.word,
|
151
|
+
birthday: ::Faker::Date.birthday(min_age: 18, max_age: 65),
|
152
|
+
birthplace: ::Faker::Demographic.demonym,
|
153
|
+
designation_date: ::Faker::Date.between(from: 1.year.ago, to: 1.month.ago),
|
154
|
+
position: "other",
|
155
|
+
position_other: ::Faker::Job.position,
|
156
|
+
assembly:
|
157
|
+
)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -8,62 +8,51 @@ FactoryBot.define do
|
|
8
8
|
"#{Decidim::Faker::Internet.slug(words: nil, glue: "-")}-#{n}"
|
9
9
|
end
|
10
10
|
|
11
|
-
factory :assemblies_setting, class: "Decidim::AssembliesSetting" do
|
12
|
-
enable_organization_chart { true }
|
13
|
-
organization
|
14
|
-
end
|
15
|
-
|
16
11
|
factory :assemblies_type, class: "Decidim::AssembliesType" do
|
17
|
-
|
18
|
-
skip_injection { false }
|
19
|
-
end
|
20
|
-
title { generate_localized_title(:assemblies_type_title, skip_injection: skip_injection) }
|
12
|
+
title { generate_localized_title }
|
21
13
|
organization
|
22
14
|
end
|
23
15
|
|
24
16
|
factory :assembly, class: "Decidim::Assembly" do
|
25
|
-
|
26
|
-
skip_injection { false }
|
27
|
-
end
|
28
|
-
title { generate_localized_title(:assembly_title, skip_injection: skip_injection) }
|
17
|
+
title { generate_localized_title }
|
29
18
|
slug { generate(:assembly_slug) }
|
30
|
-
subtitle { generate_localized_title
|
31
|
-
short_description {
|
32
|
-
description {
|
19
|
+
subtitle { generate_localized_title }
|
20
|
+
short_description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
21
|
+
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
33
22
|
organization
|
34
23
|
hero_image { Decidim::Dev.test_file("city.jpeg", "image/jpeg") } # Keep after organization
|
35
24
|
banner_image { Decidim::Dev.test_file("city2.jpeg", "image/jpeg") } # Keep after organization
|
36
25
|
published_at { Time.current }
|
37
|
-
meta_scope {
|
38
|
-
developer_group { generate_localized_title
|
39
|
-
local_area { generate_localized_title
|
40
|
-
target { generate_localized_title
|
41
|
-
participatory_scope { generate_localized_title
|
42
|
-
participatory_structure { generate_localized_title
|
26
|
+
meta_scope { Decidim::Faker::Localized.word }
|
27
|
+
developer_group { generate_localized_title }
|
28
|
+
local_area { generate_localized_title }
|
29
|
+
target { generate_localized_title }
|
30
|
+
participatory_scope { generate_localized_title }
|
31
|
+
participatory_structure { generate_localized_title }
|
43
32
|
show_statistics { true }
|
44
33
|
private_space { false }
|
45
|
-
purpose_of_action {
|
46
|
-
composition {
|
34
|
+
purpose_of_action { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
35
|
+
composition { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
47
36
|
creation_date { 1.month.ago }
|
48
37
|
created_by { "others" }
|
49
|
-
created_by_other {
|
38
|
+
created_by_other { Decidim::Faker::Localized.word }
|
50
39
|
duration { 2.months.from_now.at_midnight }
|
51
40
|
included_at { 1.month.ago }
|
52
41
|
closing_date { 2.months.from_now.at_midnight }
|
53
|
-
closing_date_reason {
|
54
|
-
internal_organisation {
|
42
|
+
closing_date_reason { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
43
|
+
internal_organisation { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
55
44
|
is_transparent { true }
|
56
|
-
special_features {
|
45
|
+
special_features { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
57
46
|
twitter_handler { "others" }
|
58
47
|
facebook_handler { "others" }
|
59
48
|
instagram_handler { "others" }
|
60
49
|
youtube_handler { "others" }
|
61
50
|
github_handler { "others" }
|
62
51
|
weight { 1 }
|
63
|
-
announcement { generate_localized_title
|
52
|
+
announcement { generate_localized_title }
|
64
53
|
|
65
54
|
trait :with_type do
|
66
|
-
assembly_type { create :assemblies_type, organization:
|
55
|
+
assembly_type { create :assemblies_type, organization: }
|
67
56
|
end
|
68
57
|
|
69
58
|
trait :promoted do
|
@@ -79,7 +68,7 @@ FactoryBot.define do
|
|
79
68
|
end
|
80
69
|
|
81
70
|
trait :with_parent do
|
82
|
-
parent { create :assembly, organization:
|
71
|
+
parent { create :assembly, organization: }
|
83
72
|
end
|
84
73
|
|
85
74
|
trait :public do
|
@@ -97,20 +86,32 @@ FactoryBot.define do
|
|
97
86
|
trait :opaque do
|
98
87
|
is_transparent { false }
|
99
88
|
end
|
89
|
+
|
90
|
+
trait :with_content_blocks do
|
91
|
+
transient { blocks_manifests { [:hero] } }
|
92
|
+
|
93
|
+
after(:create) do |assembly, evaluator|
|
94
|
+
evaluator.blocks_manifests.each do |manifest_name|
|
95
|
+
create(
|
96
|
+
:content_block,
|
97
|
+
organization: assembly.organization,
|
98
|
+
scope_name: :assembly_homepage,
|
99
|
+
manifest_name:,
|
100
|
+
scoped_resource_id: assembly.id
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
100
105
|
end
|
101
106
|
|
102
107
|
factory :assembly_user_role, class: "Decidim::AssemblyUserRole" do
|
103
|
-
transient do
|
104
|
-
skip_injection { false }
|
105
|
-
end
|
106
108
|
user
|
107
|
-
assembly { create :assembly, organization: user.organization
|
109
|
+
assembly { create :assembly, organization: user.organization }
|
108
110
|
role { "admin" }
|
109
111
|
end
|
110
112
|
|
111
113
|
factory :assembly_admin, parent: :user, class: "Decidim::User" do
|
112
114
|
transient do
|
113
|
-
skip_injection { false }
|
114
115
|
assembly { create(:assembly) }
|
115
116
|
end
|
116
117
|
|
@@ -119,16 +120,14 @@ FactoryBot.define do
|
|
119
120
|
|
120
121
|
after(:create) do |user, evaluator|
|
121
122
|
create :assembly_user_role,
|
122
|
-
user
|
123
|
+
user:,
|
123
124
|
assembly: evaluator.assembly,
|
124
|
-
role: :admin
|
125
|
-
skip_injection: evaluator.skip_injection
|
125
|
+
role: :admin
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
129
|
factory :assembly_moderator, parent: :user, class: "Decidim::User" do
|
130
130
|
transient do
|
131
|
-
skip_injection { false }
|
132
131
|
assembly { create(:assembly) }
|
133
132
|
end
|
134
133
|
|
@@ -137,16 +136,14 @@ FactoryBot.define do
|
|
137
136
|
|
138
137
|
after(:create) do |user, evaluator|
|
139
138
|
create :assembly_user_role,
|
140
|
-
user
|
139
|
+
user:,
|
141
140
|
assembly: evaluator.assembly,
|
142
|
-
role: :moderator
|
143
|
-
skip_injection: evaluator.skip_injection
|
141
|
+
role: :moderator
|
144
142
|
end
|
145
143
|
end
|
146
144
|
|
147
145
|
factory :assembly_collaborator, parent: :user, class: "Decidim::User" do
|
148
146
|
transient do
|
149
|
-
skip_injection { false }
|
150
147
|
assembly { create(:assembly) }
|
151
148
|
end
|
152
149
|
|
@@ -155,16 +152,14 @@ FactoryBot.define do
|
|
155
152
|
|
156
153
|
after(:create) do |user, evaluator|
|
157
154
|
create :assembly_user_role,
|
158
|
-
user
|
155
|
+
user:,
|
159
156
|
assembly: evaluator.assembly,
|
160
|
-
skip_injection: evaluator.skip_injection,
|
161
157
|
role: :collaborator
|
162
158
|
end
|
163
159
|
end
|
164
160
|
|
165
161
|
factory :assembly_valuator, parent: :user, class: "Decidim::User" do
|
166
162
|
transient do
|
167
|
-
skip_injection { false }
|
168
163
|
assembly { create(:assembly) }
|
169
164
|
end
|
170
165
|
|
@@ -173,18 +168,15 @@ FactoryBot.define do
|
|
173
168
|
|
174
169
|
after(:create) do |user, evaluator|
|
175
170
|
create :assembly_user_role,
|
176
|
-
user
|
171
|
+
user:,
|
177
172
|
assembly: evaluator.assembly,
|
178
|
-
role: :valuator
|
179
|
-
skip_injection: evaluator.skip_injection
|
173
|
+
role: :valuator
|
180
174
|
end
|
181
175
|
end
|
182
176
|
|
183
177
|
factory :assembly_member, class: "Decidim::AssemblyMember" do
|
184
|
-
|
185
|
-
|
186
|
-
end
|
187
|
-
assembly { create(:assembly, skip_injection: skip_injection) }
|
178
|
+
assembly { create(:assembly) }
|
179
|
+
|
188
180
|
full_name { Faker::Name.name }
|
189
181
|
gender { Faker::Lorem.word }
|
190
182
|
birthday { Faker::Date.birthday(min_age: 18, max_age: 65) }
|
@@ -197,7 +189,7 @@ FactoryBot.define do
|
|
197
189
|
end
|
198
190
|
|
199
191
|
trait :with_user do
|
200
|
-
user { create(:user, organization: assembly.organization
|
192
|
+
user { create(:user, organization: assembly.organization) }
|
201
193
|
end
|
202
194
|
end
|
203
195
|
end
|