decidim-decidim_awesome 0.11.4 → 0.12.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -6
- data/README.md +33 -39
- data/Rakefile +12 -0
- data/app/cells/concerns/decidim/decidim_awesome/global_menu_cell_override.rb +14 -2
- data/app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb +5 -4
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/show.erb +4 -4
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/vote_block_for.erb +1 -1
- data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_cell.rb +3 -5
- data/app/commands/concerns/decidim/decidim_awesome/system/{register_organization_override.rb → create_organization_override.rb} +1 -1
- data/app/commands/concerns/decidim/decidim_awesome/update_account_override.rb +4 -4
- data/app/commands/decidim/decidim_awesome/admin/create_constraint.rb +1 -1
- data/app/commands/decidim/decidim_awesome/create_editor_image.rb +2 -2
- data/app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb +0 -28
- data/app/controllers/concerns/decidim/decidim_awesome/needs_hashcash.rb +41 -0
- data/app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb +2 -2
- data/app/controllers/decidim/decidim_awesome/admin/admin_authorizations_controller.rb +2 -2
- data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +0 -10
- data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +2 -1
- data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +1 -2
- data/app/controllers/decidim/decidim_awesome/admin/hashcash_controller.rb +39 -0
- data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +1 -1
- data/app/controllers/decidim/decidim_awesome/admin/{maintenance_controller.rb → private_data_controller.rb} +9 -9
- data/app/controllers/decidim/decidim_awesome/utils_controller.rb +17 -0
- data/app/forms/concerns/decidim/decidim_awesome/proposals/{proposal_wizard_create_step_form_override.rb → proposal_form_customizations.rb} +1 -1
- data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb +7 -1
- data/app/forms/concerns/decidim/decidim_awesome/system/organization_form_override.rb +2 -2
- data/app/forms/decidim/decidim_awesome/admin/config_form.rb +13 -0
- data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +1 -1
- data/app/helpers/decidim/decidim_awesome/map_helper.rb +4 -2
- data/app/models/decidim/decidim_awesome/paper_trail_version.rb +1 -1
- data/app/overrides/decidim/devise/registrations/new/add_hashcash.html.erb.deface +3 -0
- data/app/overrides/decidim/devise/sessions/new/add_hashcash.html.erb.deface +3 -0
- data/app/overrides/layouts/decidim/_head/add_awesome_custom_styles.html.erb.deface +3 -0
- data/app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface +0 -2
- data/app/packs/entrypoints/decidim_admin_decidim_awesome_search_form.scss +1 -0
- data/app/packs/entrypoints/decidim_decidim_awesome_hashcash.js +4 -0
- data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +10 -6
- data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +4 -2
- data/app/packs/src/decidim/decidim_awesome/admin/verifications.js +6 -3
- data/app/packs/src/decidim/decidim_awesome/awesome_map/api/proposals_fetcher.js +1 -1
- data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/controller.js +1 -1
- data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js +1 -1
- data/app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js +6 -6
- data/app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js +1 -1
- data/app/packs/src/decidim/decidim_awesome/forms/autosave.js +3 -3
- data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +1 -113
- data/app/packs/src/decidim/decidim_awesome/proposals/images.js +1 -1
- data/app/packs/src/vendor/form_builder_langs/ar-SA.lang +111 -0
- data/app/packs/src/vendor/form_builder_langs/ar-TN.lang +94 -0
- data/app/packs/src/vendor/form_builder_langs/ca-ES.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/cs-CZ.lang +105 -0
- data/app/packs/src/vendor/form_builder_langs/da-DK.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/de-DE.lang +109 -0
- data/app/packs/src/vendor/form_builder_langs/el-GR.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/en-US.lang +117 -0
- data/app/packs/src/vendor/form_builder_langs/es-ES.lang +103 -0
- data/app/packs/src/vendor/form_builder_langs/fa-IR.lang +108 -0
- data/app/packs/src/vendor/form_builder_langs/fi-FI.lang +107 -0
- data/app/packs/src/vendor/form_builder_langs/fr-FR.lang +117 -0
- data/app/packs/src/vendor/form_builder_langs/he-IL.lang +108 -0
- data/app/packs/src/vendor/form_builder_langs/hi-IN.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/hu-HU.lang +108 -0
- data/app/packs/src/vendor/form_builder_langs/id-ID.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/it-IT.lang +107 -0
- data/app/packs/src/vendor/form_builder_langs/ja-JP.lang +108 -0
- data/app/packs/src/vendor/form_builder_langs/my-MM.lang +108 -0
- data/app/packs/src/vendor/form_builder_langs/nb-NO.lang +94 -0
- data/app/packs/src/vendor/form_builder_langs/nl-NL.lang +94 -0
- data/app/packs/src/vendor/form_builder_langs/pl-PL.lang +122 -0
- data/app/packs/src/vendor/form_builder_langs/pt-BR.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/pu-IN.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/qz-MM.lang +108 -0
- data/app/packs/src/vendor/form_builder_langs/ro-RO.lang +94 -0
- data/app/packs/src/vendor/form_builder_langs/ru-RU.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/sl-SI.lang +110 -0
- data/app/packs/src/vendor/form_builder_langs/th-TH.lang +111 -0
- data/app/packs/src/vendor/form_builder_langs/tr-TR.lang +115 -0
- data/app/packs/src/vendor/form_builder_langs/uk-UA.lang +108 -0
- data/app/packs/src/vendor/form_builder_langs/vi-VN.lang +94 -0
- data/app/packs/src/vendor/form_builder_langs/zh-CN.lang +100 -0
- data/app/packs/src/vendor/form_builder_langs/zh-TW.lang +94 -0
- data/app/packs/src/vendor/hashcash.js +83 -0
- data/app/packs/src/vendor/sha1.js +143 -0
- data/app/packs/src/vendor/stamp.js +50 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/admin/admin_accountability.scss +67 -0
- data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +2 -12
- data/app/permissions/decidim/decidim_awesome/permissions.rb +3 -2
- data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +2 -2
- data/app/uploaders/decidim/decidim_awesome/image_uploader.rb +12 -0
- data/app/views/decidim/decidim_awesome/admin/admin_accountability/index.html.erb +5 -4
- data/app/views/decidim/decidim_awesome/admin/admin_authorizations/callout.html.erb +2 -2
- data/app/views/decidim/decidim_awesome/admin/admin_authorizations/conflict.html.erb +4 -4
- data/app/views/decidim/decidim_awesome/admin/admin_authorizations/edit.html.erb +6 -5
- data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +6 -6
- data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +2 -2
- data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +3 -3
- data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +4 -3
- data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +4 -4
- data/app/views/decidim/decidim_awesome/admin/config/_form_scoped_styles.html.erb +3 -3
- data/app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb +40 -2
- data/app/views/decidim/decidim_awesome/admin/config/_form_verifications.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/hashcash/_filters.html.erb +55 -0
- data/app/views/decidim/decidim_awesome/admin/hashcash/index.html.erb +33 -0
- data/app/views/decidim/decidim_awesome/admin/hashcash/ip_addresses.html.erb +29 -0
- data/app/views/decidim/decidim_awesome/admin/hashcash/show.html.erb +42 -0
- data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +2 -2
- data/app/views/decidim/decidim_awesome/admin/{maintenance → private_data}/_private_data.html.erb +2 -2
- data/app/views/decidim/decidim_awesome/admin/{maintenance/show.html.erb → private_data/index.html.erb} +2 -3
- data/app/views/decidim/decidim_awesome/admin/proposals/_private_body.html.erb +1 -1
- data/app/views/decidim/decidim_awesome/admin/shared/_filters_with_date.html.erb +41 -32
- data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +2 -2
- data/app/views/decidim/decidim_awesome/hashcash/_hidden_field.html.erb +5 -0
- data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +1 -1
- data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +2 -2
- data/app/views/layouts/decidim/decidim_awesome/admin/maintenance.html.erb +2 -11
- data/config/assets.rb +3 -1
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/ca.yml +69 -30
- data/config/locales/cs.yml +68 -29
- data/config/locales/de.yml +67 -28
- data/config/locales/en.yml +81 -32
- data/config/locales/es.yml +68 -29
- data/config/locales/eu.yml +31 -31
- data/config/locales/fr.yml +82 -31
- data/config/locales/ja.yml +31 -31
- data/lib/decidim/decidim_awesome/admin_engine.rb +8 -5
- data/lib/decidim/decidim_awesome/awesome.rb +49 -27
- data/lib/decidim/decidim_awesome/checksums.yml +47 -42
- data/lib/decidim/decidim_awesome/context_analyzers/request_analyzer.rb +2 -2
- data/lib/decidim/decidim_awesome/engine.rb +16 -6
- data/lib/decidim/decidim_awesome/menu.rb +151 -138
- data/lib/decidim/decidim_awesome/test/initializer.rb +4 -1
- data/lib/decidim/decidim_awesome/test/shared_examples/box_label_editor_examples.rb +14 -14
- data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +2 -4
- data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +8 -8
- data/lib/decidim/decidim_awesome/test/shared_examples/custom_styles_examples.rb +6 -6
- data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +5 -4
- data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +5 -5
- data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +16 -9
- data/lib/decidim/decidim_awesome/version.rb +2 -2
- data/lib/decidim/decidim_awesome.rb +0 -1
- data/lib/tasks/decidim_awesome_upgrade_tasks.rake +4 -5
- data/package.json +9 -18
- metadata +82 -26
- data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +0 -107
- data/app/uploaders/decidim/cw/decidim_awesome/image_uploader.rb +0 -26
- data/config/rubocop/disabled.yml +0 -11
- data/config/rubocop/faker.yml +0 -480
- data/config/rubocop/rails.yml +0 -88
- data/config/rubocop/rspec.yml +0 -65
- data/config/rubocop/ruby.yml +0 -1210
- data/lib/decidim/decidim_awesome/content_parsers/editor_images_parser.rb +0 -39
- data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +0 -35
- /data/{app/middleware/decidim/decidim_awesome → lib/decidim/decidim_awesome/middleware}/current_config.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e111d7d8a993a82615ebe5876f238141d046d140d17cc2ce8a47bd57a6e4028b
|
4
|
+
data.tar.gz: 21012c001100d7bb1fdc7555a6650b695ba990bca5b38e0014ac78082af6f15e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70df95271a2b16f3510ee8fa6549ec616f9c38963b5266291acfa8ec0bf572980af1781474be44b55ee0bd4cdff04efbfb6c135ca48bafe2676ab9d8a2ffc3c6
|
7
|
+
data.tar.gz: 6e75d54f61ffde030812ff30e6f4ec58b6db4d2e1ce8168f38c58921efa3bf8a648c4c5c58801a714e0740beeabb3d16df97319badab04bae70cd6171169114b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,47 @@
|
|
1
1
|
CHANGELOG
|
2
2
|
=========
|
3
3
|
|
4
|
+
v0.12.2
|
5
|
+
-------
|
6
|
+
|
7
|
+
Compatibility:
|
8
|
+
- Decidim 0.29.x
|
9
|
+
|
10
|
+
Features:
|
11
|
+
- Fix custom styles loading order
|
12
|
+
- Fix for awesome map no loading in a component
|
13
|
+
- Fix "other" options in checkbox/radio custom fields
|
14
|
+
- Added Mobile Menu Override
|
15
|
+
|
16
|
+
v0.12.2
|
17
|
+
-------
|
18
|
+
|
19
|
+
Compatibility:
|
20
|
+
- Decidim 0.29.x
|
21
|
+
|
22
|
+
Features:
|
23
|
+
- Added HashCash anti-bot mechanism
|
24
|
+
- Fixed multi-tenant crossover in admin accountability
|
25
|
+
|
26
|
+
v0.12.1
|
27
|
+
-------
|
28
|
+
|
29
|
+
Compatibility:
|
30
|
+
- Decidim 0.29.x
|
31
|
+
|
32
|
+
Feature:
|
33
|
+
- Added formBuilder languages controller to avoid external CDN
|
34
|
+
- Fix cache hash in the global menu override
|
35
|
+
- Fix crash on updating empty boxes for scoped admins
|
36
|
+
|
37
|
+
v0.12.0
|
38
|
+
-------
|
39
|
+
Compatibility:
|
40
|
+
- Decidim 0.29.x
|
41
|
+
|
42
|
+
Features:
|
43
|
+
- Upgrade to Decidim v0.29
|
44
|
+
|
4
45
|
v0.11.4
|
5
46
|
-------
|
6
47
|
Compatibility:
|
@@ -88,8 +129,8 @@ Compatibility:
|
|
88
129
|
|
89
130
|
Features:
|
90
131
|
- Migrate to [Deface](https://github.com/spree/deface) for overrides
|
91
|
-
- Introduce Weighted Voting with configurable manifests for different types of
|
92
|
-
- Fix wrong
|
132
|
+
- Introduce Weighted Voting with configurable manifests for different types of voting with grades
|
133
|
+
- Fix wrong behavior showing proposals on map
|
93
134
|
- Introduced new sorting options for proposals. Added alphabetical sorting, reverse sorting, sorting by votes first and last.
|
94
135
|
|
95
136
|
v0.9.3
|
@@ -111,7 +152,7 @@ Compatibility:
|
|
111
152
|
|
112
153
|
Features:
|
113
154
|
- Fixes for the menu hacker
|
114
|
-
|
155
|
+
|
115
156
|
v0.9.1
|
116
157
|
------
|
117
158
|
|
@@ -187,7 +228,7 @@ Features:
|
|
187
228
|
- Now awesome components can be disabled using the `disabled_components` configuration var.
|
188
229
|
- Feature: Custom redirections editor: Create shorter URL redirections to other places, inside or outside Decidim.
|
189
230
|
- Update to webpacker compatiblity and Decidim 0.25
|
190
|
-
- Added tasks `bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave` and `bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave` (also accessible as a
|
231
|
+
- Added tasks `bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave` and `bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave` (also accessible as a background job from the awesome admin checks)
|
191
232
|
- REMOVED: SCSS themes are not available anymore (the alternative is to use custom styles). This is mostly because of webpacker.
|
192
233
|
|
193
234
|
v0.7.2
|
@@ -199,7 +240,7 @@ Compatibility:
|
|
199
240
|
|
200
241
|
Features:
|
201
242
|
- Added custom fields (with admin interface and scopable) to replace normal body in proposals.
|
202
|
-
- Change Markdown editor
|
243
|
+
- Change Markdown editor behavior: now it is converted to HTML before storing in the database. This makes the editor compatible with all Rich Text editors.
|
203
244
|
- Added icons in the awesome config menu
|
204
245
|
- Fixes scoped admins accessing process groups
|
205
246
|
|
@@ -215,7 +256,7 @@ Features:
|
|
215
256
|
- Add Awesome Map content block for the homepage
|
216
257
|
- Added processes groups constraint for different scoped tweaks
|
217
258
|
- Added "Never" constraint to deactivated scoped tweaks temporarily
|
218
|
-
- Change Markdown editor
|
259
|
+
- Change Markdown editor behavior: now it is converted to HTML before storing in the database. This makes the editor compatible with all Rich Text editors. This also takes this feature out the the "experimental" zone as the resulting edited text is fully compatible with standard Decidim.
|
219
260
|
- Added scoped admins feature: Any user can be turned into a limited admin and scoped to one or more participatory spaces.
|
220
261
|
- Fix allowing access to participatory space admins (only full admins can access the module).
|
221
262
|
- Added `participatory_spaces_routes_context` config variable to specify additional routes correspondences to participatory spaces.
|
data/README.md
CHANGED
@@ -121,21 +121,8 @@ Technically, the content is stored in the database as an XML document compatible
|
|
121
121
|

|
122
122
|

|
123
123
|
|
124
|
-
Note that the custom fields are build using the jQuery library [formBuilder](https://formbuilder.online). This package is included in Decidim Awesome but the i18n translations are not. By default they are dynamically downloaded from the CDN https://cdn.jsdelivr.net/npm/formbuilder-languages@1.1.0/.
|
125
|
-
If you wish to provide an alternative place for those files, you can configure the variable `form_builder_langs_location` in an initializer:
|
126
124
|
|
127
|
-
|
128
|
-
# config/initializers/awesome_defaults.rb
|
129
|
-
|
130
|
-
# A URL where to obtain the translations for the FormBuilder component
|
131
|
-
# you can a custom place if you are worried about the CDN geolocation
|
132
|
-
# Download them from https://github.com/kevinchappell/formBuilder-languages
|
133
|
-
|
134
|
-
# For instance, copy them to your /public/fb_locales/ directory and set the path here:
|
135
|
-
Decidim::DecidimAwesome.configure do |config|
|
136
|
-
config.form_builder_langs_location = "/fb_locales/"
|
137
|
-
end
|
138
|
-
```
|
125
|
+
Translations for this feature are extracted from the [NPM formBuilder-languages](https://github.com/kevinchappell/formBuilder-languages).
|
139
126
|
|
140
127
|
##### 11.1. GraphQL types for custom fields
|
141
128
|
|
@@ -317,7 +304,7 @@ When building a new view for the vote button ([see the original](https://github.
|
|
317
304
|
- If votes are blocked `if current_settings.votes_blocked?`
|
318
305
|
- If the user has already voted `if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user)`
|
319
306
|
- If maximum votes have already reached `if proposal.maximum_votes_reached?`
|
320
|
-
- If the proposal can accumulate supports beyond maximum `if proposal.
|
307
|
+
- If the proposal can accumulate supports beyond maximum `if proposal.can_accumulate_votes_beyond_threshold`
|
321
308
|
- If the current component allows the user to participate `if current_component.participatory_space.can_participate?(current_user)`
|
322
309
|
- Note that the [original view](https://github.com/decidim/decidim/blob/release/0.28-stable/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb) is overridden only inside the tag `<div id="proposal-<%= proposal.id %>-vote-button" class="button--vote-button">`. You only need to substitute the part inside.
|
323
310
|
|
@@ -413,7 +400,7 @@ Decidim::DecidimAwesome.configure do |config|
|
|
413
400
|
#### 21. Manual verifications
|
414
401
|
|
415
402
|
The admin will be allowed to manually authorize users using the methods specified in the `/system` admin section.
|
416
|
-
Currently, only form based handlers are supported (Direct methods).
|
403
|
+
Currently, only form based handlers are supported (Direct methods).
|
417
404
|
Admins can manually override or verify users in the participants list but they still have to fulfill the requirements of the verifier (although they will be allowed to force the authorization even if some of them fails).
|
418
405
|
|
419
406
|
Admin logs are also created in each action for accountability.
|
@@ -425,6 +412,19 @@ System configuration:
|
|
425
412
|

|
426
413
|

|
427
414
|
|
415
|
+
#### 22. HashCash Anti-Bot login/registration
|
416
|
+
|
417
|
+
This feature adds a HashCash-based anti-bot mechanism to the login and registration forms. HashCash is a proof-of-work system originally designed to limit email spam and denial-of-service attacks. When enabled, users must solve a computational puzzle (a "stamp") before submitting the form, making automated attacks significantly harder.
|
418
|
+
|
419
|
+
The integration leverages the [ActiveHashcash](https://github.com/BaseSecrete/active_hashcash) gem to generate and verify HashCash stamps (although with some customizations). For more details on the HashCash protocol, see the [official documentation](http://www.hashcash.org/docs/hashcash.html).
|
420
|
+
|
421
|
+
When this feature is active, each login or registration attempt requires a valid HashCash stamp, effectively reducing the risk of automated bot submissions.
|
422
|
+
|
423
|
+
Note this feature is **disabled by default**, admins can enabled it under the "Surveys & Forms" menu in the Decidim Awesome admin dashboard.
|
424
|
+
|
425
|
+

|
426
|
+

|
427
|
+
|
428
428
|
#### To be continued...
|
429
429
|
|
430
430
|
We're not done! Please check the [issues](/decidim-ice/decidim-module-decidim_awesome/issues) (and participate) to see what's on our mind
|
@@ -464,29 +464,14 @@ Go to `yourdomain/admin/decidim_awesome` and start tweaking things!
|
|
464
464
|
> bin/rails decidim_decidim_awesome:webpacker:install
|
465
465
|
> ```
|
466
466
|
|
467
|
-
|
468
|
-
If you are upgrading from a version prior to 0.8, make sure to visit the URL `/admin/decidim_awesome/checks` and run image migrations for the old images:
|
469
|
-
|
470
|
-

|
471
|
-
|
472
|
-
If you are a system admin, you can also perform this task by executing this rake task in the console:
|
473
|
-
|
474
|
-
```
|
475
|
-
RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave
|
476
|
-
```
|
477
|
-
|
478
|
-
Or check your migration status with:
|
479
|
-
```
|
480
|
-
RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave
|
481
|
-
```
|
482
|
-
|
483
467
|
The correct version of Decidim Awesome should resolved automatically by the Bundler.
|
484
|
-
However you can force some specific version using `gem "decidim-decidim_awesome", "~> 0.
|
468
|
+
However you can force some specific version using `gem "decidim-decidim_awesome", "~> 0.12.0"` in the Gemfile.
|
485
469
|
|
486
470
|
Depending on your Decidim version, choose the corresponding Awesome version to ensure compatibility:
|
487
471
|
|
488
472
|
| Awesome version | Compatible Decidim versions |
|
489
473
|
|---|---|
|
474
|
+
| 0.12.x | 0.29.x |
|
490
475
|
| 0.11.x | 0.28.x |
|
491
476
|
| 0.10.x | >= 0.26.7, >= 0.27.x |
|
492
477
|
| 0.9.2 | >= 0.26.7, >= 0.27.3 |
|
@@ -582,6 +567,16 @@ can add the environment variables to the root directory of the project in a file
|
|
582
567
|
named `.rbenv-vars`. If these are defined for the environment, you can omit
|
583
568
|
defining these in the commands shown above.
|
584
569
|
|
570
|
+
### Updating formBuilder languages
|
571
|
+
|
572
|
+
There's a rake task to update the translations of the custom field's form builder interface:
|
573
|
+
|
574
|
+
```
|
575
|
+
bundle exec rake update_form_builder_i18n
|
576
|
+
```
|
577
|
+
|
578
|
+
This updates the `app/packs/src/vendor/form_builder_langs` folder.
|
579
|
+
|
585
580
|
### Code Styling
|
586
581
|
|
587
582
|
Please follow the code styling defined by the different linters that ensure we
|
@@ -600,7 +595,6 @@ bundle exec rubocop
|
|
600
595
|
To ease up following the style guide, you should install the plugin to your
|
601
596
|
favorite editor, such as:
|
602
597
|
|
603
|
-
- Atom - [linter-rubocop](https://atom.io/packages/linter-rubocop)
|
604
598
|
- Sublime Text - [Sublime RuboCop](https://github.com/pderichs/sublime_rubocop)
|
605
599
|
- Visual Studio Code - [Rubocop for Visual Studio Code](https://github.com/misogi/vscode-ruby-rubocop)
|
606
600
|
|
@@ -614,8 +608,8 @@ DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rake test_
|
|
614
608
|
DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rspec
|
615
609
|
```
|
616
610
|
|
617
|
-
> Note: the following is not currently applicable as version v0.11 is
|
618
|
-
>
|
611
|
+
> Note: the following is not currently applicable as from version v0.11 this plugin is compatible one version at the time.
|
612
|
+
> This is left here for future reference.
|
619
613
|
|
620
614
|
However, this project works with different versions of Decidim. In order to test them all, we maintain two different Gemfiles: `Gemfile` and `Gemfile.legacy`. The first one is used for development and testing the latest Decidim version supported, the second one is used for testing against the old Decidim version.
|
621
615
|
|
@@ -624,9 +618,9 @@ You can run run tests against the legacy Decidim versions by using:
|
|
624
618
|
```bash
|
625
619
|
export DATABASE_USERNAME=<username>
|
626
620
|
export DATABASE_PASSWORD=<password>
|
627
|
-
RBENV_VERSION=3.
|
628
|
-
RBENV_VERSION=3.
|
629
|
-
RBENV_VERSION=3.
|
621
|
+
RBENV_VERSION=3.2.2 BUNDLE_GEMFILE=Gemfile.legacy bundle
|
622
|
+
RBENV_VERSION=3.2.2 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rake test_app
|
623
|
+
RBENV_VERSION=3.2.2 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rspec
|
630
624
|
```
|
631
625
|
|
632
626
|
For convenience, you can use the scripts `bin/test` and `bin/test-legacy` to run tests against one or the other version:
|
data/Rakefile
CHANGED
@@ -6,6 +6,7 @@ require "fileutils"
|
|
6
6
|
def install_module(path)
|
7
7
|
Dir.chdir(path) do
|
8
8
|
system("bundle exec rake decidim_decidim_awesome:install:migrations")
|
9
|
+
system("bundle exec rake active_hashcash:install:migrations")
|
9
10
|
system("bundle exec rake db:migrate")
|
10
11
|
end
|
11
12
|
end
|
@@ -55,3 +56,14 @@ task :development_app do
|
|
55
56
|
override_webpacker_config_files("development_app")
|
56
57
|
seed_db("development_app")
|
57
58
|
end
|
59
|
+
|
60
|
+
desc "Update languages for custom fields"
|
61
|
+
task :update_form_builder_i18n do
|
62
|
+
puts "Updating languages for custom fields from formbuilder-languages NPM package..."
|
63
|
+
system("npm install formbuilder-languages")
|
64
|
+
puts "Copying files..."
|
65
|
+
|
66
|
+
Dir.glob("node_modules/formbuilder-languages/*.lang").each do |file_lang|
|
67
|
+
FileUtils.cp(file_lang, "app/packs/src/vendor/form_builder_langs", verbose: true)
|
68
|
+
end
|
69
|
+
end
|
@@ -6,14 +6,26 @@ module Decidim
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
included do
|
9
|
+
private
|
10
|
+
|
9
11
|
def cache_hash
|
10
|
-
[
|
12
|
+
@decidim_awesome_cache_hash ||= [
|
11
13
|
"decidim/content_blocks/global_menu",
|
12
14
|
current_organization.cache_key_with_version,
|
13
15
|
I18n.locale,
|
14
|
-
|
16
|
+
*extra_cache_keys
|
15
17
|
].join(Decidim.cache_key_separator)
|
16
18
|
end
|
19
|
+
|
20
|
+
def extra_cache_keys
|
21
|
+
[].tap do |array|
|
22
|
+
array << awesome_config[:home_content_block_menu].to_s
|
23
|
+
if defined?(current_user) && current_user
|
24
|
+
array << current_user.id
|
25
|
+
array << Decidim::Authorization.find_by(user: current_user)&.cache_key_with_version
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
17
29
|
end
|
18
30
|
end
|
19
31
|
end
|
@@ -15,10 +15,11 @@ module Decidim
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def cache_hash
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
@decidim_awesome_cache_hash ||= begin
|
19
|
+
all_extra_fields = memoize("extra_fields")
|
20
|
+
extra_fields = all_extra_fields ? all_extra_fields[resource.id] : resource.extra_fields
|
21
|
+
"#{decidim_original_cache_hash}#{Decidim.cache_key_separator}#{extra_fields&.vote_weight_totals}"
|
22
|
+
end
|
22
23
|
end
|
23
24
|
end
|
24
25
|
end
|
@@ -12,9 +12,9 @@
|
|
12
12
|
voted_for?(0) ? t("decidim.decidim_awesome.voting.voting_cards.abstained") : proposal.manifest.label_for(0),
|
13
13
|
proposal_vote_path(0),
|
14
14
|
link_options(0).merge({
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
title: t("decidim.decidim_awesome.voting.voting_cards.voting_for", proposal: sanitized_title, type: proposal.manifest.label_for(0)),
|
16
|
+
class: "button button__sm button__transparent-secondary mb-4 vote-action abstain-button #{classes_for(0)}"
|
17
|
+
}) %>
|
18
18
|
<% end %>
|
19
19
|
|
20
20
|
<% if voted_for_any? && !current_settings.votes_blocked? %>
|
@@ -27,7 +27,7 @@
|
|
27
27
|
id: "change-vote",
|
28
28
|
class: "change-vote-button vote-action font-semibold" %>
|
29
29
|
</p>
|
30
|
-
<% elsif proposal.maximum_votes_reached? && !proposal.
|
30
|
+
<% elsif proposal.maximum_votes_reached? && !proposal.can_accumulate_votes_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
|
31
31
|
<p class="text-center"><%= t("decidim.proposals.proposals.vote_button.maximum_votes_reached") %></p>
|
32
32
|
<% elsif vote_limit_enabled? && remaining_votes_count_for(current_user) <= 0 %>
|
33
33
|
<p class="text-center"><%= t("decidim.proposals.proposals.vote_button.no_votes_remaining") %></p>
|
@@ -9,7 +9,7 @@
|
|
9
9
|
<span class="vote-label"><%= proposal.manifest.label_for(weight) %></span>
|
10
10
|
<%= content_tag :svg, role: "img" do
|
11
11
|
content_tag(:title, t("decidim.decidim_awesome.voting.voting_cards.voting_for", proposal: sanitized_title, type: proposal.manifest.label_for(weight))) +
|
12
|
-
|
12
|
+
content_tag(:use, "", "href" => svg_path(weight))
|
13
13
|
end %>
|
14
14
|
<% end %>
|
15
15
|
</div>
|
@@ -18,8 +18,8 @@ module Decidim
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def vote_instructions
|
21
|
-
translated_attribute(current_component.settings.voting_cards_instructions).presence ||
|
22
|
-
|
21
|
+
translated_attribute(current_component.settings.voting_cards_instructions).presence ||
|
22
|
+
t("decidim.decidim_awesome.voting.voting_cards.default_instructions_html", organization: translated_attribute(current_organization.name))
|
23
23
|
end
|
24
24
|
|
25
25
|
def proposal_votes(weight)
|
@@ -69,9 +69,7 @@ module Decidim
|
|
69
69
|
def disabled?
|
70
70
|
return true if voted_for_any? || current_settings.votes_blocked?
|
71
71
|
|
72
|
-
if proposal.maximum_votes_reached? && !proposal.
|
73
|
-
return true
|
74
|
-
end
|
72
|
+
return true if proposal.maximum_votes_reached? && !proposal.can_accumulate_votes_beyond_threshold && current_component.participatory_space.can_participate?(current_user)
|
75
73
|
|
76
74
|
true if vote_limit_enabled? && remaining_votes_count_for(current_user) <= 0
|
77
75
|
end
|
@@ -13,11 +13,11 @@ module Decidim
|
|
13
13
|
decidim_update_personal_data
|
14
14
|
return if @form.user_time_zone.blank?
|
15
15
|
|
16
|
-
|
17
|
-
if @form.user_time_zone ==
|
18
|
-
|
16
|
+
current_user.extended_data ||= {}
|
17
|
+
if @form.user_time_zone == current_user.organization.time_zone
|
18
|
+
current_user.extended_data.delete("time_zone")
|
19
19
|
else
|
20
|
-
|
20
|
+
current_user.extended_data["time_zone"] = @form.user_time_zone
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module DecidimAwesome
|
5
|
-
class CreateEditorImage < Command
|
5
|
+
class CreateEditorImage < Decidim::Command
|
6
6
|
# Creates a blueprint.
|
7
7
|
#
|
8
8
|
# form - The form with the data.
|
@@ -13,7 +13,7 @@ module Decidim
|
|
13
13
|
# Executes the command. Broadcasts these events:
|
14
14
|
#
|
15
15
|
# - :ok when everything is valid
|
16
|
-
# - :invalid if the form wasn't valid and we couldn't proceed.
|
16
|
+
# - :invalid if the form wasn't valid, and we couldn't proceed.
|
17
17
|
#
|
18
18
|
# Returns nothing.
|
19
19
|
def call
|
@@ -8,34 +8,6 @@ module Decidim
|
|
8
8
|
|
9
9
|
included do
|
10
10
|
layout "decidim/decidim_awesome/admin/maintenance"
|
11
|
-
helper_method :current_view, :available_views, :present_private_data
|
12
|
-
|
13
|
-
private
|
14
|
-
|
15
|
-
def present_private_data(model)
|
16
|
-
PrivateDataPresenter.new(model)
|
17
|
-
end
|
18
|
-
|
19
|
-
def current_view
|
20
|
-
return params[:id] if available_views.include?(params[:id])
|
21
|
-
|
22
|
-
available_views.keys.first
|
23
|
-
end
|
24
|
-
|
25
|
-
def available_views
|
26
|
-
{
|
27
|
-
"private_data" => {
|
28
|
-
title: I18n.t("private_data", scope: "decidim.decidim_awesome.admin.menu.maintenance"),
|
29
|
-
icon: "spy-line",
|
30
|
-
path: decidim_admin_decidim_awesome.maintenance_path("private_data")
|
31
|
-
},
|
32
|
-
"checks" => {
|
33
|
-
title: I18n.t("checks", scope: "decidim.decidim_awesome.admin.menu.maintenance"),
|
34
|
-
icon: "pulse",
|
35
|
-
path: decidim_admin_decidim_awesome.checks_maintenance_index_path
|
36
|
-
}
|
37
|
-
}
|
38
|
-
end
|
39
11
|
end
|
40
12
|
end
|
41
13
|
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module DecidimAwesome
|
5
|
+
module NeedsHashcash
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
included do
|
9
|
+
include AwesomeHelpers
|
10
|
+
include ActiveHashcash
|
11
|
+
|
12
|
+
helper_method :awesome_hashcash_bits
|
13
|
+
before_action :set_hashcash_bits
|
14
|
+
before_action :awesome_check_hashcash, only: :create # rubocop:disable Rails/LexicallyScopedActionFilter
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def awesome_hashcash_bits(zone)
|
20
|
+
return false unless awesome_config["hashcash_#{zone}".to_sym]
|
21
|
+
|
22
|
+
awesome_config["hashcash_#{zone}_bits".to_sym]
|
23
|
+
end
|
24
|
+
|
25
|
+
def awesome_check_hashcash
|
26
|
+
return unless set_hashcash_bits
|
27
|
+
|
28
|
+
check_hashcash
|
29
|
+
end
|
30
|
+
|
31
|
+
# Dynamically configures the gem https://github.com/BaseSecrete/active_hashcash
|
32
|
+
def set_hashcash_bits
|
33
|
+
if controller_name == "sessions"
|
34
|
+
ActiveHashcash.bits = awesome_hashcash_bits(:login)
|
35
|
+
elsif controller_name == "registrations"
|
36
|
+
ActiveHashcash.bits = awesome_hashcash_bits(:signup)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -14,9 +14,9 @@ module Decidim
|
|
14
14
|
return unless Decidim::User.respond_to? :awesome_admins_for_current_scope
|
15
15
|
return unless Decidim::User.respond_to? :awesome_potential_admins
|
16
16
|
return unless defined? current_user
|
17
|
-
return unless Decidim::User.awesome_potential_admins.include? current_user
|
17
|
+
return unless Decidim::User.awesome_potential_admins.include? current_user&.id
|
18
18
|
|
19
|
-
#
|
19
|
+
# assigning a flash message here does not work after redirection due the order of middleware in Rails
|
20
20
|
# as a workaround, send a message through a get parameter
|
21
21
|
path = "/admin/?unauthorized"
|
22
22
|
referer = request.headers["Referer"]
|
@@ -32,8 +32,8 @@ module Decidim
|
|
32
32
|
if force_verification.present?
|
33
33
|
create_forced_authorization
|
34
34
|
else
|
35
|
-
|
36
|
-
message
|
35
|
+
callout = render_to_string("callout", locals: { i18n_key: "user_not_authorized", klass: "alert" }, layout: false)
|
36
|
+
message = render_to_string("edit", locals: { with_override: true, callout: })
|
37
37
|
end
|
38
38
|
end
|
39
39
|
on(:ok) do
|
@@ -15,12 +15,6 @@ module Decidim
|
|
15
15
|
|
16
16
|
helper_method :head, :admin_head, :head_addons, :admin_addons
|
17
17
|
|
18
|
-
def migrate_images
|
19
|
-
Decidim::DecidimAwesome::MigrateLegacyImagesJob.perform_later(current_organization.id)
|
20
|
-
flash[:notice] = I18n.t("image_migrations_started", scope: "decidim.decidim_awesome.admin.checks.index")
|
21
|
-
redirect_to checks_maintenance_index_path
|
22
|
-
end
|
23
|
-
|
24
18
|
private
|
25
19
|
|
26
20
|
def head
|
@@ -58,10 +52,6 @@ module Decidim
|
|
58
52
|
rescue ActionView::Template::Error => e
|
59
53
|
flash.now[:alert] = "Partial [#{partial}] has thrown an error: #{e.message}"
|
60
54
|
end
|
61
|
-
|
62
|
-
def current_view
|
63
|
-
"checks"
|
64
|
-
end
|
65
55
|
end
|
66
56
|
end
|
67
57
|
end
|
@@ -16,8 +16,9 @@ module Decidim
|
|
16
16
|
|
17
17
|
def show
|
18
18
|
@form = form(ConfigForm).from_params(organization_awesome_config)
|
19
|
+
path = main_path_for(config_var)
|
19
20
|
|
20
|
-
redirect_to decidim_admin_decidim_awesome.
|
21
|
+
redirect_to decidim_admin_decidim_awesome.send(path[0], *path[1]) unless path[0] == :config_path
|
21
22
|
end
|
22
23
|
|
23
24
|
def update
|
@@ -3,13 +3,12 @@
|
|
3
3
|
module Decidim
|
4
4
|
module DecidimAwesome
|
5
5
|
module Admin
|
6
|
-
# Editing menu items
|
7
6
|
class CustomRedirectsController < DecidimAwesome::Admin::ApplicationController
|
8
7
|
include NeedsAwesomeConfig
|
9
8
|
include ConfigConstraintsHelpers
|
10
9
|
|
11
10
|
before_action do
|
12
|
-
enforce_permission_to :edit_config, :
|
11
|
+
enforce_permission_to :edit_config, :custom_redirects
|
13
12
|
end
|
14
13
|
|
15
14
|
helper ConfigConstraintsHelpers
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "decidim/decidim_awesome/version"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module DecidimAwesome
|
7
|
+
module Admin
|
8
|
+
# System compatibility analyzer
|
9
|
+
class HashcashController < DecidimAwesome::Admin::ApplicationController
|
10
|
+
include NeedsAwesomeConfig
|
11
|
+
include MaintenanceContext
|
12
|
+
helper ConfigConstraintsHelpers
|
13
|
+
|
14
|
+
helper_method :stamps, :stamp, :addresses
|
15
|
+
before_action do
|
16
|
+
enforce_permission_to :edit_config, [:hashcash_login, :hashcash_signup]
|
17
|
+
end
|
18
|
+
|
19
|
+
def ip_addresses
|
20
|
+
render "ip_addresses"
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def stamps
|
26
|
+
@stamps ||= ActiveHashcash::Stamp.filter_by(params).order(created_at: :desc).limit(1000)
|
27
|
+
end
|
28
|
+
|
29
|
+
def stamp
|
30
|
+
@stamp ||= ActiveHashcash::Stamp.find_by(id: params[:id])
|
31
|
+
end
|
32
|
+
|
33
|
+
def addresses
|
34
|
+
@addresses ||= ActiveHashcash::Stamp.filter_by(params).group(:ip_address).order(count_all: :desc).limit(1000).count
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|