decidim-assemblies 0.20.1 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/assemblies/assembly_m_cell.rb +1 -5
  3. data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +45 -0
  4. data/app/commands/decidim/assemblies/admin/create_assembly.rb +1 -2
  5. data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +45 -0
  6. data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +46 -0
  7. data/app/commands/decidim/assemblies/admin/update_assembly.rb +1 -2
  8. data/app/controllers/concerns/decidim/assemblies/admin/filterable.rb +30 -0
  9. data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +8 -23
  10. data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +107 -0
  11. data/app/controllers/decidim/assemblies/assemblies_controller.rb +1 -1
  12. data/app/forms/decidim/assemblies/admin/assemblies_type_form.rb +17 -0
  13. data/app/forms/decidim/assemblies/admin/assembly_form.rb +19 -10
  14. data/app/helpers/decidim/assemblies/admin/assemblies_helper.rb +6 -0
  15. data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +10 -7
  16. data/app/models/decidim/assemblies_type.rb +24 -0
  17. data/app/models/decidim/assembly.rb +12 -2
  18. data/app/models/decidim/assembly_user_role.rb +1 -1
  19. data/app/permissions/decidim/assemblies/permissions.rb +25 -0
  20. data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +43 -0
  21. data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -2
  22. data/app/presenters/decidim/log/value_types/assembly_type_presenter.rb +29 -0
  23. data/app/queries/decidim/assemblies/filtered_assemblies.rb +2 -2
  24. data/app/queries/decidim/assemblies/parent_assemblies_for_select.rb +23 -0
  25. data/app/services/decidim/assemblies/assembly_search.rb +3 -3
  26. data/app/types/decidim/assemblies/assemblies_type_type.rb +17 -0
  27. data/app/types/decidim/assemblies/assembly_member_type.rb +29 -0
  28. data/app/types/decidim/assemblies/assembly_type.rb +67 -0
  29. data/app/views/decidim/assemblies/_filter_by_type.html.erb +14 -12
  30. data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +2 -6
  31. data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +5 -2
  32. data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +11 -0
  33. data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +6 -0
  34. data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +43 -0
  35. data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +7 -0
  36. data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +30 -30
  37. data/app/views/decidim/assemblies/assemblies/show.html.erb +1 -5
  38. data/app/views/layouts/decidim/admin/assemblies.html.erb +17 -0
  39. data/app/views/layouts/decidim/admin/assembly.html.erb +2 -2
  40. data/config/locales/ar.yml +24 -0
  41. data/config/locales/ca.yml +32 -0
  42. data/config/locales/cs.yml +33 -1
  43. data/config/locales/de.yml +11 -0
  44. data/config/locales/el.yml +1 -0
  45. data/config/locales/en.yml +32 -0
  46. data/config/locales/es-MX.yml +32 -0
  47. data/config/locales/es-PY.yml +32 -0
  48. data/config/locales/es.yml +32 -0
  49. data/config/locales/eu.yml +11 -0
  50. data/config/locales/fi-plain.yml +32 -0
  51. data/config/locales/fi.yml +32 -0
  52. data/config/locales/fr.yml +11 -0
  53. data/config/locales/gl.yml +11 -0
  54. data/config/locales/hu.yml +32 -0
  55. data/config/locales/id-ID.yml +11 -0
  56. data/config/locales/is-IS.yml +11 -0
  57. data/config/locales/it.yml +20 -0
  58. data/config/locales/nl.yml +20 -0
  59. data/config/locales/no.yml +31 -0
  60. data/config/locales/pl.yml +11 -0
  61. data/config/locales/pt-BR.yml +11 -0
  62. data/config/locales/pt.yml +11 -0
  63. data/config/locales/ru.yml +11 -0
  64. data/config/locales/sv.yml +11 -0
  65. data/config/locales/tr-TR.yml +11 -0
  66. data/config/locales/uk.yml +11 -0
  67. data/db/migrate/20200108113855_create_decidim_assembly_types.rb +19 -0
  68. data/db/migrate/20200108123050_migrate_decidim_assembly_types.rb +83 -0
  69. data/lib/decidim/assemblies/admin_engine.rb +2 -0
  70. data/lib/decidim/assemblies/engine.rb +7 -0
  71. data/lib/decidim/assemblies/participatory_space.rb +3 -2
  72. data/lib/decidim/assemblies/query_extensions.rb +40 -0
  73. data/lib/decidim/assemblies/test/factories.rb +24 -2
  74. data/lib/decidim/assemblies/version.rb +1 -1
  75. metadata +29 -9
  76. data/app/views/decidim/assemblies/assembly_widgets/show.html.erb +0 -11
@@ -16,6 +16,7 @@
16
16
  created_by_other: Opprettet av annet
17
17
  creation_date: Dato opprettet
18
18
  decidim_area_id: Område
19
+ decidim_assemblies_type_id: Forsamlingstype
19
20
  decidim_scope_id: Omfang
20
21
  description: Beskrivelse
21
22
  developer_group: Promotør gruppe
@@ -78,6 +79,7 @@
78
79
  admin:
79
80
  actions:
80
81
  new_assembly: Ny forsamling
82
+ new_assembly_type: Ny forsamlingstype
81
83
  assemblies:
82
84
  create:
83
85
  error: Det oppstod et problem med å lage en ny forsamling.
@@ -99,6 +101,18 @@
99
101
  create:
100
102
  error: Det oppstod et problem med å publisere denne forsamlingen.
101
103
  success: Forsamlingen ble duplisert.
104
+ assemblies_types:
105
+ create:
106
+ error: Det oppstod et problem med å lage en ny forsamlingstype.
107
+ success: Forsamlingtypen ble opprettet.
108
+ destroy:
109
+ success: Forsamlingstypen ble slettet.
110
+ new:
111
+ create: Opprett
112
+ title: Ny forsamlingstype
113
+ update:
114
+ error: Det oppsto et problem med å oppdatere denne forsamlingstypen.
115
+ success: Forsamlingstypen ble oppdatert.
102
116
  assembly_copies:
103
117
  new:
104
118
  copy: Kopier
@@ -158,7 +172,12 @@
158
172
  info: Info
159
173
  moderations: Moderering
160
174
  private_users: Private brukere
175
+ assemblies_types: Forsamlingstyper
161
176
  models:
177
+ assemblies_types:
178
+ fields:
179
+ created_at: Opprettet på
180
+ title: Tittel
162
181
  assembly:
163
182
  fields:
164
183
  created_at: Opprettet på
@@ -191,6 +210,7 @@
191
210
  moderator: Moderator
192
211
  titles:
193
212
  assemblies: Forsamlinger
213
+ assemblies_types: Forsamlingstyper
194
214
  admin_log:
195
215
  assembly:
196
216
  create: "%{user_name} opprettet %{resource_name} forsamlingen"
@@ -201,6 +221,12 @@
201
221
  create: "%{user_name} opprettet %{resource_name} medlemmet i %{space_name} samlingen"
202
222
  delete: "%{user_name} fjernet %{resource_name} medlemmet fra %{space_name} forsamlingen"
203
223
  update: "%{user_name} oppdaterte %{resource_name} medlemmet i %{space_name} samlingen"
224
+ assembly_type:
225
+ create: "%{user_name} opprettet %{resource_name} forsamlingstypen"
226
+ delete: "%{user_name} fjernet %{resource_name} medlemmet fra %{space_name} forsamlingstypen"
227
+ publish: "%{user_name} publiserte %{resource_name} forsamlingstypen"
228
+ unpublish: "%{user_name} avpubliserte %{resource_name} forsamlingstypen"
229
+ update: "%{user_name} oppdaterte %{resource_name} forsamlingstypen"
204
230
  assembly_user_role:
205
231
  create: "%{user_name} inviterte %{resource_name} til %{space_name} forsamlingen"
206
232
  delete: "%{user_name} fjernet deltakeren %{resource_name} fra %{space_name} forsamlingen"
@@ -224,6 +250,9 @@
224
250
  social_handlers: Sosial
225
251
  title: Generell Informasjon
226
252
  visbility: Synlighet
253
+ assemblies_types:
254
+ form:
255
+ title: Tittel
227
256
  assembly_copies:
228
257
  form:
229
258
  slug_help: 'URL slugs brukes til å generere nettadressene som peker på denne forsamlingen. Godtar bare bokstaver, tall og bindestreker, og må starte med en bokstav. Eksempel: %{url}'
@@ -342,6 +371,8 @@
342
371
  value_types:
343
372
  assembly_presenter:
344
373
  not_found: 'Forsamlingen ble ikke funnet i databasen (ID: %{id})'
374
+ assembly_type_presenter:
375
+ not_found: 'Forsamlingstypen ble ikke funnet i databasen (ID: %{id})'
345
376
  menu:
346
377
  assemblies: Forsamlinger
347
378
  metrics:
@@ -16,6 +16,7 @@ pl:
16
16
  created_by_other: Stworzony przez inne
17
17
  creation_date: Data utworzenia
18
18
  decidim_area_id: Powierzchnia
19
+ decidim_assemblies_type_id: Typ zespołu
19
20
  decidim_scope_id: Zakres
20
21
  description: Opis
21
22
  developer_group: Grupa promotorów
@@ -105,6 +106,9 @@ pl:
105
106
  create:
106
107
  error: Podczas duplikowania tego zestawu wystąpił błąd.
107
108
  success: Złożenie zostało powielone.
109
+ assemblies_types:
110
+ new:
111
+ create: Utwórz
108
112
  assembly_copies:
109
113
  new:
110
114
  copy: Kopiuj
@@ -165,6 +169,10 @@ pl:
165
169
  moderations: Modernizacje
166
170
  private_users: Prywatni użytkownicy
167
171
  models:
172
+ assemblies_types:
173
+ fields:
174
+ created_at: Utworzono w
175
+ title: Tytuł
168
176
  assembly:
169
177
  fields:
170
178
  created_at: Utworzono w
@@ -230,6 +238,9 @@ pl:
230
238
  social_handlers: Społeczny
231
239
  title: Informacje ogólne
232
240
  visbility: Widoczność
241
+ assemblies_types:
242
+ form:
243
+ title: Tytuł
233
244
  assembly_copies:
234
245
  form:
235
246
  slug_help: 'Ślimaki URL służą do generowania adresów URL wskazujących ten zespół. Akceptuje tylko litery, cyfry i myślniki i musi zaczynać się od litery. Przykład: %{url}'
@@ -16,6 +16,7 @@ pt-BR:
16
16
  created_by_other: Criado por outro
17
17
  creation_date: Data Criada
18
18
  decidim_area_id: Área
19
+ decidim_assemblies_type_id: Tipo de assembleia
19
20
  decidim_scope_id: Âmbito
20
21
  description: Descrição
21
22
  developer_group: Grupo promotor
@@ -99,6 +100,9 @@ pt-BR:
99
100
  create:
100
101
  error: Ocorreu um erro ao duplicar esta assembleia.
101
102
  success: Assembleia duplicada com sucesso.
103
+ assemblies_types:
104
+ new:
105
+ create: Criar
102
106
  assembly_copies:
103
107
  new:
104
108
  copy: Cópia
@@ -159,6 +163,10 @@ pt-BR:
159
163
  moderations: Moderação
160
164
  private_users: Usuários particulares
161
165
  models:
166
+ assemblies_types:
167
+ fields:
168
+ created_at: Criado em
169
+ title: Título
162
170
  assembly:
163
171
  fields:
164
172
  created_at: Criado em
@@ -224,6 +232,9 @@ pt-BR:
224
232
  social_handlers: Social
225
233
  title: Informação geral
226
234
  visbility: Visibilidade
235
+ assemblies_types:
236
+ form:
237
+ title: Título
227
238
  assembly_copies:
228
239
  form:
229
240
  slug_help: 'Os slugs de URL são usados ​​para gerar os URLs que apontam para essa assembleia. Apenas aceita letras, números e traços, e deve começar com uma carta. Exemplo: %{url}'
@@ -16,6 +16,7 @@ pt:
16
16
  created_by_other: Criado por outro
17
17
  creation_date: Data Criada
18
18
  decidim_area_id: Área
19
+ decidim_assemblies_type_id: Tipo de montagem
19
20
  decidim_scope_id: Escopo
20
21
  description: Descrição
21
22
  developer_group: Grupo promotor
@@ -99,6 +100,9 @@ pt:
99
100
  create:
100
101
  error: Ocorreu um erro ao duplicar este assembly.
101
102
  success: Assembléia duplicada com sucesso.
103
+ assemblies_types:
104
+ new:
105
+ create: Criar
102
106
  assembly_copies:
103
107
  new:
104
108
  copy: cópia de
@@ -159,6 +163,10 @@ pt:
159
163
  moderations: Moderação
160
164
  private_users: Usuários particulares
161
165
  models:
166
+ assemblies_types:
167
+ fields:
168
+ created_at: Criado em
169
+ title: Título
162
170
  assembly:
163
171
  fields:
164
172
  created_at: Criado em
@@ -224,6 +232,9 @@ pt:
224
232
  social_handlers: Social
225
233
  title: Informação geral
226
234
  visbility: Visibilidade
235
+ assemblies_types:
236
+ form:
237
+ title: Título
227
238
  assembly_copies:
228
239
  form:
229
240
  slug_help: 'Os slugs de URL são usados ​​para gerar os URLs que apontam para essa assembléia. Apenas aceita letras, números e traços, e deve começar com uma carta. Exemplo: %{url}'
@@ -16,6 +16,7 @@ ru:
16
16
  created_by_other: Создано кем-то еще
17
17
  creation_date: Дата создания
18
18
  decidim_area_id: Участок
19
+ decidim_assemblies_type_id: Вид собрания
19
20
  decidim_scope_id: Охват
20
21
  description: Описание
21
22
  developer_group: Рабочая группа по продвижению
@@ -104,6 +105,9 @@ ru:
104
105
  create:
105
106
  error: При попытке создать копию этого собрания произошла ошибка.
106
107
  success: Успешно создана копия собрания.
108
+ assemblies_types:
109
+ new:
110
+ create: Добавить
107
111
  assembly_copies:
108
112
  new:
109
113
  copy: Копировать
@@ -164,6 +168,10 @@ ru:
164
168
  moderations: Действия по модерации
165
169
  private_users: Частные участники
166
170
  models:
171
+ assemblies_types:
172
+ fields:
173
+ created_at: 'Добавлено:'
174
+ title: Название
167
175
  assembly:
168
176
  fields:
169
177
  created_at: 'Добавлено:'
@@ -222,6 +230,9 @@ ru:
222
230
  slug_help: 'Сокращенные веб-адреса используются для создания ссылок на это собрание. В них допустимы только буквы, цифры и тире, и они должны начинаться с буквы. Пример: %{url}'
223
231
  social_handlers: Социальные сети
224
232
  title: Общие сведения
233
+ assemblies_types:
234
+ form:
235
+ title: Название
225
236
  assembly_copies:
226
237
  form:
227
238
  slug_help: 'Сокращенные веб-адреса используются для создания ссылок на это собрание. В них допустимы только буквы, цифры и тире, и они должны начинаться с буквы. Пример: %{url}'
@@ -16,6 +16,7 @@ sv:
16
16
  created_by_other: Skapad av andra
17
17
  creation_date: Skapad datum
18
18
  decidim_area_id: Område
19
+ decidim_assemblies_type_id: Typ av församling
19
20
  decidim_scope_id: Omfång
20
21
  description: Beskrivning
21
22
  developer_group: Kampanjgrupp
@@ -99,6 +100,9 @@ sv:
99
100
  create:
100
101
  error: Det gick inte att duplicera församlingen.
101
102
  success: Församlingen har duplicerats.
103
+ assemblies_types:
104
+ new:
105
+ create: Skapa
102
106
  assembly_copies:
103
107
  new:
104
108
  copy: Kopiera
@@ -159,6 +163,10 @@ sv:
159
163
  moderations: Moderering
160
164
  private_users: Privata användare
161
165
  models:
166
+ assemblies_types:
167
+ fields:
168
+ created_at: Skapad
169
+ title: Titel
162
170
  assembly:
163
171
  fields:
164
172
  created_at: Skapad
@@ -224,6 +232,9 @@ sv:
224
232
  social_handlers: Socialt
225
233
  title: Allmän information
226
234
  visbility: Synlighet
235
+ assemblies_types:
236
+ form:
237
+ title: Titel
227
238
  assembly_copies:
228
239
  form:
229
240
  slug_help: 'URL-slugs används till att generera de URL:er som pekar på församlingen. Använd bara bokstäver, siffror och bindestreck, och de måste börja med en bokstav. Exempel: %{url}'
@@ -16,6 +16,7 @@ tr:
16
16
  created_by_other: Diğer tarafından oluşturuldu
17
17
  creation_date: Tarih oluşturuldu
18
18
  decidim_area_id: alan
19
+ decidim_assemblies_type_id: Montaj tipi
19
20
  decidim_scope_id: kapsam
20
21
  description: Açıklama
21
22
  developer_group: Tanıtım grubu
@@ -99,6 +100,9 @@ tr:
99
100
  create:
100
101
  error: Bu derlemeyi çoğaltırken bir hata oluştu.
101
102
  success: Montaj başarıyla kopyalandı.
103
+ assemblies_types:
104
+ new:
105
+ create: yaratmak
102
106
  assembly_copies:
103
107
  new:
104
108
  copy: kopya
@@ -159,6 +163,10 @@ tr:
159
163
  moderations: Denetimler
160
164
  private_users: Özel kullanıcılar
161
165
  models:
166
+ assemblies_types:
167
+ fields:
168
+ created_at: Düzenlendi
169
+ title: Başlık
162
170
  assembly:
163
171
  fields:
164
172
  created_at: Düzenlendi
@@ -224,6 +232,9 @@ tr:
224
232
  social_handlers: Sosyal
225
233
  title: Genel bilgi
226
234
  visbility: görünürlük
235
+ assemblies_types:
236
+ form:
237
+ title: Başlık
227
238
  assembly_copies:
228
239
  form:
229
240
  slug_help: 'URL sümükleri, bu derleme işaret eden URL''leri oluşturmak için kullanılır. Sadece harfleri, sayıları ve kısa çizgileri kabul eder ve bir harfle başlamalıdır. Örnek: %{url}'
@@ -16,6 +16,7 @@ uk:
16
16
  created_by_other: Створено кимось іншим
17
17
  creation_date: Дата створення
18
18
  decidim_area_id: Дільниця
19
+ decidim_assemblies_type_id: Різновид зборів
19
20
  decidim_scope_id: Обсяг
20
21
  description: Опис
21
22
  developer_group: Робочий гурт з просування
@@ -104,6 +105,9 @@ uk:
104
105
  create:
105
106
  error: При спробі створити копію цих зборів сталася помилка.
106
107
  success: Успішно створено копію зборів.
108
+ assemblies_types:
109
+ new:
110
+ create: Додати
107
111
  assembly_copies:
108
112
  new:
109
113
  copy: Скопіювати
@@ -164,6 +168,10 @@ uk:
164
168
  moderations: Дії з модерації
165
169
  private_users: Приватні учасники
166
170
  models:
171
+ assemblies_types:
172
+ fields:
173
+ created_at: 'Додано:'
174
+ title: Назва
167
175
  assembly:
168
176
  fields:
169
177
  created_at: 'Додано:'
@@ -222,6 +230,9 @@ uk:
222
230
  slug_help: 'Cкорочені веб-адреси використовуються для створення посилань на ці збори. В них припустимі лише букви, цифри та тире, і вони мають починатися з букви. Приклад: %{url}'
223
231
  social_handlers: Соціальні мережі
224
232
  title: Загальні відомості
233
+ assemblies_types:
234
+ form:
235
+ title: Назва
225
236
  assembly_copies:
226
237
  form:
227
238
  slug_help: 'Cкорочені веб-адреси використовуються для створення посилань на ці збори. В них припустимі лише букви, цифри та тире, і вони мають починатися з букви. Приклад: %{url}'
@@ -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