decidim-decidim_awesome 0.10.1 → 0.10.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -1
- data/README.md +134 -15
- data/app/cells/concerns/decidim/decidim_awesome/proposal_m_cell_override.rb +4 -24
- data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +9 -5
- data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +1 -1
- data/app/commands/concerns/decidim/decidim_awesome/proposals/admin/update_proposal_override.rb +31 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/update_collaborative_draft_override.rb +27 -0
- data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +26 -0
- data/app/commands/decidim/decidim_awesome/admin/create_proposal_custom_field.rb +4 -3
- data/app/commands/decidim/decidim_awesome/admin/destroy_proposal_custom_field.rb +6 -3
- data/app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb +43 -0
- data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb +3 -2
- data/app/controllers/concerns/decidim/decidim_awesome/limit_pending_amendments.rb +35 -0
- data/app/controllers/concerns/decidim/decidim_awesome/proposals/orderable_override.rb +9 -22
- data/app/controllers/decidim/decidim_awesome/admin/admin_accountability_controller.rb +7 -7
- data/app/controllers/decidim/decidim_awesome/admin/application_controller.rb +2 -0
- data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +7 -3
- data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +8 -5
- data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +3 -1
- data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +0 -2
- data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +76 -0
- data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +0 -2
- data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +12 -4
- data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +8 -1
- data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb +21 -0
- data/app/forms/{decidim → concerns/decidim}/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +1 -0
- data/app/forms/decidim/decidim_awesome/admin/config_form.rb +35 -9
- data/app/helpers/{decidim → concerns/decidim}/decidim_awesome/amendments_helper_override.rb +17 -7
- data/app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb +126 -0
- data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +5 -26
- data/app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb +22 -0
- data/app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb +38 -9
- data/app/models/decidim/decidim_awesome/paper_trail_version.rb +5 -1
- data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +35 -1
- data/app/overrides/decidim/proposals/admin/proposals/show/add_private_body.html.erb.deface +7 -0
- data/app/overrides/decidim/proposals/admin/proposals/show/replace_body.html.erb.deface +5 -0
- data/app/overrides/decidim/proposals/proposals/show/limit_amendments_modal.html.erb.deface +5 -0
- data/app/overrides/layouts/decidim/admin/_header/replace_scripts.html.erb.deface +3 -0
- data/app/packs/entrypoints/decidim_decidim_awesome_map.scss +1 -1
- data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +5 -3
- data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +1 -1
- data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +5 -4
- data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +30 -0
- data/app/packs/src/decidim/decidim_awesome/awesome_application.js +1 -0
- data/app/packs/src/decidim/decidim_awesome/editors/editor.js +1 -6
- data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +18 -9
- data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +35 -26
- data/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js +31 -15
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +12 -7
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +69 -25
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +34 -27
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +2 -2
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +3 -3
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +28 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +3 -2
- data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +15 -15
- data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +3 -3
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +3 -3
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +187 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +47 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +7 -7
- data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +14 -3
- data/app/presenters/concerns/decidim/decidim_awesome/proposals/proposal_presenter_override.rb +20 -0
- data/app/presenters/decidim/decidim_awesome/admin_log/component_presenter_override.rb +30 -0
- data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +70 -0
- data/app/queries/decidim/decidim_awesome/private_data_finder.rb +19 -0
- data/app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb +1 -0
- data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_methods.rb +72 -0
- data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_override.rb +38 -0
- data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +42 -0
- data/app/types/concerns/decidim/decidim_awesome/add_proposal_type_custom_fields.rb +59 -0
- data/app/types/concerns/decidim/decidim_awesome/{proposal_type_override.rb → add_proposal_type_vote_weights.rb} +3 -1
- data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +52 -48
- data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -2
- data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +16 -8
- data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +12 -16
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +35 -15
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_private_custom_fields.html.erb +1 -0
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +22 -22
- data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +14 -13
- data/app/views/decidim/decidim_awesome/admin/maintenance/_private_data.html.erb +44 -0
- data/app/views/decidim/decidim_awesome/admin/maintenance/show.html.erb +44 -0
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +28 -29
- data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +8 -5
- data/app/views/decidim/decidim_awesome/admin/proposals/_private_body.html.erb +20 -0
- data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +16 -0
- data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +10 -2
- data/app/views/layouts/decidim/decidim_awesome/admin/_base.html.erb +21 -0
- data/app/views/layouts/decidim/decidim_awesome/admin/application.html.erb +1 -73
- data/app/views/layouts/decidim/decidim_awesome/admin/maintenance.html.erb +19 -0
- data/config/i18n-tasks.yml +22 -3
- data/config/locales/ca.yml +97 -9
- data/config/locales/cs.yml +109 -6
- data/config/locales/de.yml +92 -6
- data/config/locales/en.yml +102 -8
- data/config/locales/es.yml +96 -8
- data/config/locales/eu.yml +15 -1
- data/config/locales/fr.yml +94 -6
- data/config/locales/hu.yml +53 -4
- data/config/locales/it.yml +16 -6
- data/config/locales/ja.yml +94 -6
- data/config/locales/lt.yml +0 -2
- data/config/locales/nl.yml +9 -4
- data/config/locales/pt-BR.yml +16 -7
- data/config/locales/ro-RO.yml +11 -2
- data/config/locales/sv.yml +17 -6
- data/db/migrate/20240531224204_add_decidim_awesome_proposal_private_fields.rb +29 -0
- data/db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +20 -0
- data/lib/decidim/decidim_awesome/admin_engine.rb +22 -6
- data/lib/decidim/decidim_awesome/api/types/localized_custom_fields_type.rb +22 -0
- data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +52 -0
- data/lib/decidim/decidim_awesome/awesome.rb +45 -8
- data/lib/decidim/decidim_awesome/awesome_helpers.rb +5 -1
- data/lib/decidim/decidim_awesome/checksums.yml +23 -0
- data/lib/decidim/decidim_awesome/custom_fields.rb +8 -0
- data/lib/decidim/decidim_awesome/engine.rb +143 -52
- data/lib/decidim/decidim_awesome/lock.rb +47 -0
- data/lib/decidim/decidim_awesome/menu.rb +146 -0
- data/lib/decidim/decidim_awesome/test/initializer.rb +4 -1
- data/lib/decidim/decidim_awesome/test/shared_examples/{box_label_editor.rb → box_label_editor_examples.rb} +1 -1
- data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +20 -2
- data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +155 -0
- data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +24 -0
- data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +2 -2
- data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +3 -5
- data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +78 -12
- data/lib/decidim/decidim_awesome/version.rb +1 -1
- data/package.json +3 -3
- metadata +52 -14
- data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +0 -78
- data/app/overrides/layouts/decidim/admin/_application/add_intergram.html.erb.deface +0 -5
- /data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_item_presenter_override.rb +0 -0
- /data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_presenter_override.rb +0 -0
data/config/locales/pt-BR.yml
CHANGED
@@ -39,8 +39,6 @@ pt-BR:
|
|
39
39
|
target: Aberto em
|
40
40
|
url: URL
|
41
41
|
visibility: Visibilidade
|
42
|
-
proposal:
|
43
|
-
proposal_custom_fields: Campos personalizados
|
44
42
|
decidim:
|
45
43
|
admin:
|
46
44
|
menu:
|
@@ -103,7 +101,6 @@ pt-BR:
|
|
103
101
|
start_image_migrations: "\U0001F449 Inicie o processo de migração agora"
|
104
102
|
title: Checar compatibilidade do sistema
|
105
103
|
config:
|
106
|
-
caution: 'NOTA: Este recurso modifica fortemente alguns comportamentos padrão que podem levar a resultados inesperados. Use-o com cuidado!'
|
107
104
|
constraints:
|
108
105
|
add_condition: Adicionar Caso
|
109
106
|
always: Sempre
|
@@ -152,14 +149,19 @@ pt-BR:
|
|
152
149
|
scoped_styles_variables: 'Você pode usar as seguintes variáveis CSS para cores personalizadas da organização:'
|
153
150
|
use_markdown_editor: Isto irá substituir o editor do Quill WYSIWYG, para usar um editor de Markdown. O texto será convertido e salvo como HTML no banco de dados.
|
154
151
|
form_proposal_custom_fields:
|
152
|
+
delete: Deletar
|
155
153
|
new: Adicionar uma nova caixa "campos personalizados"
|
156
154
|
remove: Remover esta caixa "campos personalizados"
|
157
155
|
sure_to_remove: Deseja mesmo destruir essa caixa de campos?
|
156
|
+
form_proposal_private_custom_fields:
|
157
|
+
delete: Deletar
|
158
158
|
form_scoped_admins:
|
159
|
+
delete: Deletar
|
159
160
|
new: Adicionar um novo grupo "Administradores com Escopos"
|
160
161
|
remove: Remover este grupo "Administradores com Escopos"
|
161
162
|
sure_to_remove: Deseja mesmo destruir esse grupo de "Administradores com Escopos"?
|
162
163
|
form_scoped_styles:
|
164
|
+
delete: Deletar
|
163
165
|
new: Adicionar uma nova caixa CSS
|
164
166
|
remove: Remover esta caixa CSS
|
165
167
|
sure_to_remove: Deseja mesmo destruir essa caixa de CSS?
|
@@ -170,6 +172,13 @@ pt-BR:
|
|
170
172
|
title: Ajustes para %{setting}
|
171
173
|
update: Configuração atualizada
|
172
174
|
system: Qualquer lugar exceto salas participativas
|
175
|
+
title:
|
176
|
+
admins: Administradores com escopo
|
177
|
+
editors: Hacks do editor
|
178
|
+
livechat: Chat Ao Vivo
|
179
|
+
proposals: Pacotes de Propostas
|
180
|
+
styles: Estilos Personalizados
|
181
|
+
surveys: Pesquisas e Formulários
|
173
182
|
update:
|
174
183
|
error: Erro ao atualizar configuração!%{error}
|
175
184
|
success: Configuração atualizada com sucesso
|
@@ -231,10 +240,11 @@ pt-BR:
|
|
231
240
|
success: Redirecionamento atualizado com sucesso
|
232
241
|
menu:
|
233
242
|
admins: Administradores com escopo
|
234
|
-
checks: Compatibilidade de sistema
|
235
243
|
custom_redirects: Redirecionamentos personalizados
|
236
244
|
editors: Hacks do editor
|
237
245
|
livechat: Chat Ao Vivo
|
246
|
+
maintenance:
|
247
|
+
checks: Compatibilidade de sistema
|
238
248
|
menu_hacks: Ajustes do menu
|
239
249
|
proposal_custom_fields: Campos Personalizados de Propostas
|
240
250
|
proposals: Pacotes de Propostas
|
@@ -263,6 +273,8 @@ pt-BR:
|
|
263
273
|
index:
|
264
274
|
confirm_destroy: Tem certeza que deseja remover esta customização?
|
265
275
|
edit: Editar
|
276
|
+
menu:
|
277
|
+
title: Menu Principal
|
266
278
|
new: Novo item
|
267
279
|
remove: Remover adição
|
268
280
|
remove_hack: Remover personalização
|
@@ -333,9 +345,6 @@ pt-BR:
|
|
333
345
|
cancel: Cancelar
|
334
346
|
layouts:
|
335
347
|
decidim:
|
336
|
-
admin:
|
337
|
-
decidim_awesome:
|
338
|
-
title: Ajustes Decidim
|
339
348
|
decidim_awesome:
|
340
349
|
awesome_config:
|
341
350
|
amendments: Emendas
|
data/config/locales/ro-RO.yml
CHANGED
@@ -25,8 +25,6 @@ ro:
|
|
25
25
|
target: Deschidere in
|
26
26
|
url: URL
|
27
27
|
visibility: Vizibilitate
|
28
|
-
proposal:
|
29
|
-
proposal_custom_fields: Câmpuri particularizate
|
30
28
|
decidim:
|
31
29
|
admin:
|
32
30
|
filters:
|
@@ -97,7 +95,18 @@ ro:
|
|
97
95
|
error: Eroare la crearea unui nou "câmp personalizat"! %{error}
|
98
96
|
form:
|
99
97
|
edit_label: Redenumește eticheta
|
98
|
+
form_proposal_custom_fields:
|
99
|
+
delete: Șterge
|
100
|
+
form_proposal_private_custom_fields:
|
101
|
+
delete: Șterge
|
102
|
+
form_scoped_admins:
|
103
|
+
delete: Șterge
|
104
|
+
form_scoped_styles:
|
105
|
+
delete: Șterge
|
100
106
|
process_groups: Grupuri de procese
|
107
|
+
title:
|
108
|
+
styles: Stiluri personalizate
|
109
|
+
surveys: Chestionare și formulare
|
101
110
|
constraints:
|
102
111
|
errors:
|
103
112
|
not_unique: Această condiție există deja
|
data/config/locales/sv.yml
CHANGED
@@ -28,8 +28,6 @@ sv:
|
|
28
28
|
target: Öppna i
|
29
29
|
url: Webbadress
|
30
30
|
visibility: Synlighet
|
31
|
-
proposal:
|
32
|
-
proposal_custom_fields: Tilläggsfält
|
33
31
|
decidim:
|
34
32
|
admin:
|
35
33
|
menu:
|
@@ -75,12 +73,25 @@ sv:
|
|
75
73
|
edit_label: Byt namn på etikett
|
76
74
|
help:
|
77
75
|
use_markdown_editor: This will substitute the Quill WYSIWYG editor, use a Markdown editor instead. Text will be rendered as HTML in the public pages (text in database will be saved as markdown text)
|
76
|
+
form_proposal_custom_fields:
|
77
|
+
delete: Radera
|
78
|
+
form_proposal_private_custom_fields:
|
79
|
+
delete: Radera
|
80
|
+
form_scoped_admins:
|
81
|
+
delete: Radera
|
78
82
|
form_scoped_styles:
|
83
|
+
delete: Radera
|
79
84
|
remove: Ta bort CSS-rutan
|
80
85
|
process_groups: Dialoggrupper
|
81
86
|
show:
|
82
87
|
title: Tweaks för %{setting}
|
83
88
|
update: Uppdatera konfiguration
|
89
|
+
title:
|
90
|
+
admins: Begränsade administratörer
|
91
|
+
editors: Editor hacks
|
92
|
+
proposals: Proposals hacks
|
93
|
+
styles: Custom styles
|
94
|
+
surveys: Surveys & forms
|
84
95
|
constraints:
|
85
96
|
new:
|
86
97
|
cancel: Avbryt
|
@@ -105,10 +116,11 @@ sv:
|
|
105
116
|
title: Ny omdirigering
|
106
117
|
menu:
|
107
118
|
admins: Begränsade administratörer
|
108
|
-
checks: System compatibility
|
109
119
|
custom_redirects: Anpassade omdirigeringar
|
110
120
|
editors: Editor hacks
|
111
121
|
livechat: Live Chat
|
122
|
+
maintenance:
|
123
|
+
checks: System compatibility
|
112
124
|
menu_hacks: Menu tweaks
|
113
125
|
proposals: Proposals hacks
|
114
126
|
styles: Custom styles
|
@@ -127,6 +139,8 @@ sv:
|
|
127
139
|
logged: Endast synlig för inloggade användare
|
128
140
|
index:
|
129
141
|
edit: Redigera
|
142
|
+
menu:
|
143
|
+
title: Huvudmeny
|
130
144
|
new: Ny menyknapp
|
131
145
|
remove: Ta bort menyknapp
|
132
146
|
remove_hack: Ta bort menyknapp
|
@@ -160,9 +174,6 @@ sv:
|
|
160
174
|
cancel: Avbryt
|
161
175
|
layouts:
|
162
176
|
decidim:
|
163
|
-
admin:
|
164
|
-
decidim_awesome:
|
165
|
-
title: Decidim Tweaks
|
166
177
|
decidim_awesome:
|
167
178
|
awesome_config:
|
168
179
|
amendments: Ändringsförslag
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddDecidimAwesomeProposalPrivateFields < ActiveRecord::Migration[6.0]
|
4
|
+
class ProposalExtraField < ApplicationRecord
|
5
|
+
self.table_name = :decidim_awesome_proposal_extra_fields
|
6
|
+
end
|
7
|
+
|
8
|
+
def change
|
9
|
+
add_column :decidim_awesome_proposal_extra_fields, :private_body, :string
|
10
|
+
add_column :decidim_awesome_proposal_extra_fields, :decidim_proposal_type, :string
|
11
|
+
reversible do |direction|
|
12
|
+
direction.up do
|
13
|
+
execute <<~SQL.squish
|
14
|
+
UPDATE decidim_awesome_proposal_extra_fields
|
15
|
+
SET decidim_proposal_type = 'Decidim::Proposals::Proposal'
|
16
|
+
SQL
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
remove_index :decidim_awesome_proposal_extra_fields, name: "decidim_awesome_extra_fields_on_proposal"
|
21
|
+
add_index :decidim_awesome_proposal_extra_fields,
|
22
|
+
[:decidim_proposal_id, :decidim_proposal_type],
|
23
|
+
name: "index_decidim_awesome_proposal_extra_fields_on_decidim_proposal"
|
24
|
+
|
25
|
+
change_column_null :decidim_awesome_proposal_extra_fields, :decidim_proposal_id, false
|
26
|
+
change_column_null :decidim_awesome_proposal_extra_fields, :decidim_proposal_type, false
|
27
|
+
ProposalExtraField.reset_column_information
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class AddDecidimAwesomeProposalPrivateFieldsDate < ActiveRecord::Migration[6.0]
|
4
|
+
class ProposalExtraField < ApplicationRecord
|
5
|
+
self.table_name = :decidim_awesome_proposal_extra_fields
|
6
|
+
end
|
7
|
+
|
8
|
+
def change
|
9
|
+
add_column :decidim_awesome_proposal_extra_fields, :private_body_updated_at, :datetime
|
10
|
+
|
11
|
+
reversible do |direction|
|
12
|
+
direction.up do
|
13
|
+
execute <<~SQL.squish
|
14
|
+
UPDATE decidim_awesome_proposal_extra_fields
|
15
|
+
SET private_body_updated_at = updated_at
|
16
|
+
SQL
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -26,7 +26,10 @@ module Decidim
|
|
26
26
|
post :export_admin_accountability, to: "admin_accountability#export", as: "export_admin_accountability"
|
27
27
|
get :users, to: "config#users"
|
28
28
|
post :rename_scope_label, to: "config#rename_scope_label"
|
29
|
-
|
29
|
+
resources :maintenance, only: [:show] do
|
30
|
+
delete :destroy_private_data, on: :member
|
31
|
+
get :checks, on: :collection, to: "checks#index"
|
32
|
+
end
|
30
33
|
post :migrate_images, to: "checks#migrate_images"
|
31
34
|
root to: "config#show"
|
32
35
|
end
|
@@ -37,19 +40,32 @@ module Decidim
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
40
|
-
initializer "decidim_awesome.
|
43
|
+
initializer "decidim_awesome.admin_menus" do
|
44
|
+
first_available = Decidim::DecidimAwesome::Menu.menus.detect { |_key, val| val.present? }&.first
|
45
|
+
|
41
46
|
Decidim.menu :admin_menu do |menu|
|
42
47
|
menu.add_item :awesome_menu,
|
43
48
|
I18n.t("menu.decidim_awesome", scope: "decidim.admin"),
|
44
|
-
|
49
|
+
if first_available
|
50
|
+
decidim_admin_decidim_awesome.config_path(first_available)
|
51
|
+
else
|
52
|
+
decidim_admin_decidim_awesome.checks_maintenance_index_path
|
53
|
+
end,
|
45
54
|
icon_name: "fire",
|
46
55
|
position: 7.5,
|
47
|
-
active:
|
56
|
+
active: if first_available
|
57
|
+
is_active_link?(decidim_admin_decidim_awesome.config_path(first_available), :inclusive)
|
58
|
+
else
|
59
|
+
is_active_link?(decidim_admin_decidim_awesome.checks_maintenance_index_path)
|
60
|
+
end,
|
48
61
|
if: defined?(current_user) && current_user&.read_attribute("admin")
|
49
62
|
end
|
50
|
-
|
63
|
+
# submenus
|
64
|
+
Decidim::DecidimAwesome::Menu.register_custom_fields_submenu!
|
65
|
+
Decidim::DecidimAwesome::Menu.register_maintenance_admin_menu!
|
66
|
+
Decidim::DecidimAwesome::Menu.register_awesome_admin_menu!
|
51
67
|
|
52
|
-
|
68
|
+
# user menu
|
53
69
|
Decidim.menu :admin_user_menu do |menu|
|
54
70
|
if DecidimAwesome.enabled? :admin_accountability
|
55
71
|
menu.add_item :admin_accountability,
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DecidimAwesome
|
5
|
+
# This type represents a localized string in a single language.
|
6
|
+
class LocalizedCustomFieldsType < Decidim::Api::Types::BaseObject
|
7
|
+
description "Represents a particular translation of a LocalizedCustomFieldsType"
|
8
|
+
|
9
|
+
field :locale, GraphQL::Types::String, "The standard locale of this translation.", null: false
|
10
|
+
field :fields, GraphQL::Types::JSON, "The fields of this translation.", null: true
|
11
|
+
field :machine_translated, GraphQL::Types::Boolean, "Whether this string is machine translated or not.", null: false
|
12
|
+
|
13
|
+
def machine_translated
|
14
|
+
if object.respond_to?(:machine_translated)
|
15
|
+
object.machine_translated.present?
|
16
|
+
else
|
17
|
+
false
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Decidim::DecidimAwesome
|
5
|
+
# This type represents a translated field in multiple languages.
|
6
|
+
class TranslatedCustomFieldsType < Decidim::Api::Types::BaseObject
|
7
|
+
description "A translated field"
|
8
|
+
|
9
|
+
field :locales, [GraphQL::Types::String, { null: true }], description: "Lists all the locales in which this translation is available", null: true
|
10
|
+
|
11
|
+
field :translations, [LocalizedCustomFieldsType, { null: true }], description: "All the localized custom fields for this translation.", null: false do
|
12
|
+
argument :locales, [GraphQL::Types::String], description: "A list of locales to scope the translations to.", required: false
|
13
|
+
end
|
14
|
+
|
15
|
+
field :translation, GraphQL::Types::JSON, description: "Returns a single translation given a locale.", null: true do
|
16
|
+
argument :locale, GraphQL::Types::String, "A locale to search for", required: true
|
17
|
+
end
|
18
|
+
|
19
|
+
def locales
|
20
|
+
(defined_translations.keys + machine_translations.keys).uniq
|
21
|
+
end
|
22
|
+
|
23
|
+
def translation(locale: "")
|
24
|
+
display_translations[locale]
|
25
|
+
end
|
26
|
+
|
27
|
+
def translations(locales: [])
|
28
|
+
translations = display_translations
|
29
|
+
translations = translations.slice(*locales) unless locales.empty?
|
30
|
+
# rubocop:disable Style/OpenStructUse
|
31
|
+
translations.map { |locale, fields| OpenStruct.new(locale: locale, fields: fields, machine_translated: defined_translations[locale].blank?) }
|
32
|
+
# rubocop:enable Style/OpenStructUse
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def display_translations
|
38
|
+
@display_translations ||= locales.index_with do |locale|
|
39
|
+
defined_translations[locale].presence || machine_translations[locale]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def defined_translations
|
44
|
+
object.stringify_keys.except("machine_translations")
|
45
|
+
end
|
46
|
+
|
47
|
+
def machine_translations
|
48
|
+
object.stringify_keys["machine_translations"]&.stringify_keys || {}
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -10,6 +10,9 @@ module Decidim
|
|
10
10
|
autoload :MenuHacker, "decidim/decidim_awesome/menu_hacker"
|
11
11
|
autoload :CustomFields, "decidim/decidim_awesome/custom_fields"
|
12
12
|
autoload :VotingManifest, "decidim/decidim_awesome/voting_manifest"
|
13
|
+
autoload :Lock, "decidim/decidim_awesome/lock"
|
14
|
+
autoload :TranslatedCustomFieldsType, "decidim/decidim_awesome/api/types/translated_custom_fields_type"
|
15
|
+
autoload :LocalizedCustomFieldsType, "decidim/decidim_awesome/api/types/localized_custom_fields_type"
|
13
16
|
|
14
17
|
# Awesome coms with some components for participatory spaces
|
15
18
|
# Currently :awesome_map and :awesome_iframe, list them here
|
@@ -121,6 +124,16 @@ module Decidim
|
|
121
124
|
]
|
122
125
|
end
|
123
126
|
|
127
|
+
# Allows admins to limit the amount of pending amendments to (currently) one per proposal before it's accepted.
|
128
|
+
# Once a pending amendment is accepted, a new on can be created.
|
129
|
+
# Note that this does not limit the number of amendment per se, the admin has to set the limit in the proposal's component configuration.
|
130
|
+
# set to :disable to will prevent admins to set an amendment's limit in the proposal's component configuration.
|
131
|
+
# if set to "true" the checkbox will be checked by default
|
132
|
+
# if set to "false" the checkbox will be unchecked by default
|
133
|
+
config_accessor :allow_limiting_amendments do
|
134
|
+
false
|
135
|
+
end
|
136
|
+
|
124
137
|
# allows admins to created specific CSS snippets affecting only some specific parts
|
125
138
|
# Valid values differ a little from the previous convention:
|
126
139
|
# :disabled => false and non available, hidden from admins
|
@@ -146,6 +159,21 @@ module Decidim
|
|
146
159
|
{}
|
147
160
|
end
|
148
161
|
|
162
|
+
# Same as proposal_custom_fields but for generating private fields than can be read only by admins
|
163
|
+
config_accessor :proposal_private_custom_fields do
|
164
|
+
{}
|
165
|
+
end
|
166
|
+
|
167
|
+
# How old must be the private data to be considered expired and therefore presented to the admins for deletion
|
168
|
+
config_accessor :private_data_expiration_time do
|
169
|
+
3.months
|
170
|
+
end
|
171
|
+
|
172
|
+
# How long must be the private data prevented from being deleted again after being scheduled for deletion
|
173
|
+
config_accessor :lock_time do
|
174
|
+
1.minute
|
175
|
+
end
|
176
|
+
|
149
177
|
# allows to keep modifications for the main menu
|
150
178
|
# can return :disabled to completly remove this feature
|
151
179
|
# otherwise it should be an array (some overrides can be specified by default):
|
@@ -273,7 +301,9 @@ module Decidim
|
|
273
301
|
# pass a single config var or an array of them
|
274
302
|
# any non disabled match will return as true
|
275
303
|
def self.possible_additional_proposal_sortings
|
276
|
-
|
304
|
+
return [] unless additional_proposal_sortings.is_a?(Array)
|
305
|
+
|
306
|
+
@possible_additional_proposal_sortings ||= additional_proposal_sortings.filter_map do |sort|
|
277
307
|
next unless sort.to_sym.in?([:az, :za, :supported_first, :supported_last])
|
278
308
|
|
279
309
|
sort.to_s
|
@@ -282,16 +312,14 @@ module Decidim
|
|
282
312
|
|
283
313
|
def self.collation_for(locale)
|
284
314
|
@collation_for ||= {}
|
285
|
-
@collation_for[locale] ||=
|
286
|
-
|
287
|
-
res
|
315
|
+
@collation_for[locale] ||= ["#{locale}-x-icu", "#{locale[0..1]}%"].filter_map do |loc|
|
316
|
+
sql = ApplicationRecord.sanitize_sql(["SELECT collname FROM pg_collation WHERE collname LIKE ? LIMIT 1", loc])
|
317
|
+
res = ActiveRecord::Base.connection.execute(sql).first
|
288
318
|
res["collname"] if res
|
289
|
-
end
|
319
|
+
end.first
|
290
320
|
end
|
291
321
|
|
292
|
-
def self.enabled?(config_vars)
|
293
|
-
config_vars = [config_vars] unless config_vars.respond_to?(:any?)
|
294
|
-
|
322
|
+
def self.enabled?(*config_vars)
|
295
323
|
config_vars.any? do |item|
|
296
324
|
next unless config.has_key?(item.to_sym)
|
297
325
|
|
@@ -309,6 +337,15 @@ module Decidim
|
|
309
337
|
registered_components << [manifest, block]
|
310
338
|
end
|
311
339
|
|
340
|
+
# appends to a hash a new value in a specified position so that the hash becomes:
|
341
|
+
# { a: 1, b: 2, c: 3 } => append_hash(hash, :b, :d, 4) => { a: 1, b: 2, d: 4, c: 3 }
|
342
|
+
# if key is not found then it will be inserted at the end
|
343
|
+
def self.hash_append!(hash, after_key, key, value)
|
344
|
+
insert_at = hash.to_a.index(hash.assoc(after_key))
|
345
|
+
insert_at = insert_at.nil? ? hash.size : insert_at + 1
|
346
|
+
hash.replace(hash.to_a.insert(insert_at, [key, value]).to_h)
|
347
|
+
end
|
348
|
+
|
312
349
|
def self.legacy_version?
|
313
350
|
Decidim.version[0..3] == "0.26"
|
314
351
|
end
|
@@ -24,7 +24,7 @@ module Decidim
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def javascript_config_vars
|
27
|
-
awesome_config.except(:scoped_styles, :proposal_custom_fields, :scoped_admins).to_json.html_safe
|
27
|
+
awesome_config.except(:scoped_styles, :proposal_custom_fields, :proposal_private_custom_fields, :scoped_admins).to_json.html_safe
|
28
28
|
end
|
29
29
|
|
30
30
|
def show_public_intergram?
|
@@ -61,6 +61,10 @@ module Decidim
|
|
61
61
|
@awesome_proposal_custom_fields ||= awesome_config_instance.collect_sub_configs_values("proposal_custom_field")
|
62
62
|
end
|
63
63
|
|
64
|
+
def awesome_proposal_private_custom_fields
|
65
|
+
@awesome_proposal_private_custom_fields ||= awesome_config_instance.collect_sub_configs_values("proposal_private_custom_field")
|
66
|
+
end
|
67
|
+
|
64
68
|
# this will check if the current component has been configured to use a custom voting manifest
|
65
69
|
def awesome_voting_manifest_for(component)
|
66
70
|
return nil unless component.settings.respond_to? :awesome_voting_manifest
|
@@ -1,6 +1,7 @@
|
|
1
1
|
decidim-admin:
|
2
2
|
/app/views/layouts/decidim/admin/_header.html.erb:
|
3
3
|
decidim-0.25: 1aff077428830b12306d6c42e6b37216
|
4
|
+
decidim-0.27.5: ee303c717d9fc8ea77f644b29981b3f4
|
4
5
|
decidim-core:
|
5
6
|
/app/validators/etiquette_validator.rb:
|
6
7
|
decidim-0.25: f7a4a652005385a994208f1ab41c4f08
|
@@ -25,6 +26,7 @@ decidim-core:
|
|
25
26
|
decidim-proposals:
|
26
27
|
/lib/decidim/proposals/proposal_serializer.rb:
|
27
28
|
decidim-0.26: 2d817775f79a19cfcf9cfae8e5b68c5a
|
29
|
+
decidim-0.27.6: 3c2bc99fb00985714c8b55594fa0082e
|
28
30
|
/lib/decidim/api/proposal_type.rb:
|
29
31
|
decidim-0.26: e38e4875e408ec4f658e28725c5a94d4
|
30
32
|
/app/forms/decidim/proposals/proposal_wizard_create_step_form.rb:
|
@@ -51,6 +53,7 @@ decidim-proposals:
|
|
51
53
|
/app/views/decidim/proposals/admin/proposals/_form.html.erb:
|
52
54
|
decidim-0.25: 90a04984d4269398b7cd21aa33763a1f
|
53
55
|
decidim-0.27: f60168e432e1d419e5aec5d3d1e53f0e
|
56
|
+
decidim-0.27.6: 05d4ceb99f81a7ad71f2936614d89d23
|
54
57
|
/app/views/decidim/proposals/proposals/_vote_button.html.erb:
|
55
58
|
decidim-0.27: f7202c37fe042cd816a6f9fd0f9e6807
|
56
59
|
/app/views/decidim/proposals/proposals/_votes_count.html.erb:
|
@@ -61,3 +64,23 @@ decidim-proposals:
|
|
61
64
|
decidim-0.27.4: ce3b30cdddfee547b8fb089c0fddd8a4
|
62
65
|
/app/cells/decidim/proposals/proposal_m/footer.erb:
|
63
66
|
decidim-0.26: 7ade5bbd8412f44f1c4ed913ae1834c6
|
67
|
+
/app/commands/decidim/proposals/create_proposal.rb:
|
68
|
+
decidim-0.26: 8808a4239d750a86edd6e9c309533788
|
69
|
+
decidim-0.27: 7a6b8a1ea733e1e331b5251accfc9126
|
70
|
+
/app/commands/decidim/proposals/create_collaborative_draft.rb:
|
71
|
+
decidim-0.26: 4ad30f5a912fa5f76e94f686b7f475c1
|
72
|
+
decidim-0.27: 2d9a8cef43690e54419f1bd0478fa580
|
73
|
+
/app/commands/decidim/proposals/admin/create_proposal.rb:
|
74
|
+
decidim-0.26: e057ebfc83bb8fa4dbfeea4058776f43
|
75
|
+
decidim-0.27: 40db71d026e1f8e8086aa149bdd97106
|
76
|
+
/app/commands/decidim/proposals/update_proposal.rb:
|
77
|
+
decidim-0.26: 28ebdc4efcb2c9eab307d3bf9f4a7ef7
|
78
|
+
decidim-0.27: 5e2f8ef1bfa4edd8fb5479c15c5f06de
|
79
|
+
/app/commands/decidim/proposals/update_collaborative_draft.rb:
|
80
|
+
decidim-0.26: df8d09786857b31942c1e1bcb0290551
|
81
|
+
decidim-0.27: 2ddf7f98cb085cb4565ec6ac257ca8c9
|
82
|
+
/app/commands/decidim/proposals/admin/update_proposal.rb:
|
83
|
+
decidim-0.26: 82478685f772c818d7300551891dc717
|
84
|
+
decidim-0.27: aacc7c104abe2bbd2f09c0dfe4f74e0c
|
85
|
+
/app/presenters/decidim/proposals/proposal_presenter.rb:
|
86
|
+
decidim-0.27: 105b7266bcdd8b947ababbb7ebb78789
|