decidim-assemblies 0.19.1 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/images/decidim/assemblies/assembly.svg +1 -3
- data/app/assets/javascripts/decidim/assemblies/orgchart.js.es6 +698 -0
- data/app/cells/decidim/assemblies/assembly_m/footer.erb +2 -2
- data/app/cells/decidim/assemblies/assembly_m_cell.rb +5 -5
- data/app/cells/decidim/assemblies/assembly_member/show.erb +4 -4
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies/show.erb +10 -11
- data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb +1 -0
- data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +45 -0
- data/app/commands/decidim/assemblies/admin/create_assembly.rb +1 -2
- data/app/commands/decidim/assemblies/admin/create_assembly_admin.rb +2 -1
- data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +12 -3
- data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +45 -0
- data/app/commands/decidim/assemblies/admin/import_assembly.rb +72 -0
- data/app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb +22 -0
- data/app/commands/decidim/assemblies/admin/update_assemblies_setting.rb +46 -0
- data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +46 -0
- data/app/commands/decidim/assemblies/admin/update_assembly.rb +11 -7
- data/app/commands/decidim/assemblies/admin/update_assembly_admin.rb +2 -1
- data/app/controllers/concerns/decidim/assemblies/admin/filterable.rb +30 -0
- data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +8 -29
- data/app/controllers/decidim/assemblies/admin/assemblies_settings_controller.rb +49 -0
- data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +107 -0
- data/app/controllers/decidim/assemblies/admin/assembly_exports_controller.rb +24 -0
- data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +31 -0
- data/app/controllers/decidim/assemblies/admin/assembly_user_roles_controller.rb +2 -1
- data/app/controllers/decidim/assemblies/assemblies_controller.rb +6 -2
- data/app/controllers/decidim/assemblies/{assembly_widgets_controller.rb → widgets_controller.rb} +2 -2
- data/app/events/decidim/assemblies/create_assembly_member_event.rb +17 -0
- data/app/events/decidim/role_assigned_to_assembly_event.rb +28 -0
- data/app/forms/decidim/assemblies/admin/assemblies_setting_form.rb +14 -0
- data/app/forms/decidim/assemblies/admin/assemblies_type_form.rb +17 -0
- data/app/forms/decidim/assemblies/admin/assembly_form.rb +37 -19
- data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +83 -0
- data/app/forms/decidim/assemblies/admin/assembly_user_role_form.rb +8 -2
- data/app/helpers/decidim/assemblies/admin/assemblies_helper.rb +6 -0
- data/app/helpers/decidim/assemblies/assemblies_helper.rb +6 -3
- data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +10 -7
- data/app/models/decidim/assemblies_setting.rb +17 -0
- data/app/models/decidim/assemblies_type.rb +27 -0
- data/app/models/decidim/assembly.rb +39 -3
- data/app/models/decidim/assembly_user_role.rb +1 -1
- data/app/permissions/decidim/assemblies/permissions.rb +60 -2
- data/app/presenters/decidim/assemblies/admin_log/assemblies_setting_presenter.rb +27 -0
- data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +43 -0
- data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -2
- data/app/presenters/decidim/assemblies/assembly_presenter.rb +29 -0
- data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/assembly_type_presenter.rb +29 -0
- data/app/queries/decidim/assemblies/filtered_assemblies.rb +2 -2
- data/app/queries/decidim/assemblies/parent_assemblies_for_select.rb +42 -0
- data/app/serializers/decidim/assemblies/assembly_importer.rb +172 -0
- data/app/serializers/decidim/assemblies/assembly_serializer.rb +147 -0
- data/app/services/decidim/assemblies/assembly_search.rb +3 -3
- data/app/types/decidim/assemblies/assemblies_type_type.rb +17 -0
- data/app/types/decidim/assemblies/assembly_member_type.rb +29 -0
- data/app/types/decidim/assemblies/assembly_type.rb +67 -0
- data/app/views/decidim/assemblies/_filter_by_type.html.erb +11 -7
- data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +2 -6
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +18 -4
- data/app/views/decidim/assemblies/admin/assemblies_settings/_form.html.erb +10 -0
- data/app/views/decidim/assemblies/admin/assemblies_settings/edit.html.erb +6 -0
- data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +11 -0
- data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +6 -0
- data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +43 -0
- data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +7 -0
- data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +46 -0
- data/app/views/decidim/assemblies/admin/assembly_imports/new.html.erb +7 -0
- data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +30 -30
- data/app/views/decidim/assemblies/assemblies/_parent_assemblies.html.erb +2 -2
- data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +3 -3
- data/app/views/decidim/assemblies/assemblies/index.html.erb +11 -8
- data/app/views/decidim/assemblies/assemblies/show.html.erb +11 -14
- data/app/views/decidim/assemblies/assembly_members/index.html.erb +1 -1
- data/app/views/layouts/decidim/admin/assemblies.html.erb +22 -0
- data/app/views/layouts/decidim/admin/assembly.html.erb +2 -2
- data/app/views/layouts/decidim/assembly.html.erb +1 -0
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +60 -27
- data/config/locales/bg-BG.yml +7 -0
- data/config/locales/bg.yml +7 -0
- data/config/locales/ca.yml +101 -1
- data/config/locales/cs.yml +152 -52
- data/config/locales/da-DK.yml +1 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +99 -0
- data/config/locales/el-GR.yml +1 -0
- data/config/locales/el.yml +475 -0
- data/config/locales/en.yml +100 -0
- data/config/locales/eo.yml +1 -0
- data/config/locales/es-MX.yml +100 -0
- data/config/locales/es-PY.yml +100 -0
- data/config/locales/es.yml +100 -0
- data/config/locales/et-EE.yml +1 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +11 -0
- data/config/locales/fi-plain.yml +97 -0
- data/config/locales/fi.yml +103 -6
- data/config/locales/fr-CA.yml +478 -0
- data/config/locales/fr.yml +100 -0
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +11 -0
- data/config/locales/hr-HR.yml +1 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +85 -2
- data/config/locales/id-ID.yml +11 -0
- data/config/locales/is-IS.yml +263 -0
- data/config/locales/is.yml +263 -0
- data/config/locales/it.yml +171 -74
- data/config/locales/ja-JP.yml +471 -0
- data/config/locales/ja.yml +471 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt-LT.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +454 -0
- data/config/locales/mt-MT.yml +1 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +103 -6
- data/config/locales/no.yml +349 -7
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +250 -151
- data/config/locales/pt-BR.yml +12 -1
- data/config/locales/pt.yml +217 -118
- data/config/locales/ro-RO.yml +441 -0
- data/config/locales/ru.yml +11 -0
- data/config/locales/sk-SK.yml +168 -0
- data/config/locales/sk.yml +172 -0
- data/config/locales/sl.yml +283 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +73 -0
- data/config/locales/sv.yml +188 -88
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +30 -0
- data/config/locales/uk.yml +11 -0
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +471 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200108113855_create_decidim_assembly_types.rb +19 -0
- data/db/migrate/20200108123050_migrate_decidim_assembly_types.rb +83 -0
- data/db/migrate/20200320105906_index_foreign_keys_in_decidim_assemblies.rb +7 -0
- data/db/migrate/20200320105907_index_foreign_keys_in_decidim_assembly_user_roles.rb +7 -0
- data/db/migrate/20200416132109_remove_legacy_decidim_assembly_type.rb +8 -0
- data/db/migrate/20200430202456_create_decidim_assemblies_settings.rb +10 -0
- data/db/seeds/city.jpeg +0 -0
- data/db/seeds/city2.jpeg +0 -0
- data/lib/decidim/assemblies/admin_engine.rb +10 -0
- data/lib/decidim/assemblies/engine.rb +8 -1
- data/lib/decidim/assemblies/participatory_space.rb +31 -15
- data/lib/decidim/assemblies/query_extensions.rb +40 -0
- data/lib/decidim/assemblies/test/factories.rb +32 -5
- data/lib/decidim/assemblies/version.rb +1 -1
- metadata +91 -11
- data/app/views/decidim/assemblies/assembly_widgets/show.html.erb +0 -11
@@ -0,0 +1 @@
|
|
1
|
+
zh-TW:
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimAssemblyTypes < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_assemblies_types do |t|
|
6
|
+
t.jsonb :title, null: false
|
7
|
+
|
8
|
+
t.integer :decidim_organization_id,
|
9
|
+
foreign_key: true,
|
10
|
+
index: {
|
11
|
+
name: "index_decidim_assemblies_types_on_decidim_organization_id"
|
12
|
+
}
|
13
|
+
|
14
|
+
t.timestamps
|
15
|
+
end
|
16
|
+
|
17
|
+
add_reference :decidim_assemblies, :decidim_assemblies_type, index: true, foreign_key: true
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Migrates freezed assembly types to a table where to configure them
|
4
|
+
class MigrateDecidimAssemblyTypes < ActiveRecord::Migration[5.2]
|
5
|
+
LEGACY_TYPES = {
|
6
|
+
"government" => "Government",
|
7
|
+
"executive" => "Executive",
|
8
|
+
"consultative_advisory" => "Consultative/Advisory",
|
9
|
+
"participatory" => "Participatory",
|
10
|
+
"working_group" => "Working group",
|
11
|
+
"commission" => "Comission",
|
12
|
+
"others" => "Others"
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
class Organization < ApplicationRecord
|
16
|
+
self.table_name = :decidim_organizations
|
17
|
+
end
|
18
|
+
|
19
|
+
class Assembly < ApplicationRecord
|
20
|
+
self.table_name = :decidim_assemblies
|
21
|
+
end
|
22
|
+
|
23
|
+
class AssemblyType < ApplicationRecord
|
24
|
+
self.table_name = :decidim_assemblies_types
|
25
|
+
end
|
26
|
+
|
27
|
+
def up
|
28
|
+
Organization.find_each do |organization|
|
29
|
+
LEGACY_TYPES.each do |type, _english|
|
30
|
+
title = {}
|
31
|
+
organization.available_locales.each do |lang|
|
32
|
+
t = type_localized(type, lang)
|
33
|
+
title[lang] = t if t
|
34
|
+
end
|
35
|
+
|
36
|
+
unless type == "others"
|
37
|
+
assembly_type = AssemblyType.find_or_create_by(
|
38
|
+
decidim_organization_id: organization.id,
|
39
|
+
title: title
|
40
|
+
)
|
41
|
+
end
|
42
|
+
Assembly.where(decidim_organization_id: organization.id, assembly_type: type).each do |assembly|
|
43
|
+
if type == "others"
|
44
|
+
assembly_type = AssemblyType.find_or_create_by(
|
45
|
+
decidim_organization_id: organization.id,
|
46
|
+
title: assembly.assembly_type_other
|
47
|
+
)
|
48
|
+
end
|
49
|
+
assembly.decidim_assemblies_type_id = assembly_type.id
|
50
|
+
assembly.save
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def down
|
57
|
+
Assembly.find_each do |assembly|
|
58
|
+
next unless assembly.decidim_assemblies_type_id
|
59
|
+
|
60
|
+
assembly_type = AssemblyType.find(assembly.decidim_assemblies_type_id)
|
61
|
+
next unless assembly_type
|
62
|
+
|
63
|
+
key = LEGACY_TYPES.find { |type, _english| type_localized(type, "en") == assembly_type.title["en"] }
|
64
|
+
|
65
|
+
unless key
|
66
|
+
key = "others"
|
67
|
+
assembly.assembly_type_other = assembly_type.title
|
68
|
+
end
|
69
|
+
assembly.assembly_type = key
|
70
|
+
assembly.save
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def type_localized(type, lang)
|
77
|
+
I18n.with_locale(lang) do
|
78
|
+
t = I18n.t("assembly_types.#{type}", scope: "decidim.assemblies", default: false)
|
79
|
+
t ||= LEGACY_TYPES[type] if lang == "en"
|
80
|
+
t
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateDecidimAssembliesSettings < ActiveRecord::Migration[5.2]
|
4
|
+
def change
|
5
|
+
create_table :decidim_assemblies_settings do |t|
|
6
|
+
t.boolean :enable_organization_chart, default: true
|
7
|
+
t.references :decidim_organization, foreign_key: true
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
data/db/seeds/city.jpeg
CHANGED
Binary file
|
data/db/seeds/city2.jpeg
CHANGED
Binary file
|
@@ -15,6 +15,9 @@ module Decidim
|
|
15
15
|
paths["lib/tasks"] = nil
|
16
16
|
|
17
17
|
routes do
|
18
|
+
resources :assemblies_types
|
19
|
+
resource :assemblies_settings, only: [:edit, :update], controller: "assemblies_settings"
|
20
|
+
|
18
21
|
resources :assemblies, param: :slug, except: [:show, :destroy] do
|
19
22
|
resource :publish, controller: "assembly_publications", only: [:create, :destroy]
|
20
23
|
resources :copies, controller: "assembly_copies", only: [:new, :create]
|
@@ -28,6 +31,12 @@ module Decidim
|
|
28
31
|
|
29
32
|
resources :attachment_collections, controller: "assembly_attachment_collections"
|
30
33
|
resources :attachments, controller: "assembly_attachments"
|
34
|
+
|
35
|
+
resource :export, controller: "assembly_exports", only: :create
|
36
|
+
|
37
|
+
collection do
|
38
|
+
resources :imports, controller: "assembly_imports", only: [:new, :create]
|
39
|
+
end
|
31
40
|
end
|
32
41
|
|
33
42
|
scope "/assemblies/:assembly_slug" do
|
@@ -38,6 +47,7 @@ module Decidim
|
|
38
47
|
member do
|
39
48
|
put :publish
|
40
49
|
put :unpublish
|
50
|
+
get :share
|
41
51
|
end
|
42
52
|
resources :exports, only: :create
|
43
53
|
end
|
@@ -4,6 +4,7 @@ require "rails"
|
|
4
4
|
require "active_support/all"
|
5
5
|
|
6
6
|
require "decidim/core"
|
7
|
+
require "decidim/assemblies/query_extensions"
|
7
8
|
|
8
9
|
module Decidim
|
9
10
|
module Assemblies
|
@@ -24,7 +25,7 @@ module Decidim
|
|
24
25
|
|
25
26
|
resources :assemblies, only: [:index, :show], param: :slug, path: "assemblies" do
|
26
27
|
resources :assembly_members, only: :index, path: "members"
|
27
|
-
resource :
|
28
|
+
resource :widget, only: :show, path: "embed"
|
28
29
|
end
|
29
30
|
|
30
31
|
scope "/assemblies/:assembly_slug/f/:component_id" do
|
@@ -108,6 +109,12 @@ module Decidim
|
|
108
109
|
end
|
109
110
|
end
|
110
111
|
end
|
112
|
+
|
113
|
+
initializer "decidim_assemblies.query_extensions" do
|
114
|
+
Decidim::Api::QueryType.define do
|
115
|
+
QueryExtensions.define(self)
|
116
|
+
end
|
117
|
+
end
|
111
118
|
end
|
112
119
|
end
|
113
120
|
end
|
@@ -10,9 +10,12 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
10
10
|
|
11
11
|
participatory_space.permissions_class_name = "Decidim::Assemblies::Permissions"
|
12
12
|
|
13
|
+
participatory_space.query_type = "Decidim::Assemblies::AssemblyType"
|
14
|
+
|
13
15
|
participatory_space.register_resource(:assembly) do |resource|
|
14
16
|
resource.model_class_name = "Decidim::Assembly"
|
15
17
|
resource.card = "decidim/assemblies/assembly"
|
18
|
+
resource.searchable = true
|
16
19
|
end
|
17
20
|
|
18
21
|
participatory_space.context(:public) do |context|
|
@@ -25,6 +28,19 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
25
28
|
context.layout = "layouts/decidim/admin/assembly"
|
26
29
|
end
|
27
30
|
|
31
|
+
participatory_space.exports :assemblies do |export|
|
32
|
+
export.collection do |assembly|
|
33
|
+
Decidim::Assembly.where(id: assembly.id)
|
34
|
+
end
|
35
|
+
|
36
|
+
export.serializer Decidim::Assemblies::AssemblySerializer
|
37
|
+
end
|
38
|
+
|
39
|
+
participatory_space.register_on_destroy_account do |user|
|
40
|
+
Decidim::AssemblyUserRole.where(user: user).destroy_all
|
41
|
+
Decidim::AssemblyMember.where(user: user).destroy_all
|
42
|
+
end
|
43
|
+
|
28
44
|
participatory_space.seeds do
|
29
45
|
organization = Decidim::Organization.first
|
30
46
|
seeds_root = File.join(__dir__, "..", "..", "..", "db", "seeds")
|
@@ -32,7 +48,7 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
32
48
|
Decidim::ContentBlock.create(
|
33
49
|
organization: organization,
|
34
50
|
weight: 32,
|
35
|
-
|
51
|
+
scope_name: :homepage,
|
36
52
|
manifest_name: :highlighted_assemblies,
|
37
53
|
published_at: Time.current
|
38
54
|
)
|
@@ -49,11 +65,11 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
49
65
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
50
66
|
Decidim::Faker::Localized.paragraph(3)
|
51
67
|
end,
|
52
|
-
|
53
|
-
|
68
|
+
organization: organization,
|
69
|
+
hero_image: File.new(File.join(seeds_root, "city.jpeg")), # Keep after organization
|
70
|
+
banner_image: File.new(File.join(seeds_root, "city2.jpeg")), # Keep after organization
|
54
71
|
promoted: true,
|
55
72
|
published_at: 2.weeks.ago,
|
56
|
-
organization: organization,
|
57
73
|
meta_scope: Decidim::Faker::Localized.word,
|
58
74
|
developer_group: Decidim::Faker::Localized.sentence(1),
|
59
75
|
local_area: Decidim::Faker::Localized.sentence(2),
|
@@ -67,8 +83,7 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
67
83
|
composition: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
68
84
|
Decidim::Faker::Localized.paragraph(3)
|
69
85
|
end,
|
70
|
-
assembly_type:
|
71
|
-
assembly_type_other: Decidim::Faker::Localized.word,
|
86
|
+
assembly_type: Decidim::AssembliesType.create!(organization: organization, title: Decidim::Faker::Localized.word),
|
72
87
|
creation_date: 1.day.from_now,
|
73
88
|
created_by: "others",
|
74
89
|
created_by_other: Decidim::Faker::Localized.word,
|
@@ -133,11 +148,11 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
133
148
|
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
134
149
|
Decidim::Faker::Localized.paragraph(3)
|
135
150
|
end,
|
136
|
-
|
137
|
-
|
151
|
+
organization: organization,
|
152
|
+
hero_image: File.new(File.join(seeds_root, "city.jpeg")), # Keep after organization
|
153
|
+
banner_image: File.new(File.join(seeds_root, "city2.jpeg")), # Keep after organization
|
138
154
|
promoted: true,
|
139
155
|
published_at: 2.weeks.ago,
|
140
|
-
organization: organization,
|
141
156
|
meta_scope: Decidim::Faker::Localized.word,
|
142
157
|
developer_group: Decidim::Faker::Localized.sentence(1),
|
143
158
|
local_area: Decidim::Faker::Localized.sentence(2),
|
@@ -149,6 +164,7 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
149
164
|
)
|
150
165
|
|
151
166
|
[assembly, child].each do |current_assembly|
|
167
|
+
current_assembly.add_to_index_as_search_resource
|
152
168
|
attachment_collection = Decidim::AttachmentCollection.create!(
|
153
169
|
name: Decidim::Faker::Localized.word,
|
154
170
|
description: Decidim::Faker::Localized.sentence(5),
|
@@ -158,23 +174,23 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
|
|
158
174
|
Decidim::Attachment.create!(
|
159
175
|
title: Decidim::Faker::Localized.sentence(2),
|
160
176
|
description: Decidim::Faker::Localized.sentence(5),
|
161
|
-
file: File.new(File.join(seeds_root, "Exampledocument.pdf")),
|
162
177
|
attachment_collection: attachment_collection,
|
163
|
-
attached_to: current_assembly
|
178
|
+
attached_to: current_assembly,
|
179
|
+
file: File.new(File.join(seeds_root, "Exampledocument.pdf")) # Keep after attached_to
|
164
180
|
)
|
165
181
|
|
166
182
|
Decidim::Attachment.create!(
|
167
183
|
title: Decidim::Faker::Localized.sentence(2),
|
168
184
|
description: Decidim::Faker::Localized.sentence(5),
|
169
|
-
|
170
|
-
|
185
|
+
attached_to: current_assembly,
|
186
|
+
file: File.new(File.join(seeds_root, "city.jpeg")) # Keep after attached_to
|
171
187
|
)
|
172
188
|
|
173
189
|
Decidim::Attachment.create!(
|
174
190
|
title: Decidim::Faker::Localized.sentence(2),
|
175
191
|
description: Decidim::Faker::Localized.sentence(5),
|
176
|
-
|
177
|
-
|
192
|
+
attached_to: current_assembly,
|
193
|
+
file: File.new(File.join(seeds_root, "Exampledocument.pdf")) # Keep after attached_to
|
178
194
|
)
|
179
195
|
|
180
196
|
2.times do
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Assemblies
|
5
|
+
# This module's job is to extend the API with custom fields related to
|
6
|
+
# decidim-assemblies.
|
7
|
+
module QueryExtensions
|
8
|
+
# Public: Extends a type with `decidim-assemblies`'s fields.
|
9
|
+
#
|
10
|
+
# type - A GraphQL::BaseType to extend.
|
11
|
+
#
|
12
|
+
# Returns nothing.
|
13
|
+
def self.define(type)
|
14
|
+
type.field :assembliesTypes do
|
15
|
+
type !types[AssembliesTypeType]
|
16
|
+
description "Lists all assemblies types"
|
17
|
+
|
18
|
+
resolve lambda { |_obj, _args, ctx|
|
19
|
+
Decidim::AssembliesType.where(
|
20
|
+
organization: ctx[:current_organization]
|
21
|
+
)
|
22
|
+
}
|
23
|
+
end
|
24
|
+
|
25
|
+
type.field :assembliesType do
|
26
|
+
type AssembliesTypeType
|
27
|
+
description "Finds an assemblies type group"
|
28
|
+
argument :id, !types.ID, "The ID of the Assemblies type"
|
29
|
+
|
30
|
+
resolve lambda { |_obj, args, ctx|
|
31
|
+
Decidim::AssembliesType.find_by(
|
32
|
+
organization: ctx[:current_organization],
|
33
|
+
id: args[:id]
|
34
|
+
)
|
35
|
+
}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -8,16 +8,26 @@ FactoryBot.define do
|
|
8
8
|
"#{Faker::Internet.slug(nil, "-")}-#{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
|
+
factory :assemblies_type, class: "Decidim::AssembliesType" do
|
17
|
+
title { generate_localized_title }
|
18
|
+
organization
|
19
|
+
end
|
20
|
+
|
11
21
|
factory :assembly, class: "Decidim::Assembly" do
|
12
22
|
title { generate_localized_title }
|
13
23
|
slug { generate(:assembly_slug) }
|
14
24
|
subtitle { generate_localized_title }
|
15
25
|
short_description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
16
26
|
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
17
|
-
hero_image { Decidim::Dev.test_file("city.jpeg", "image/jpeg") }
|
18
|
-
banner_image { Decidim::Dev.test_file("city2.jpeg", "image/jpeg") }
|
19
|
-
published_at { Time.current }
|
20
27
|
organization
|
28
|
+
hero_image { Decidim::Dev.test_file("city.jpeg", "image/jpeg") } # Keep after organization
|
29
|
+
banner_image { Decidim::Dev.test_file("city2.jpeg", "image/jpeg") } # Keep after organization
|
30
|
+
published_at { Time.current }
|
21
31
|
meta_scope { Decidim::Faker::Localized.word }
|
22
32
|
developer_group { generate_localized_title }
|
23
33
|
local_area { generate_localized_title }
|
@@ -28,8 +38,6 @@ FactoryBot.define do
|
|
28
38
|
private_space { false }
|
29
39
|
purpose_of_action { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
30
40
|
composition { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
31
|
-
assembly_type { "others" }
|
32
|
-
assembly_type_other { generate_localized_title }
|
33
41
|
creation_date { 1.month.ago }
|
34
42
|
created_by { "others" }
|
35
43
|
created_by_other { Decidim::Faker::Localized.word }
|
@@ -46,6 +54,10 @@ FactoryBot.define do
|
|
46
54
|
youtube_handler { "others" }
|
47
55
|
github_handler { "others" }
|
48
56
|
|
57
|
+
trait :with_type do
|
58
|
+
assembly_type { create :assemblies_type, organization: organization }
|
59
|
+
end
|
60
|
+
|
49
61
|
trait :promoted do
|
50
62
|
promoted { true }
|
51
63
|
end
|
@@ -130,6 +142,21 @@ FactoryBot.define do
|
|
130
142
|
end
|
131
143
|
end
|
132
144
|
|
145
|
+
factory :assembly_valuator, parent: :user, class: "Decidim::User" do
|
146
|
+
transient do
|
147
|
+
assembly { create(:assembly) }
|
148
|
+
end
|
149
|
+
|
150
|
+
organization { assembly.organization }
|
151
|
+
|
152
|
+
after(:create) do |user, evaluator|
|
153
|
+
create :assembly_user_role,
|
154
|
+
user: user,
|
155
|
+
assembly: evaluator.assembly,
|
156
|
+
role: :valuator
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
133
160
|
factory :assembly_member, class: "Decidim::AssemblyMember" do
|
134
161
|
assembly { create(:assembly) }
|
135
162
|
|