decidim-decidim_awesome 0.11.3 → 0.12.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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -6
  3. data/README.md +9 -25
  4. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/show.erb +1 -1
  5. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_cell.rb +3 -5
  6. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +1 -1
  7. data/app/commands/concerns/decidim/decidim_awesome/system/{register_organization_override.rb → create_organization_override.rb} +1 -1
  8. data/app/commands/concerns/decidim/decidim_awesome/update_account_override.rb +4 -4
  9. data/app/commands/decidim/decidim_awesome/admin/create_constraint.rb +1 -1
  10. data/app/commands/decidim/decidim_awesome/create_editor_image.rb +2 -2
  11. data/app/controllers/concerns/decidim/decidim_awesome/check_login_authorizations.rb +1 -1
  12. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +0 -6
  13. data/app/forms/concerns/decidim/decidim_awesome/proposals/{proposal_wizard_create_step_form_override.rb → proposal_form_customizations.rb} +1 -1
  14. data/app/forms/concerns/decidim/decidim_awesome/system/organization_form_override.rb +2 -2
  15. data/app/packs/entrypoints/decidim_admin_decidim_awesome_search_form.scss +1 -0
  16. data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +1 -1
  17. data/app/packs/stylesheets/decidim/decidim_awesome/admin/admin_accountability.scss +67 -0
  18. data/app/permissions/decidim/decidim_awesome/permissions.rb +3 -2
  19. data/app/uploaders/decidim/decidim_awesome/image_uploader.rb +12 -0
  20. data/app/views/decidim/decidim_awesome/admin/admin_accountability/index.html.erb +1 -0
  21. data/app/views/decidim/decidim_awesome/admin/shared/_filters_with_date.html.erb +41 -32
  22. data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +1 -1
  23. data/config/assets.rb +2 -1
  24. data/config/locales/de.yml +79 -0
  25. data/lib/decidim/decidim_awesome/awesome.rb +22 -21
  26. data/lib/decidim/decidim_awesome/checksums.yml +32 -2
  27. data/lib/decidim/decidim_awesome/context_analyzers/request_analyzer.rb +2 -2
  28. data/lib/decidim/decidim_awesome/engine.rb +5 -4
  29. data/lib/decidim/decidim_awesome/test/shared_examples/box_label_editor_examples.rb +14 -14
  30. data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +1 -1
  31. data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +8 -8
  32. data/lib/decidim/decidim_awesome/test/shared_examples/custom_styles_examples.rb +6 -6
  33. data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +3 -3
  34. data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +5 -5
  35. data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +8 -8
  36. data/lib/decidim/decidim_awesome/version.rb +2 -2
  37. data/lib/decidim/decidim_awesome.rb +0 -1
  38. data/lib/tasks/decidim_awesome_upgrade_tasks.rake +0 -4
  39. data/package.json +8 -16
  40. metadata +20 -19
  41. data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +0 -107
  42. data/app/uploaders/decidim/cw/decidim_awesome/image_uploader.rb +0 -26
  43. data/lib/decidim/decidim_awesome/content_parsers/editor_images_parser.rb +0 -39
  44. data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +0 -35
  45. /data/{app/middleware/decidim/decidim_awesome → lib/decidim/decidim_awesome/middleware}/current_config.rb +0 -0
@@ -26,7 +26,7 @@ shared_examples "saves content" do |key|
26
26
  click_link_or_button "Update configuration"
27
27
 
28
28
  expect(page).to have_admin_callout("updated successfully")
29
- expect(page).not_to have_content("body {background: red;}")
29
+ expect(page).to have_no_content("body {background: red;}")
30
30
  expect(page).to have_content("body {background: green;}")
31
31
  expect(page).to have_content("body {background: blue;}")
32
32
  end
@@ -37,7 +37,7 @@ shared_examples "saves content" do |key|
37
37
  click_link_or_button "Update configuration"
38
38
 
39
39
  expect(page).to have_admin_callout("Error updating configuration!")
40
- expect(page).not_to have_content("body {background: red;}")
40
+ expect(page).to have_no_content("body {background: red;}")
41
41
  expect(page).to have_content("body {background: blue;}")
42
42
  expect(page).to have_content("I am invalid CSS")
43
43
  end
@@ -68,7 +68,7 @@ shared_examples "removes a box" do
68
68
 
69
69
  expect(page).to have_admin_callout("removed successfully")
70
70
  expect(page).to have_content("body {background: blue;}")
71
- expect(page).not_to have_content("body {background: red;}")
71
+ expect(page).to have_no_content("body {background: red;}")
72
72
  expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_foo")).not_to be_present
73
73
  expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar")).to be_present
74
74
  end
@@ -121,13 +121,13 @@ shared_examples "removes a constraint" do
121
121
  end
122
122
 
123
123
  within ".scoped_styles_container[data-key=\"bar\"] .constraints-editor" do
124
- expect(page).not_to have_content("Processes")
124
+ expect(page).to have_no_content("Processes")
125
125
  end
126
126
 
127
127
  visit decidim_admin_decidim_awesome.config_path("#{var_name}s")
128
128
 
129
129
  within ".scoped_styles_container[data-key=\"bar\"] .constraints-editor" do
130
- expect(page).not_to have_content("Processes")
130
+ expect(page).to have_no_content("Processes")
131
131
  end
132
132
 
133
133
  expect(Decidim::DecidimAwesome::AwesomeConfig.find_by(organization:, var: "#{var_name}_bar")).to be_present
@@ -147,7 +147,7 @@ end
147
147
 
148
148
  shared_examples "no extra css is added" do
149
149
  it "css is no present" do
150
- expect(page.body).not_to have_content("body {background: red;}")
150
+ expect(page.body).to have_no_content("body {background: red;}")
151
151
  end
152
152
 
153
153
  it "css is not applyied" do
@@ -2,7 +2,7 @@
2
2
 
3
3
  shared_examples "has no image support" do
4
4
  it "has no image button" do
5
- expect(page).not_to have_xpath("//button[@class='editor-toolbar-control'][@data-editor-type='image']")
5
+ expect(page).to have_no_xpath("//button[@class='editor-toolbar-control'][@data-editor-type='image']")
6
6
  end
7
7
  end
8
8
 
@@ -14,7 +14,7 @@ end
14
14
 
15
15
  shared_examples "has no video support" do
16
16
  it "has no video button" do
17
- expect(page).not_to have_xpath("//button[@class='editor-toolbar-control'][@data-editor-type='videoEmbed']")
17
+ expect(page).to have_no_xpath("//button[@class='editor-toolbar-control'][@data-editor-type='videoEmbed']")
18
18
  end
19
19
  end
20
20
 
@@ -26,7 +26,7 @@ end
26
26
 
27
27
  shared_examples "has no drag and drop" do
28
28
  it "cannot drop a file" do
29
- expect(page).not_to have_content("Add images by dragging & dropping or pasting them.")
29
+ expect(page).to have_no_content("Add images by dragging & dropping or pasting them.")
30
30
  find(editor_selector).drop(image)
31
31
  expect(page.execute_script("return document.querySelector('#{editor_selector}').value")).not_to eq("[Uploading file...]")
32
32
  sleep 1
@@ -13,7 +13,7 @@ end
13
13
  shared_examples "forbids awesome access" do
14
14
  it "does not have awesome link" do
15
15
  visit decidim_admin.root_path
16
- expect(page).not_to have_content("Decidim awesome")
16
+ expect(page).to have_no_content("Decidim awesome")
17
17
  end
18
18
 
19
19
  describe "forbids module access" do
@@ -155,7 +155,7 @@ shared_examples "allows scoped admin routes" do
155
155
  it_behaves_like "redirects to index"
156
156
 
157
157
  it "is not a process page" do
158
- expect(page).not_to have_content("New process")
158
+ expect(page).to have_no_content("New process")
159
159
  end
160
160
  end
161
161
  end
@@ -171,7 +171,7 @@ end
171
171
  shared_examples "has no admin link" do
172
172
  it "has no menu link" do
173
173
  within "header" do
174
- expect(page).not_to have_css("#admin-bar", text: "Admin dashboard")
174
+ expect(page).to have_no_css("#admin-bar", text: "Admin dashboard")
175
175
  end
176
176
  end
177
177
  end
@@ -203,7 +203,7 @@ shared_examples "shows partial admin links in the frontend" do
203
203
 
204
204
  it_behaves_like "has no admin link"
205
205
  it "has no Edit button" do
206
- expect(page).not_to have_link(href: "/admin/processes")
206
+ expect(page).to have_no_link(href: "/admin/processes")
207
207
  end
208
208
  end
209
209
  end
@@ -358,7 +358,7 @@ shared_examples "shows component partial admin links in the frontend" do
358
358
 
359
359
  it_behaves_like "has no admin link"
360
360
  it "has no Edit button" do
361
- expect(page).not_to have_link(href: manage_component_path(another_component))
361
+ expect(page).to have_no_link(href: manage_component_path(another_component))
362
362
  end
363
363
  end
364
364
  end
@@ -37,8 +37,8 @@ shared_examples "activated concerns" do |enabled|
37
37
  expect(Decidim::MenuItemPresenter.included_modules).to include(Decidim::DecidimAwesome::MenuItemPresenterOverride)
38
38
  expect(Decidim::ErrorsController.included_modules).to include(Decidim::DecidimAwesome::NotFoundRedirect)
39
39
  expect(Decidim::Proposals::ApplicationHelper.included_modules).to include(Decidim::DecidimAwesome::Proposals::ApplicationHelperOverride)
40
- expect(Decidim::Proposals::ProposalWizardCreateStepForm.included_modules).to include(Decidim::DecidimAwesome::Proposals::ProposalWizardCreateStepFormOverride)
41
- expect(Decidim::Proposals::ProposalWizardCreateStepForm.included_modules).to include(Decidim::DecidimAwesome::Proposals::ProposalFormOverride)
40
+ expect(Decidim::Proposals::ProposalForm.included_modules).to include(Decidim::DecidimAwesome::Proposals::ProposalFormCustomizations)
41
+ expect(Decidim::Proposals::ProposalForm.included_modules).to include(Decidim::DecidimAwesome::Proposals::ProposalFormOverride)
42
42
  expect(Decidim::Proposals::Admin::ProposalForm.included_modules).to include(Decidim::DecidimAwesome::Proposals::ProposalFormOverride)
43
43
  expect(Decidim::AmendmentsHelper.included_modules).to include(Decidim::DecidimAwesome::AmendmentsHelperOverride)
44
44
  expect(EtiquetteValidator.included_modules).to include(Decidim::DecidimAwesome::EtiquetteValidatorOverride)
@@ -63,7 +63,7 @@ shared_examples "activated concerns" do |enabled|
63
63
  expect(Decidim::System::RegisterOrganizationForm.included_modules).to include(Decidim::DecidimAwesome::System::OrganizationFormOverride)
64
64
  expect(Decidim::System::UpdateOrganizationForm.included_modules).to include(Decidim::DecidimAwesome::System::OrganizationFormOverride)
65
65
  expect(Decidim::System::UpdateOrganization.included_modules).to include(Decidim::DecidimAwesome::System::UpdateOrganizationOverride)
66
- expect(Decidim::System::RegisterOrganization.included_modules).to include(Decidim::DecidimAwesome::System::RegisterOrganizationOverride)
66
+ expect(Decidim::System::CreateOrganization.included_modules).to include(Decidim::DecidimAwesome::System::CreateOrganizationOverride)
67
67
  expect(Decidim::AdminLog::UserPresenter.included_modules).to include(Decidim::DecidimAwesome::AdminLog::UserPresenterOverride)
68
68
  end
69
69
 
@@ -74,8 +74,8 @@ shared_examples "activated concerns" do |enabled|
74
74
  expect(Decidim::MenuItemPresenter.included_modules).not_to include(Decidim::DecidimAwesome::MenuItemPresenterOverride)
75
75
  expect(Decidim::ErrorsController.included_modules).not_to include(Decidim::DecidimAwesome::NotFoundRedirect)
76
76
  expect(Decidim::Proposals::ApplicationHelper.included_modules).not_to include(Decidim::DecidimAwesome::Proposals::ApplicationHelperOverride)
77
- expect(Decidim::Proposals::ProposalWizardCreateStepForm.included_modules).not_to include(Decidim::DecidimAwesome::Proposals::ProposalWizardCreateStepFormOverride)
78
- expect(Decidim::Proposals::ProposalWizardCreateStepForm.included_modules).not_to include(Decidim::DecidimAwesome::Proposals::ProposalFormOverride)
77
+ expect(Decidim::Proposals::ProposalForm.included_modules).not_to include(Decidim::DecidimAwesome::Proposals::ProposalFormCustomizations)
78
+ expect(Decidim::Proposals::ProposalForm.included_modules).not_to include(Decidim::DecidimAwesome::Proposals::ProposalFormOverride)
79
79
  expect(Decidim::Proposals::Admin::ProposalForm.included_modules).not_to include(Decidim::DecidimAwesome::Proposals::ProposalFormOverride)
80
80
  expect(Decidim::AmendmentsHelper.included_modules).not_to include(Decidim::DecidimAwesome::AmendmentsHelperOverride)
81
81
  expect(EtiquetteValidator.included_modules).not_to include(Decidim::DecidimAwesome::EtiquetteValidatorOverride)
@@ -223,11 +223,11 @@ shared_examples "basic rendering" do |enabled|
223
223
  end
224
224
 
225
225
  it "do not have custom fields javascript" do
226
- expect(page).not_to have_xpath("//script[contains(@src,'decidim_decidim_awesome_custom_fields')]", visible: :all)
226
+ expect(page).to have_no_xpath("//script[contains(@src,'decidim_decidim_awesome_custom_fields')]", visible: :all)
227
227
  end
228
228
 
229
229
  it "do not have custom styles CSS" do
230
- expect(page.body).not_to have_content(styles)
230
+ expect(page.body).to have_no_content(styles)
231
231
  end
232
232
  end
233
233
  end
@@ -284,7 +284,7 @@ shared_examples "basic rendering" do |enabled|
284
284
  it "has no admin menus" do
285
285
  menus.each do |menu|
286
286
  within ".sidebar-menu" do
287
- expect(page).not_to have_link(href: "/admin/decidim_awesome/#{menu}")
287
+ expect(page).to have_no_link(href: "/admin/decidim_awesome/#{menu}")
288
288
  end
289
289
  end
290
290
  end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  # This holds the decidim-decidim_awesome version.
5
5
  module DecidimAwesome
6
- VERSION = "0.11.3"
7
- COMPAT_DECIDIM_VERSION = [">= 0.28.0", "< 0.29"].freeze
6
+ VERSION = "0.12.0"
7
+ COMPAT_DECIDIM_VERSION = [">= 0.29.1", "< 0.30"].freeze
8
8
  end
9
9
  end
@@ -11,7 +11,6 @@ require "decidim/decidim_awesome/map_component/component"
11
11
  require "decidim/decidim_awesome/iframe_component/engine"
12
12
  require "decidim/decidim_awesome/iframe_component/admin_engine"
13
13
  require "decidim/decidim_awesome/iframe_component/component"
14
- require "decidim/decidim_awesome/content_parsers/editor_images_parser"
15
14
 
16
15
  # Engines to handle logic unrelated to participatory spaces or components
17
16
  Decidim.register_global_engine(
@@ -7,7 +7,3 @@ end
7
7
  Rake::Task["decidim:choose_target_plugins"].enhance do
8
8
  ENV["FROM"] = "#{ENV.fetch("FROM", nil)},decidim_decidim_awesome"
9
9
  end
10
-
11
- Rake::Task["decidim:webpacker:upgrade"].enhance do
12
- Rake::Task["decidim_decidim_awesome:webpacker:install"].invoke
13
- end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "decidim-module-decidim_awesome",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "Mods and tweaks for Decidim",
5
5
  "main": "index.js",
6
6
  "directories": {
@@ -34,26 +34,18 @@
34
34
  },
35
35
  "prettier": "@decidim/prettier-config",
36
36
  "devDependencies": {
37
- "@babel/eslint-parser": "^7.23.10",
38
- "@babel/plugin-transform-classes": "^7.23.8",
39
- "@babel/plugin-transform-regenerator": "^7.23.3",
40
- "@babel/plugin-transform-runtime": "^7.23.9",
41
- "@babel/preset-env": "^7.23.9",
42
- "@babel/preset-react": "^7.23.3",
43
- "@decidim/dev": "0.28.4",
44
- "@decidim/eslint-config": "0.28.4",
45
- "@decidim/prettier-config": "0.28.4",
46
- "@decidim/stylelint-config": "0.28.4",
37
+ "@decidim/dev": "0.29.1",
38
+ "@decidim/eslint-config": "0.29.1",
39
+ "@decidim/prettier-config": "0.29.1",
40
+ "@decidim/stylelint-config": "0.29.1",
47
41
  "postcss-scss": "^4.0.9",
48
- "sass-embedded": "~1.57.1",
49
- "@tarekraafat/autocomplete.js": "10.2.7"
42
+ "sass-embedded": "^1.83.1",
43
+ "@tarekraafat/autocomplete.js": "^10.2.9"
50
44
  },
51
45
  "dependencies": {
52
- "@rails/actioncable": "^6.1.7-6",
53
- "codemirror": "^5.65.0",
46
+ "codemirror": "^5.65.16",
54
47
  "form-storage": "^1.3.5",
55
48
  "formBuilder": "^3.19.12",
56
- "highlight.js": "^11.4.0",
57
49
  "inline-attacher": "^0.0.7",
58
50
  "jsrender": "^1.0.9",
59
51
  "leaflet.featuregroup.subgroup": "^1.0.2",
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-decidim_awesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Vergés
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 2025-01-29 00:00:00.000000000 Z
11
+ date: 2025-03-11 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: decidim-admin
@@ -15,40 +16,40 @@ dependencies:
15
16
  requirements:
16
17
  - - ">="
17
18
  - !ruby/object:Gem::Version
18
- version: 0.28.0
19
+ version: 0.29.1
19
20
  - - "<"
20
21
  - !ruby/object:Gem::Version
21
- version: '0.29'
22
+ version: '0.30'
22
23
  type: :runtime
23
24
  prerelease: false
24
25
  version_requirements: !ruby/object:Gem::Requirement
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
28
- version: 0.28.0
29
+ version: 0.29.1
29
30
  - - "<"
30
31
  - !ruby/object:Gem::Version
31
- version: '0.29'
32
+ version: '0.30'
32
33
  - !ruby/object:Gem::Dependency
33
34
  name: decidim-core
34
35
  requirement: !ruby/object:Gem::Requirement
35
36
  requirements:
36
37
  - - ">="
37
38
  - !ruby/object:Gem::Version
38
- version: 0.28.0
39
+ version: 0.29.1
39
40
  - - "<"
40
41
  - !ruby/object:Gem::Version
41
- version: '0.29'
42
+ version: '0.30'
42
43
  type: :runtime
43
44
  prerelease: false
44
45
  version_requirements: !ruby/object:Gem::Requirement
45
46
  requirements:
46
47
  - - ">="
47
48
  - !ruby/object:Gem::Version
48
- version: 0.28.0
49
+ version: 0.29.1
49
50
  - - "<"
50
51
  - !ruby/object:Gem::Version
51
- version: '0.29'
52
+ version: '0.30'
52
53
  - !ruby/object:Gem::Dependency
53
54
  name: deface
54
55
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +108,7 @@ files:
107
108
  - app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb
108
109
  - app/commands/concerns/decidim/decidim_awesome/proposals/update_collaborative_draft_override.rb
109
110
  - app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb
110
- - app/commands/concerns/decidim/decidim_awesome/system/register_organization_override.rb
111
+ - app/commands/concerns/decidim/decidim_awesome/system/create_organization_override.rb
111
112
  - app/commands/concerns/decidim/decidim_awesome/system/update_organization_override.rb
112
113
  - app/commands/concerns/decidim/decidim_awesome/update_account_override.rb
113
114
  - app/commands/decidim/decidim_awesome/admin/create_constraint.rb
@@ -160,8 +161,8 @@ files:
160
161
  - app/controllers/decidim/decidim_awesome/map_component/map_controller.rb
161
162
  - app/controllers/decidim/decidim_awesome/required_authorizations_controller.rb
162
163
  - app/forms/concerns/decidim/decidim_awesome/account_form_override.rb
164
+ - app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_customizations.rb
163
165
  - app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb
164
- - app/forms/concerns/decidim/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb
165
166
  - app/forms/concerns/decidim/decidim_awesome/system/organization_form_override.rb
166
167
  - app/forms/decidim/decidim_awesome/admin/config_form.rb
167
168
  - app/forms/decidim/decidim_awesome/admin/constraint_form.rb
@@ -177,8 +178,6 @@ files:
177
178
  - app/helpers/decidim/decidim_awesome/map_helper.rb
178
179
  - app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb
179
180
  - app/jobs/decidim/decidim_awesome/export_admin_actions_job.rb
180
- - app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb
181
- - app/middleware/decidim/decidim_awesome/current_config.rb
182
181
  - app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb
183
182
  - app/models/concerns/decidim/decidim_awesome/has_vote_weight.rb
184
183
  - app/models/concerns/decidim/decidim_awesome/user_override.rb
@@ -208,6 +207,7 @@ files:
208
207
  - app/packs/entrypoints/decidim_admin_decidim_awesome.scss
209
208
  - app/packs/entrypoints/decidim_admin_decidim_awesome_global.js
210
209
  - app/packs/entrypoints/decidim_admin_decidim_awesome_global.scss
210
+ - app/packs/entrypoints/decidim_admin_decidim_awesome_search_form.scss
211
211
  - app/packs/entrypoints/decidim_decidim_awesome.js
212
212
  - app/packs/entrypoints/decidim_decidim_awesome.scss
213
213
  - app/packs/entrypoints/decidim_decidim_awesome_custom_fields.js
@@ -251,6 +251,7 @@ files:
251
251
  - app/packs/src/decidim/decidim_awesome/proposals/images.js
252
252
  - app/packs/src/decidim/decidim_awesome/voting/voting_cards.js
253
253
  - app/packs/src/vendor/jquery.truncate.js
254
+ - app/packs/stylesheets/decidim/decidim_awesome/admin/admin_accountability.scss
254
255
  - app/packs/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss
255
256
  - app/packs/stylesheets/decidim/decidim_awesome/admin/check_redirections.scss
256
257
  - app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss
@@ -290,7 +291,6 @@ files:
290
291
  - app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb
291
292
  - app/types/concerns/decidim/decidim_awesome/add_proposal_type_custom_fields.rb
292
293
  - app/types/concerns/decidim/decidim_awesome/add_proposal_type_vote_weights.rb
293
- - app/uploaders/decidim/cw/decidim_awesome/image_uploader.rb
294
294
  - app/uploaders/decidim/decidim_awesome/image_uploader.rb
295
295
  - app/validators/concerns/decidim/decidim_awesome/etiquette_validator_override.rb
296
296
  - app/views/decidim/decidim_awesome/account/_timezone_select.html.erb
@@ -397,7 +397,6 @@ files:
397
397
  - lib/decidim/decidim_awesome/awesome_helpers.rb
398
398
  - lib/decidim/decidim_awesome/checksums.yml
399
399
  - lib/decidim/decidim_awesome/config.rb
400
- - lib/decidim/decidim_awesome/content_parsers/editor_images_parser.rb
401
400
  - lib/decidim/decidim_awesome/context_analyzers.rb
402
401
  - lib/decidim/decidim_awesome/context_analyzers/component_analyzer.rb
403
402
  - lib/decidim/decidim_awesome/context_analyzers/participatory_space_analyzer.rb
@@ -413,6 +412,7 @@ files:
413
412
  - lib/decidim/decidim_awesome/map_component/engine.rb
414
413
  - lib/decidim/decidim_awesome/menu.rb
415
414
  - lib/decidim/decidim_awesome/menu_hacker.rb
415
+ - lib/decidim/decidim_awesome/middleware/current_config.rb
416
416
  - lib/decidim/decidim_awesome/request_memoizer.rb
417
417
  - lib/decidim/decidim_awesome/system_checker.rb
418
418
  - lib/decidim/decidim_awesome/test/factories.rb
@@ -433,7 +433,6 @@ files:
433
433
  - lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb
434
434
  - lib/decidim/decidim_awesome/version.rb
435
435
  - lib/decidim/decidim_awesome/voting_manifest.rb
436
- - lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake
437
436
  - lib/tasks/decidim_awesome_upgrade_tasks.rake
438
437
  - lib/tasks/decidim_awesome_webpacker_tasks.rake
439
438
  - package.json
@@ -442,6 +441,7 @@ licenses:
442
441
  - AGPL-3.0
443
442
  metadata:
444
443
  rubygems_mfa_required: 'true'
444
+ post_install_message:
445
445
  rdoc_options: []
446
446
  require_paths:
447
447
  - lib
@@ -449,14 +449,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
449
449
  requirements:
450
450
  - - ">="
451
451
  - !ruby/object:Gem::Version
452
- version: '3.1'
452
+ version: '3.2'
453
453
  required_rubygems_version: !ruby/object:Gem::Requirement
454
454
  requirements:
455
455
  - - ">="
456
456
  - !ruby/object:Gem::Version
457
457
  version: '0'
458
458
  requirements: []
459
- rubygems_version: 3.6.3
459
+ rubygems_version: 3.4.19
460
+ signing_key:
460
461
  specification_version: 4
461
462
  summary: A decidim decidim_awesome module
462
463
  test_files: []
@@ -1,107 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module DecidimAwesome
5
- class MigrateLegacyImagesJob < ApplicationJob
6
- queue_as :default
7
-
8
- def perform(organization_id, mappings = [], logger = Rails.logger)
9
- @organization_id = organization_id
10
- @routes_mappings = mappings
11
- @logger = logger
12
-
13
- migrate_all!
14
- transform_images_urls
15
- end
16
-
17
- private
18
-
19
- attr_reader :routes_mappings, :logger
20
-
21
- def migrate_all!
22
- Decidim::CarrierWaveMigratorService.migrate_attachment!(
23
- klass: Decidim::DecidimAwesome::EditorImage,
24
- cw_attribute: "image",
25
- cw_uploader: Decidim::Cw::DecidimAwesome::ImageUploader,
26
- as_attribute: "file",
27
- logger: @logger,
28
- routes_mappings:
29
- )
30
- end
31
-
32
- def transform_images_urls
33
- mappings = routes_mappings.map do |mapping|
34
- klass, id = mapping[:instance].split("#")
35
- next unless klass == "Decidim::DecidimAwesome::EditorImage"
36
-
37
- instance = Decidim::DecidimAwesome::EditorImage.find_by(id:)
38
-
39
- next if instance.blank?
40
-
41
- mapping.merge!(instance:)
42
- end.compact
43
-
44
- editor_images_available_attributes.each do |model, attributes|
45
- model.all.each do |item|
46
- attributes.each do |attribute|
47
- item.update(attribute => rewrite_value(item.send(attribute), mappings))
48
- end
49
- end
50
- @logger.info "Updated model #{model.name} (attributes: #{attributes.join(", ")})"
51
- end
52
- end
53
-
54
- def rewrite_value(value, mappings)
55
- if value.is_a?(Hash)
56
- value.transform_values do |nested_value|
57
- rewrite_value(nested_value, mappings)
58
- end
59
- else
60
- parser = Decidim::DecidimAwesome::ContentParsers::EditorImagesParser.new(value, routes_mappings: mappings)
61
- parser.rewrite
62
- end
63
- end
64
-
65
- def editor_images_available_attributes
66
- {
67
- "Decidim::Accountability::Result" => %w(description),
68
- "Decidim::Proposals::Proposal" => %w(body answer cost_report execution_period),
69
- "Decidim::Votings::Voting" => %w(description),
70
- "Decidim::Elections::Question" => %w(description),
71
- "Decidim::Elections::Answer" => %w(description),
72
- "Decidim::Elections::Election" => %w(description),
73
- "Decidim::Initiative" => %w(description answer),
74
- "Decidim::InitiativesType" => %w(description extra_fields_legal_information),
75
- "Decidim::Assembly" => %w(short_description description purpose_of_action composition internal_organisation announcement closing_date_reason special_features),
76
- "Decidim::Forms::Questionnaire" => %w(description tos),
77
- "Decidim::Forms::Question" => %w(description),
78
- "Decidim::Organization" => %w(welcome_notification_body admin_terms_of_service_body description highlighted_content_banner_short_description
79
- id_documents_explanation_text),
80
- "Decidim::StaticPage" => %w(content),
81
- "Decidim::ContextualHelpSection" => %w(content),
82
- "Decidim::Category" => %w(description),
83
- "Decidim::Blogs::Post" => %w(body),
84
- "Decidim::Pages::Page" => %w(body),
85
- "Decidim::Sortitions::Sortition" => %w(additional_info witnesses cancel_reason),
86
- "Decidim::Consultations::Question" => %w(title question_context what_is_decided instructions),
87
- "Decidim::Consultation" => %w(description),
88
- "Decidim::Debates::Debate" => %w(description instructions information_updates conclusions),
89
- "Decidim::Budgets::Budget" => %w(description),
90
- "Decidim::Budgets::Project" => %w(description),
91
- "Decidim::ConferenceSpeaker" => %w(short_bio),
92
- "Decidim::Conferences::RegistrationType" => %w(description),
93
- "Decidim::Conference" => %w(short_description description objectives registration_terms),
94
- "Decidim::ParticipatoryProcessGroup" => %w(description),
95
- "Decidim::ParticipatoryProcess" => %w(short_description description announcement),
96
- "Decidim::ParticipatoryProcessStep" => %w(description),
97
- "Decidim::Meetings::AgendaItem" => %w(description),
98
- "Decidim::Meetings::Meeting" => %w(registration_terms description registration_email_custom_content closing_report)
99
- }.each_with_object({}) do |(main_model, attributes), hash|
100
- hash[main_model.constantize] = attributes
101
- rescue NameError
102
- hash
103
- end
104
- end
105
- end
106
- end
107
- end
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim::Cw
4
- module DecidimAwesome
5
- # Transitional class to allow carrierwave to active storage migrations
6
- class ImageUploader < Decidim::Cw::ImageUploader
7
- process :validate_size, :validate_dimensions
8
-
9
- version :thumbnail do
10
- process resize_to_fit: [nil, 237]
11
- end
12
-
13
- def extension_whitelist
14
- %w(jpg jpeg png)
15
- end
16
-
17
- def content_type_whitelist
18
- %w(image/jpeg image/png)
19
- end
20
-
21
- def max_image_height_or_width
22
- 8000
23
- end
24
- end
25
- end
26
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module DecidimAwesome
5
- module ContentParsers
6
- # A parser that searches for editor images from CarrierWave in html
7
- # contents and replaces them with migrated images to ActiveStorage
8
- #
9
- # @see BaseParser Examples of how to use a content parser
10
- class EditorImagesParser < Decidim::ContentParsers::BaseParser
11
- # @return [String] the content with the CarrierWave images replaced.
12
- def rewrite
13
- return content if editor_images.blank?
14
-
15
- replace_editor_images
16
- parsed_content.to_html
17
- end
18
-
19
- def editor_images
20
- @editor_images ||= parsed_content.search(:img).index_with do |image|
21
- context[:routes_mappings].find { |mapping| image.attr(:src).end_with?(mapping[:origin_path]) }
22
- end.compact
23
- end
24
-
25
- private
26
-
27
- def parsed_content
28
- @parsed_content ||= Nokogiri::HTML(content)
29
- end
30
-
31
- def replace_editor_images
32
- editor_images.each do |image, mapping|
33
- image.set_attribute(:src, mapping[:instance].attached_uploader(:file).path)
34
- end
35
- end
36
- end
37
- end
38
- end
39
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- namespace :decidim_awesome do
4
- namespace :active_storage_migrations do
5
- desc "Migrates editor images from Carrierwave to ActiveStorage"
6
- task migrate_from_carrierwave: :environment do
7
- stdout = Logger.new($stdout)
8
- stdout.level = Logger::INFO
9
- Rails.logger.extend(ActiveSupport::Logger.broadcast(stdout))
10
- Decidim::Organization.find_each do |organization|
11
- puts "Migrating Organization #{organization.id} (#{organization.host})..."
12
- routes_mappings = []
13
- Decidim::DecidimAwesome::MigrateLegacyImagesJob.perform_now(organization.id, routes_mappings)
14
-
15
- path = Rails.root.join("tmp/decidim_awesome_editor_images_mappings.csv")
16
- dirname = File.dirname(path)
17
- FileUtils.mkdir_p(dirname) unless File.directory?(dirname)
18
- File.binwrite(path, Decidim::Exporters::CSV.new(routes_mappings).export.read)
19
- end
20
- end
21
-
22
- desc "Checks editor images migrated from Carrierwave to ActiveStorage"
23
- task check_migration_from_carrierwave: :environment do
24
- logger = ActiveSupport::TaggedLogging.new(Logger.new($stdout))
25
-
26
- Decidim::CarrierWaveMigratorService.check_migration(
27
- klass: Decidim::DecidimAwesome::EditorImage,
28
- cw_attribute: "image",
29
- cw_uploader: Decidim::Cw::DecidimAwesome::ImageUploader,
30
- as_attribute: "file",
31
- logger:
32
- )
33
- end
34
- end
35
- end