decidim-assemblies 0.20.0 → 0.23.1.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/assemblies/assembly.svg +1 -3
  3. data/app/assets/javascripts/decidim/assemblies/orgchart.js.es6 +698 -0
  4. data/app/cells/decidim/assemblies/assembly_m/footer.erb +2 -2
  5. data/app/cells/decidim/assemblies/assembly_m_cell.rb +5 -5
  6. data/app/cells/decidim/assemblies/assembly_member/show.erb +4 -4
  7. data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies/show.erb +10 -11
  8. data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb +1 -0
  9. data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +45 -0
  10. data/app/commands/decidim/assemblies/admin/create_assembly.rb +1 -2
  11. data/app/commands/decidim/assemblies/admin/create_assembly_admin.rb +2 -1
  12. data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +12 -3
  13. data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +45 -0
  14. data/app/commands/decidim/assemblies/admin/import_assembly.rb +72 -0
  15. data/app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb +22 -0
  16. data/app/commands/decidim/assemblies/admin/update_assemblies_setting.rb +46 -0
  17. data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +46 -0
  18. data/app/commands/decidim/assemblies/admin/update_assembly.rb +11 -7
  19. data/app/commands/decidim/assemblies/admin/update_assembly_admin.rb +2 -1
  20. data/app/controllers/concerns/decidim/assemblies/admin/filterable.rb +30 -0
  21. data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +8 -23
  22. data/app/controllers/decidim/assemblies/admin/assemblies_settings_controller.rb +49 -0
  23. data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +107 -0
  24. data/app/controllers/decidim/assemblies/admin/assembly_exports_controller.rb +24 -0
  25. data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +31 -0
  26. data/app/controllers/decidim/assemblies/admin/assembly_user_roles_controller.rb +2 -1
  27. data/app/controllers/decidim/assemblies/assemblies_controller.rb +6 -2
  28. data/app/controllers/decidim/assemblies/{assembly_widgets_controller.rb → widgets_controller.rb} +2 -2
  29. data/app/events/decidim/assemblies/create_assembly_member_event.rb +17 -0
  30. data/app/events/decidim/role_assigned_to_assembly_event.rb +28 -0
  31. data/app/forms/decidim/assemblies/admin/assemblies_setting_form.rb +14 -0
  32. data/app/forms/decidim/assemblies/admin/assemblies_type_form.rb +17 -0
  33. data/app/forms/decidim/assemblies/admin/assembly_form.rb +37 -19
  34. data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +83 -0
  35. data/app/forms/decidim/assemblies/admin/assembly_user_role_form.rb +8 -2
  36. data/app/helpers/decidim/assemblies/admin/assemblies_helper.rb +6 -0
  37. data/app/helpers/decidim/assemblies/assemblies_helper.rb +6 -3
  38. data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +10 -7
  39. data/app/models/decidim/assemblies_setting.rb +17 -0
  40. data/app/models/decidim/assemblies_type.rb +27 -0
  41. data/app/models/decidim/assembly.rb +26 -3
  42. data/app/models/decidim/assembly_user_role.rb +1 -1
  43. data/app/permissions/decidim/assemblies/permissions.rb +60 -2
  44. data/app/presenters/decidim/assemblies/admin_log/assemblies_setting_presenter.rb +27 -0
  45. data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +43 -0
  46. data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -2
  47. data/app/presenters/decidim/assemblies/assembly_presenter.rb +29 -0
  48. data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +1 -1
  49. data/app/presenters/decidim/log/value_types/assembly_type_presenter.rb +29 -0
  50. data/app/queries/decidim/assemblies/filtered_assemblies.rb +2 -2
  51. data/app/queries/decidim/assemblies/parent_assemblies_for_select.rb +42 -0
  52. data/app/serializers/decidim/assemblies/assembly_importer.rb +172 -0
  53. data/app/serializers/decidim/assemblies/assembly_serializer.rb +147 -0
  54. data/app/services/decidim/assemblies/assembly_search.rb +3 -3
  55. data/app/types/decidim/assemblies/assemblies_type_type.rb +17 -0
  56. data/app/types/decidim/assemblies/assembly_member_type.rb +29 -0
  57. data/app/types/decidim/assemblies/assembly_type.rb +67 -0
  58. data/app/views/decidim/assemblies/_filter_by_type.html.erb +11 -7
  59. data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +2 -6
  60. data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +18 -4
  61. data/app/views/decidim/assemblies/admin/assemblies_settings/_form.html.erb +10 -0
  62. data/app/views/decidim/assemblies/admin/assemblies_settings/edit.html.erb +6 -0
  63. data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +11 -0
  64. data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +6 -0
  65. data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +43 -0
  66. data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +7 -0
  67. data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +46 -0
  68. data/app/views/decidim/assemblies/admin/assembly_imports/new.html.erb +7 -0
  69. data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +30 -30
  70. data/app/views/decidim/assemblies/assemblies/_parent_assemblies.html.erb +2 -2
  71. data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +3 -3
  72. data/app/views/decidim/assemblies/assemblies/index.html.erb +11 -8
  73. data/app/views/decidim/assemblies/assemblies/show.html.erb +11 -14
  74. data/app/views/decidim/assemblies/assembly_members/index.html.erb +1 -1
  75. data/app/views/layouts/decidim/admin/assemblies.html.erb +22 -0
  76. data/app/views/layouts/decidim/admin/assembly.html.erb +2 -2
  77. data/app/views/layouts/decidim/assembly.html.erb +1 -0
  78. data/config/locales/am-ET.yml +1 -0
  79. data/config/locales/ar.yml +60 -27
  80. data/config/locales/bg-BG.yml +7 -0
  81. data/config/locales/bg.yml +7 -0
  82. data/config/locales/ca.yml +101 -1
  83. data/config/locales/cs.yml +152 -52
  84. data/config/locales/da-DK.yml +1 -0
  85. data/config/locales/da.yml +1 -0
  86. data/config/locales/de.yml +99 -0
  87. data/config/locales/el-GR.yml +1 -0
  88. data/config/locales/el.yml +475 -0
  89. data/config/locales/en.yml +100 -0
  90. data/config/locales/eo.yml +1 -0
  91. data/config/locales/es-MX.yml +100 -0
  92. data/config/locales/es-PY.yml +100 -0
  93. data/config/locales/es.yml +100 -0
  94. data/config/locales/et-EE.yml +1 -0
  95. data/config/locales/et.yml +1 -0
  96. data/config/locales/eu.yml +11 -0
  97. data/config/locales/fi-plain.yml +97 -0
  98. data/config/locales/fi.yml +103 -6
  99. data/config/locales/fr-CA.yml +478 -0
  100. data/config/locales/fr.yml +100 -0
  101. data/config/locales/ga-IE.yml +1 -0
  102. data/config/locales/gl.yml +11 -0
  103. data/config/locales/hr-HR.yml +1 -0
  104. data/config/locales/hr.yml +1 -0
  105. data/config/locales/hu.yml +85 -2
  106. data/config/locales/id-ID.yml +11 -0
  107. data/config/locales/is-IS.yml +263 -0
  108. data/config/locales/is.yml +263 -0
  109. data/config/locales/it.yml +171 -74
  110. data/config/locales/ja-JP.yml +471 -0
  111. data/config/locales/ja.yml +471 -0
  112. data/config/locales/ko-KR.yml +1 -0
  113. data/config/locales/ko.yml +1 -0
  114. data/config/locales/lt-LT.yml +1 -0
  115. data/config/locales/lt.yml +1 -0
  116. data/config/locales/lv.yml +454 -0
  117. data/config/locales/mt-MT.yml +1 -0
  118. data/config/locales/mt.yml +1 -0
  119. data/config/locales/nl.yml +103 -6
  120. data/config/locales/no.yml +349 -7
  121. data/config/locales/om-ET.yml +1 -0
  122. data/config/locales/pl.yml +250 -151
  123. data/config/locales/pt-BR.yml +12 -1
  124. data/config/locales/pt.yml +217 -118
  125. data/config/locales/ro-RO.yml +441 -0
  126. data/config/locales/ru.yml +11 -0
  127. data/config/locales/sk-SK.yml +168 -0
  128. data/config/locales/sk.yml +172 -0
  129. data/config/locales/sl.yml +283 -0
  130. data/config/locales/so-SO.yml +1 -0
  131. data/config/locales/sr-CS.yml +73 -0
  132. data/config/locales/sv.yml +188 -88
  133. data/config/locales/ti-ER.yml +1 -0
  134. data/config/locales/tr-TR.yml +30 -0
  135. data/config/locales/uk.yml +11 -0
  136. data/config/locales/vi-VN.yml +1 -0
  137. data/config/locales/vi.yml +1 -0
  138. data/config/locales/zh-CN.yml +471 -0
  139. data/config/locales/zh-TW.yml +1 -0
  140. data/db/migrate/20200108113855_create_decidim_assembly_types.rb +19 -0
  141. data/db/migrate/20200108123050_migrate_decidim_assembly_types.rb +83 -0
  142. data/db/migrate/20200320105906_index_foreign_keys_in_decidim_assemblies.rb +7 -0
  143. data/db/migrate/20200320105907_index_foreign_keys_in_decidim_assembly_user_roles.rb +7 -0
  144. data/db/migrate/20200416132109_remove_legacy_decidim_assembly_type.rb +8 -0
  145. data/db/migrate/20200430202456_create_decidim_assemblies_settings.rb +10 -0
  146. data/db/seeds/city.jpeg +0 -0
  147. data/db/seeds/city2.jpeg +0 -0
  148. data/lib/decidim/assemblies/admin_engine.rb +10 -0
  149. data/lib/decidim/assemblies/engine.rb +8 -1
  150. data/lib/decidim/assemblies/participatory_space.rb +29 -15
  151. data/lib/decidim/assemblies/query_extensions.rb +40 -0
  152. data/lib/decidim/assemblies/test/factories.rb +32 -5
  153. data/lib/decidim/assemblies/version.rb +1 -1
  154. metadata +93 -13
  155. 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,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class IndexForeignKeysInDecidimAssemblies < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_index :decidim_assemblies, :decidim_scope_id
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ class IndexForeignKeysInDecidimAssemblyUserRoles < ActiveRecord::Migration[5.2]
4
+ def change
5
+ add_index :decidim_assembly_user_roles, :decidim_user_id
6
+ end
7
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoveLegacyDecidimAssemblyType < ActiveRecord::Migration[5.2]
4
+ def change
5
+ remove_column :decidim_assemblies, :assembly_type, :string
6
+ remove_column :decidim_assemblies, :assembly_type_other, :jsonb
7
+ end
8
+ 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
Binary file
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 :assembly_widget, only: :show, path: "embed"
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,6 +10,8 @@ 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"
@@ -26,6 +28,19 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
26
28
  context.layout = "layouts/decidim/admin/assembly"
27
29
  end
28
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
+
29
44
  participatory_space.seeds do
30
45
  organization = Decidim::Organization.first
31
46
  seeds_root = File.join(__dir__, "..", "..", "..", "db", "seeds")
@@ -33,7 +48,7 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
33
48
  Decidim::ContentBlock.create(
34
49
  organization: organization,
35
50
  weight: 32,
36
- scope: :homepage,
51
+ scope_name: :homepage,
37
52
  manifest_name: :highlighted_assemblies,
38
53
  published_at: Time.current
39
54
  )
@@ -50,11 +65,11 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
50
65
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
51
66
  Decidim::Faker::Localized.paragraph(3)
52
67
  end,
53
- hero_image: File.new(File.join(seeds_root, "city.jpeg")),
54
- banner_image: File.new(File.join(seeds_root, "city2.jpeg")),
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
55
71
  promoted: true,
56
72
  published_at: 2.weeks.ago,
57
- organization: organization,
58
73
  meta_scope: Decidim::Faker::Localized.word,
59
74
  developer_group: Decidim::Faker::Localized.sentence(1),
60
75
  local_area: Decidim::Faker::Localized.sentence(2),
@@ -68,8 +83,7 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
68
83
  composition: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
69
84
  Decidim::Faker::Localized.paragraph(3)
70
85
  end,
71
- assembly_type: "others",
72
- assembly_type_other: Decidim::Faker::Localized.word,
86
+ assembly_type: Decidim::AssembliesType.create!(organization: organization, title: Decidim::Faker::Localized.word),
73
87
  creation_date: 1.day.from_now,
74
88
  created_by: "others",
75
89
  created_by_other: Decidim::Faker::Localized.word,
@@ -134,11 +148,11 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
134
148
  description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
135
149
  Decidim::Faker::Localized.paragraph(3)
136
150
  end,
137
- hero_image: File.new(File.join(seeds_root, "city.jpeg")),
138
- banner_image: File.new(File.join(seeds_root, "city2.jpeg")),
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
139
154
  promoted: true,
140
155
  published_at: 2.weeks.ago,
141
- organization: organization,
142
156
  meta_scope: Decidim::Faker::Localized.word,
143
157
  developer_group: Decidim::Faker::Localized.sentence(1),
144
158
  local_area: Decidim::Faker::Localized.sentence(2),
@@ -160,23 +174,23 @@ Decidim.register_participatory_space(:assemblies) do |participatory_space|
160
174
  Decidim::Attachment.create!(
161
175
  title: Decidim::Faker::Localized.sentence(2),
162
176
  description: Decidim::Faker::Localized.sentence(5),
163
- file: File.new(File.join(seeds_root, "Exampledocument.pdf")),
164
177
  attachment_collection: attachment_collection,
165
- attached_to: current_assembly
178
+ attached_to: current_assembly,
179
+ file: File.new(File.join(seeds_root, "Exampledocument.pdf")) # Keep after attached_to
166
180
  )
167
181
 
168
182
  Decidim::Attachment.create!(
169
183
  title: Decidim::Faker::Localized.sentence(2),
170
184
  description: Decidim::Faker::Localized.sentence(5),
171
- file: File.new(File.join(seeds_root, "city.jpeg")),
172
- attached_to: current_assembly
185
+ attached_to: current_assembly,
186
+ file: File.new(File.join(seeds_root, "city.jpeg")) # Keep after attached_to
173
187
  )
174
188
 
175
189
  Decidim::Attachment.create!(
176
190
  title: Decidim::Faker::Localized.sentence(2),
177
191
  description: Decidim::Faker::Localized.sentence(5),
178
- file: File.new(File.join(seeds_root, "Exampledocument.pdf")),
179
- attached_to: current_assembly
192
+ attached_to: current_assembly,
193
+ file: File.new(File.join(seeds_root, "Exampledocument.pdf")) # Keep after attached_to
180
194
  )
181
195
 
182
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
 
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-assemblies version.
5
5
  module Assemblies
6
6
  def self.version
7
- "0.20.0"
7
+ "0.23.1.rc1"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-assemblies
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.0
4
+ version: 0.23.1.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-01-08 00:00:00.000000000 Z
13
+ date: 2020-11-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,42 +18,42 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.20.0
21
+ version: 0.23.1.rc1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.20.0
28
+ version: 0.23.1.rc1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: decidim-admin
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.20.0
35
+ version: 0.23.1.rc1
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.20.0
42
+ version: 0.23.1.rc1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: decidim-dev
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.20.0
49
+ version: 0.23.1.rc1
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.20.0
56
+ version: 0.23.1.rc1
57
57
  description: Assemblies component for decidim.
58
58
  email:
59
59
  - josepjaume@gmail.com
@@ -71,6 +71,7 @@ files:
71
71
  - app/assets/javascripts/decidim/assemblies/admin/assemblies.js.es6
72
72
  - app/assets/javascripts/decidim/assemblies/admin/assembly_members.js.es6
73
73
  - app/assets/javascripts/decidim/assemblies/assemblies.js.es6
74
+ - app/assets/javascripts/decidim/assemblies/orgchart.js.es6
74
75
  - app/cells/decidim/assemblies/assembly_cell.rb
75
76
  - app/cells/decidim/assemblies/assembly_m/footer.erb
76
77
  - app/cells/decidim/assemblies/assembly_m/tags.erb
@@ -83,24 +84,35 @@ files:
83
84
  - app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_settings_form_cell.rb
84
85
  - app/cells/decidim/assembly_activity_cell.rb
85
86
  - app/commands/decidim/assemblies/admin/copy_assembly.rb
87
+ - app/commands/decidim/assemblies/admin/create_assemblies_type.rb
86
88
  - app/commands/decidim/assemblies/admin/create_assembly.rb
87
89
  - app/commands/decidim/assemblies/admin/create_assembly_admin.rb
88
90
  - app/commands/decidim/assemblies/admin/create_assembly_member.rb
91
+ - app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb
89
92
  - app/commands/decidim/assemblies/admin/destroy_assembly_admin.rb
90
93
  - app/commands/decidim/assemblies/admin/destroy_assembly_member.rb
94
+ - app/commands/decidim/assemblies/admin/import_assembly.rb
95
+ - app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb
91
96
  - app/commands/decidim/assemblies/admin/publish_assembly.rb
92
97
  - app/commands/decidim/assemblies/admin/unpublish_assembly.rb
98
+ - app/commands/decidim/assemblies/admin/update_assemblies_setting.rb
99
+ - app/commands/decidim/assemblies/admin/update_assemblies_type.rb
93
100
  - app/commands/decidim/assemblies/admin/update_assembly.rb
94
101
  - app/commands/decidim/assemblies/admin/update_assembly_admin.rb
95
102
  - app/commands/decidim/assemblies/admin/update_assembly_member.rb
96
103
  - app/constraints/decidim/assemblies/current_assembly.rb
97
104
  - app/constraints/decidim/assemblies/current_component.rb
98
105
  - app/controllers/concerns/decidim/assemblies/admin/assembly_context.rb
106
+ - app/controllers/concerns/decidim/assemblies/admin/filterable.rb
99
107
  - app/controllers/decidim/assemblies/admin/application_controller.rb
100
108
  - app/controllers/decidim/assemblies/admin/assemblies_controller.rb
109
+ - app/controllers/decidim/assemblies/admin/assemblies_settings_controller.rb
110
+ - app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb
101
111
  - app/controllers/decidim/assemblies/admin/assembly_attachment_collections_controller.rb
102
112
  - app/controllers/decidim/assemblies/admin/assembly_attachments_controller.rb
103
113
  - app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
114
+ - app/controllers/decidim/assemblies/admin/assembly_exports_controller.rb
115
+ - app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
104
116
  - app/controllers/decidim/assemblies/admin/assembly_members_controller.rb
105
117
  - app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
106
118
  - app/controllers/decidim/assemblies/admin/assembly_user_roles_controller.rb
@@ -115,28 +127,39 @@ files:
115
127
  - app/controllers/decidim/assemblies/application_controller.rb
116
128
  - app/controllers/decidim/assemblies/assemblies_controller.rb
117
129
  - app/controllers/decidim/assemblies/assembly_members_controller.rb
118
- - app/controllers/decidim/assemblies/assembly_widgets_controller.rb
130
+ - app/controllers/decidim/assemblies/widgets_controller.rb
131
+ - app/events/decidim/assemblies/create_assembly_member_event.rb
132
+ - app/events/decidim/role_assigned_to_assembly_event.rb
133
+ - app/forms/decidim/assemblies/admin/assemblies_setting_form.rb
134
+ - app/forms/decidim/assemblies/admin/assemblies_type_form.rb
119
135
  - app/forms/decidim/assemblies/admin/assembly_copy_form.rb
120
136
  - app/forms/decidim/assemblies/admin/assembly_form.rb
137
+ - app/forms/decidim/assemblies/admin/assembly_import_form.rb
121
138
  - app/forms/decidim/assemblies/admin/assembly_member_form.rb
122
139
  - app/forms/decidim/assemblies/admin/assembly_user_role_form.rb
123
140
  - app/helpers/decidim/assemblies/admin/assemblies_helper.rb
124
141
  - app/helpers/decidim/assemblies/assemblies_helper.rb
125
142
  - app/helpers/decidim/assemblies/filter_assemblies_helper.rb
143
+ - app/models/decidim/assemblies_setting.rb
144
+ - app/models/decidim/assemblies_type.rb
126
145
  - app/models/decidim/assembly.rb
127
146
  - app/models/decidim/assembly_member.rb
128
147
  - app/models/decidim/assembly_user_role.rb
129
148
  - app/permissions/decidim/assemblies/permissions.rb
130
149
  - app/presenters/decidim/admin/assembly_member_presenter.rb
150
+ - app/presenters/decidim/assemblies/admin_log/assemblies_setting_presenter.rb
151
+ - app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb
131
152
  - app/presenters/decidim/assemblies/admin_log/assembly_member_presenter.rb
132
153
  - app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb
133
154
  - app/presenters/decidim/assemblies/admin_log/assembly_user_role_presenter.rb
134
155
  - app/presenters/decidim/assemblies/admin_log/value_types/member_position_presenter.rb
135
156
  - app/presenters/decidim/assemblies/admin_log/value_types/role_presenter.rb
157
+ - app/presenters/decidim/assemblies/assembly_presenter.rb
136
158
  - app/presenters/decidim/assemblies/assembly_stats_presenter.rb
137
159
  - app/presenters/decidim/assembly_member_presenter.rb
138
160
  - app/presenters/decidim/assembly_presenter.rb
139
161
  - app/presenters/decidim/log/value_types/assembly_presenter.rb
162
+ - app/presenters/decidim/log/value_types/assembly_type_presenter.rb
140
163
  - app/queries/decidim/assemblies/admin/admin_users.rb
141
164
  - app/queries/decidim/assemblies/admin/assembly_members.rb
142
165
  - app/queries/decidim/assemblies/assemblies_with_user_role.rb
@@ -146,19 +169,33 @@ files:
146
169
  - app/queries/decidim/assemblies/organization_prioritized_assemblies.rb
147
170
  - app/queries/decidim/assemblies/organization_published_assemblies.rb
148
171
  - app/queries/decidim/assemblies/parent_assemblies.rb
172
+ - app/queries/decidim/assemblies/parent_assemblies_for_select.rb
149
173
  - app/queries/decidim/assemblies/prioritized_assemblies.rb
150
174
  - app/queries/decidim/assemblies/promoted_assemblies.rb
151
175
  - app/queries/decidim/assemblies/published_assemblies.rb
152
176
  - app/queries/decidim/assemblies/visible_assemblies.rb
177
+ - app/serializers/decidim/assemblies/assembly_importer.rb
178
+ - app/serializers/decidim/assemblies/assembly_serializer.rb
153
179
  - app/services/decidim/assemblies/assembly_search.rb
180
+ - app/types/decidim/assemblies/assemblies_type_type.rb
181
+ - app/types/decidim/assemblies/assembly_member_type.rb
182
+ - app/types/decidim/assemblies/assembly_type.rb
154
183
  - app/views/decidim/assemblies/_assembly.html.erb
155
184
  - app/views/decidim/assemblies/_filter_by_type.html.erb
156
185
  - app/views/decidim/assemblies/admin/assemblies/_form.html.erb
157
186
  - app/views/decidim/assemblies/admin/assemblies/edit.html.erb
158
187
  - app/views/decidim/assemblies/admin/assemblies/index.html.erb
159
188
  - app/views/decidim/assemblies/admin/assemblies/new.html.erb
189
+ - app/views/decidim/assemblies/admin/assemblies_settings/_form.html.erb
190
+ - app/views/decidim/assemblies/admin/assemblies_settings/edit.html.erb
191
+ - app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb
192
+ - app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb
193
+ - app/views/decidim/assemblies/admin/assemblies_types/index.html.erb
194
+ - app/views/decidim/assemblies/admin/assemblies_types/new.html.erb
160
195
  - app/views/decidim/assemblies/admin/assembly_copies/_form.html.erb
161
196
  - app/views/decidim/assemblies/admin/assembly_copies/new.html.erb
197
+ - app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb
198
+ - app/views/decidim/assemblies/admin/assembly_imports/new.html.erb
162
199
  - app/views/decidim/assemblies/admin/assembly_members/_form.html.erb
163
200
  - app/views/decidim/assemblies/admin/assembly_members/edit.html.erb
164
201
  - app/views/decidim/assemblies/admin/assembly_members/index.html.erb
@@ -176,7 +213,6 @@ files:
176
213
  - app/views/decidim/assemblies/assemblies/index.js.erb
177
214
  - app/views/decidim/assemblies/assemblies/show.html.erb
178
215
  - app/views/decidim/assemblies/assembly_members/index.html.erb
179
- - app/views/decidim/assemblies/assembly_widgets/show.html.erb
180
216
  - app/views/decidim/assemblies/pages/user_profile/_member_of.html.erb
181
217
  - app/views/decidim/assembly_members/_assembly_member.html.erb
182
218
  - app/views/layouts/decidim/_assembly_header.html.erb
@@ -184,35 +220,72 @@ files:
184
220
  - app/views/layouts/decidim/admin/assemblies.html.erb
185
221
  - app/views/layouts/decidim/admin/assembly.html.erb
186
222
  - app/views/layouts/decidim/assembly.html.erb
223
+ - config/locales/am-ET.yml
187
224
  - config/locales/ar-SA.yml
188
225
  - config/locales/ar.yml
226
+ - config/locales/bg-BG.yml
227
+ - config/locales/bg.yml
189
228
  - config/locales/ca.yml
190
229
  - config/locales/cs-CZ.yml
191
230
  - config/locales/cs.yml
231
+ - config/locales/da-DK.yml
232
+ - config/locales/da.yml
192
233
  - config/locales/de.yml
234
+ - config/locales/el-GR.yml
235
+ - config/locales/el.yml
193
236
  - config/locales/en.yml
194
237
  - config/locales/eo-UY.yml
238
+ - config/locales/eo.yml
195
239
  - config/locales/es-MX.yml
196
240
  - config/locales/es-PY.yml
197
241
  - config/locales/es.yml
242
+ - config/locales/et-EE.yml
243
+ - config/locales/et.yml
198
244
  - config/locales/eu.yml
199
245
  - config/locales/fi-pl.yml
200
246
  - config/locales/fi-plain.yml
201
247
  - config/locales/fi.yml
248
+ - config/locales/fr-CA.yml
202
249
  - config/locales/fr.yml
250
+ - config/locales/ga-IE.yml
203
251
  - config/locales/gl.yml
252
+ - config/locales/hr-HR.yml
253
+ - config/locales/hr.yml
204
254
  - config/locales/hu.yml
205
255
  - config/locales/id-ID.yml
256
+ - config/locales/is-IS.yml
257
+ - config/locales/is.yml
206
258
  - config/locales/it.yml
259
+ - config/locales/ja-JP.yml
260
+ - config/locales/ja.yml
261
+ - config/locales/ko-KR.yml
262
+ - config/locales/ko.yml
263
+ - config/locales/lt-LT.yml
264
+ - config/locales/lt.yml
265
+ - config/locales/lv.yml
266
+ - config/locales/mt-MT.yml
267
+ - config/locales/mt.yml
207
268
  - config/locales/nl.yml
208
269
  - config/locales/no.yml
270
+ - config/locales/om-ET.yml
209
271
  - config/locales/pl.yml
210
272
  - config/locales/pt-BR.yml
211
273
  - config/locales/pt.yml
274
+ - config/locales/ro-RO.yml
212
275
  - config/locales/ru.yml
276
+ - config/locales/sk-SK.yml
277
+ - config/locales/sk.yml
278
+ - config/locales/sl.yml
279
+ - config/locales/so-SO.yml
280
+ - config/locales/sr-CS.yml
213
281
  - config/locales/sv.yml
282
+ - config/locales/ti-ER.yml
214
283
  - config/locales/tr-TR.yml
215
284
  - config/locales/uk.yml
285
+ - config/locales/vi-VN.yml
286
+ - config/locales/vi.yml
287
+ - config/locales/zh-CN.yml
288
+ - config/locales/zh-TW.yml
216
289
  - db/migrate/20170727190859_add_assemblies.rb
217
290
  - db/migrate/20170822153055_add_scopes_enabled_to_assemblies.rb
218
291
  - db/migrate/20180109105917_add_assembly_user_roles.rb
@@ -225,6 +298,12 @@ files:
225
298
  - db/migrate/20180426162405_assembly_member_belongs_to_user.rb
226
299
  - db/migrate/20180515073049_update_assembly_members_index.rb
227
300
  - db/migrate/20190215093700_reset_negative_children_count_counters.rb
301
+ - db/migrate/20200108113855_create_decidim_assembly_types.rb
302
+ - db/migrate/20200108123050_migrate_decidim_assembly_types.rb
303
+ - db/migrate/20200320105906_index_foreign_keys_in_decidim_assemblies.rb
304
+ - db/migrate/20200320105907_index_foreign_keys_in_decidim_assembly_user_roles.rb
305
+ - db/migrate/20200416132109_remove_legacy_decidim_assembly_type.rb
306
+ - db/migrate/20200430202456_create_decidim_assemblies_settings.rb
228
307
  - db/seeds/Exampledocument.pdf
229
308
  - db/seeds/city.jpeg
230
309
  - db/seeds/city2.jpeg
@@ -234,6 +313,7 @@ files:
234
313
  - lib/decidim/assemblies/admin_engine.rb
235
314
  - lib/decidim/assemblies/engine.rb
236
315
  - lib/decidim/assemblies/participatory_space.rb
316
+ - lib/decidim/assemblies/query_extensions.rb
237
317
  - lib/decidim/assemblies/test/factories.rb
238
318
  - lib/decidim/assemblies/version.rb
239
319
  homepage: https://github.com/decidim/decidim
@@ -248,12 +328,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
248
328
  requirements:
249
329
  - - ">="
250
330
  - !ruby/object:Gem::Version
251
- version: '2.5'
331
+ version: '2.6'
252
332
  required_rubygems_version: !ruby/object:Gem::Requirement
253
333
  requirements:
254
- - - ">="
334
+ - - ">"
255
335
  - !ruby/object:Gem::Version
256
- version: '0'
336
+ version: 1.3.1
257
337
  requirements: []
258
338
  rubygems_version: 3.0.3
259
339
  signing_key: