decidim 0.24.0 → 0.25.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Rakefile +1 -6
- data/babel.config.json +30 -0
- data/decidim-core/lib/decidim/webpacker/configuration.rb +89 -0
- data/decidim-core/lib/decidim/webpacker/postcss.config.js +16 -0
- data/decidim-core/lib/decidim/webpacker/runner.rb +24 -0
- data/decidim-core/lib/decidim/webpacker/webpack/base.js +6 -0
- data/decidim-core/lib/decidim/webpacker/webpack/custom.js +97 -0
- data/decidim-core/lib/decidim/webpacker/webpack/development.js +7 -0
- data/decidim-core/lib/decidim/webpacker/webpack/production.js +7 -0
- data/decidim-core/lib/decidim/webpacker/webpack/test.js +7 -0
- data/decidim-core/lib/decidim/webpacker/webpacker.yml +68 -0
- data/docs/README.adoc +1 -1
- data/docs/modules/configure/pages/initializer.adoc +31 -0
- data/docs/modules/customize/assets/images/modified_user_menu.png +0 -0
- data/docs/modules/customize/assets/images/original_user_menu.png +0 -0
- data/docs/modules/customize/pages/code.adoc +4 -1
- data/docs/modules/customize/pages/images.adoc +2 -2
- data/docs/modules/customize/pages/javascript.adoc +8 -3
- data/docs/modules/customize/pages/menu.adoc +56 -0
- data/docs/modules/customize/pages/styles.adoc +6 -3
- data/docs/modules/develop/pages/components.adoc +30 -0
- data/docs/modules/develop/pages/guide_migrate_webpacker_app.adoc +175 -0
- data/docs/modules/develop/pages/guide_migrate_webpacker_module.adoc +121 -0
- data/docs/modules/develop/pages/maps.adoc +2 -2
- data/docs/modules/develop/pages/newsletter_templates.adoc +1 -1
- data/docs/modules/develop/pages/releases.adoc +3 -1
- data/docs/modules/develop/pages/testing.adoc +11 -0
- data/docs/modules/develop/pages/view_models_aka_cells.adoc +1 -12
- data/docs/modules/install/pages/manual.adoc +46 -43
- data/docs/modules/install/pages/update.adoc +1 -1
- data/docs/modules/services/pages/elections_bulletin_board.adoc +19 -16
- data/docs/modules/services/pages/social_providers.adoc +1 -1
- data/lib/decidim.rb +0 -4
- data/lib/decidim/version.rb +1 -1
- data/lib/tasks/decidim_tasks.rake +92 -0
- data/package-lock.json +38919 -0
- data/package.json +67 -0
- data/packages/all/package.json +22 -0
- data/packages/browserslist-config/index.js +7 -0
- data/packages/browserslist-config/package.json +17 -0
- data/packages/core/package.json +53 -0
- data/packages/dev/package.json +21 -0
- data/packages/elections/package.json +21 -0
- data/packages/eslint-config/index.js +278 -0
- data/packages/eslint-config/package.json +28 -0
- data/packages/stylelint-config/index.js +160 -0
- data/packages/stylelint-config/package.json +20 -0
- data/packages/webpacker/index.js +6 -0
- data/packages/webpacker/package.json +55 -0
- data/packages/webpacker/src/override-config.js +50 -0
- metadata +83 -47
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f0872745142de196217d5e776c6e730a5959c1595dadf21f64a98e9e594341b
|
4
|
+
data.tar.gz: b5c07a3463d76611a9935723b3285861328a184b7f83e9898ae5e19815d7ff2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec01ba4ce4f74ccf4238cdc74b02a5c718911c427dcdd9a9c74991933c7fdc4b173ca58ae7015343f938f2334f46b71a827604086c1c7da4dfab8cddf0834a44
|
7
|
+
data.tar.gz: 90dbbc1250e18400ee0d5dbdf62193960aaef4dad895b5a3cfa6c6ff7bdef36bc4c00e20d88934e361ec295ef84021c7d836023fa365c0e8cb3ab80a6615e07b
|
data/Rakefile
CHANGED
@@ -57,7 +57,7 @@ task :uninstall_all do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
desc "Pushes a new build for each gem."
|
60
|
-
task release_all: [:update_versions, :check_locale_completeness
|
60
|
+
task release_all: [:update_versions, :check_locale_completeness] do
|
61
61
|
Decidim::GemManager.run_all("rake release")
|
62
62
|
end
|
63
63
|
|
@@ -74,11 +74,6 @@ task test_app: "decidim:generate_external_test_app"
|
|
74
74
|
desc "Generates a development app."
|
75
75
|
task development_app: "decidim:generate_external_development_app"
|
76
76
|
|
77
|
-
desc "Build webpack bundle files"
|
78
|
-
task :webpack do
|
79
|
-
sh "npm install && npm run build:prod"
|
80
|
-
end
|
81
|
-
|
82
77
|
desc "Bundle all Gemfiles"
|
83
78
|
task :bundle do
|
84
79
|
[".", "decidim-generators", "decidim_app-design"].each do |dir|
|
data/babel.config.json
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
{
|
2
|
+
"presets": [
|
3
|
+
[
|
4
|
+
"@babel/preset-env", {
|
5
|
+
"forceAllTransforms": true,
|
6
|
+
"useBuiltIns": "entry",
|
7
|
+
"corejs": 3,
|
8
|
+
"modules": false
|
9
|
+
}
|
10
|
+
],
|
11
|
+
["@babel/preset-react"]
|
12
|
+
],
|
13
|
+
"plugins": [
|
14
|
+
"@babel/plugin-transform-classes",
|
15
|
+
[
|
16
|
+
"@babel/plugin-transform-runtime",
|
17
|
+
{
|
18
|
+
"helpers": false,
|
19
|
+
"regenerator": true,
|
20
|
+
"corejs": false
|
21
|
+
}
|
22
|
+
],
|
23
|
+
[
|
24
|
+
"@babel/plugin-transform-regenerator",
|
25
|
+
{
|
26
|
+
"async": false
|
27
|
+
}
|
28
|
+
]
|
29
|
+
]
|
30
|
+
}
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Webpacker
|
5
|
+
class Configuration
|
6
|
+
attr_reader :additional_paths, :entrypoints, :stylesheet_imports
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
@additional_paths = []
|
10
|
+
@entrypoints = {}
|
11
|
+
@stylesheet_imports = {}
|
12
|
+
end
|
13
|
+
|
14
|
+
def configuration_file
|
15
|
+
# Before webpacker is installed, the original configuration file may not
|
16
|
+
# be available yet.
|
17
|
+
return unless File.exist?(original_configuration_file_path)
|
18
|
+
return configuration_file_path if configurations_loaded?
|
19
|
+
|
20
|
+
load_asset_configurations
|
21
|
+
|
22
|
+
# Read the original configuration and append the paths
|
23
|
+
config = YAML.load_file(original_configuration_file_path)
|
24
|
+
default = config["default"] || {}
|
25
|
+
all_additional_paths = default["additional_paths"] || []
|
26
|
+
all_additional_paths += additional_paths
|
27
|
+
all_stylesheet_imports = default["stylesheet_imports"] || {}
|
28
|
+
all_stylesheet_imports.merge!(stylesheet_imports)
|
29
|
+
all_entrypoints = default["entrypoints"] || {}
|
30
|
+
all_entrypoints.merge!(entrypoints)
|
31
|
+
config.each do |environment, env_config|
|
32
|
+
config[environment] = env_config.merge(
|
33
|
+
"additional_paths" => all_additional_paths,
|
34
|
+
"entrypoints" => all_entrypoints,
|
35
|
+
"stylesheet_imports" => all_stylesheet_imports
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Write the runtime configuration and override the configuration
|
40
|
+
File.write(configuration_file_path, config.to_yaml)
|
41
|
+
|
42
|
+
self.configurations_loaded = true
|
43
|
+
|
44
|
+
configuration_file_path
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
attr_writer :configurations_loaded
|
50
|
+
|
51
|
+
def configurations_loaded?
|
52
|
+
@configurations_loaded == true
|
53
|
+
end
|
54
|
+
|
55
|
+
def app_path
|
56
|
+
@app_path ||=
|
57
|
+
if defined?(Rails)
|
58
|
+
Rails.application.root
|
59
|
+
else
|
60
|
+
# This is used when Rails is not available from the webpacker binstubs
|
61
|
+
File.expand_path(".", Dir.pwd)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def configuration_file_path
|
66
|
+
@configuration_file_path ||= File.join(app_path, "tmp/webpacker_runtime.yml")
|
67
|
+
end
|
68
|
+
|
69
|
+
def original_configuration_file_path
|
70
|
+
@original_configuration_file_path = File.join(app_path, "config/webpacker.yml")
|
71
|
+
end
|
72
|
+
|
73
|
+
def load_asset_configurations
|
74
|
+
# Decidim gem assets
|
75
|
+
decidim_gems = Bundler.load.specs.select { |spec| spec.name =~ /^decidim-/ }
|
76
|
+
decidim_gems.each do |gem|
|
77
|
+
asset_config_path = File.join(gem.full_gem_path, "config/assets.rb")
|
78
|
+
next unless File.exist?(asset_config_path)
|
79
|
+
|
80
|
+
load asset_config_path
|
81
|
+
end
|
82
|
+
|
83
|
+
# Application assets
|
84
|
+
asset_config_path = File.join(app_path, "config/assets.rb")
|
85
|
+
load asset_config_path if File.exist?(asset_config_path)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
|
3
|
+
module.exports = {
|
4
|
+
syntax: 'postcss-scss',
|
5
|
+
plugins: [
|
6
|
+
require('autoprefixer'),
|
7
|
+
require('postcss-import'),
|
8
|
+
require('postcss-flexbugs-fixes'),
|
9
|
+
require('postcss-preset-env')({
|
10
|
+
autoprefixer: {
|
11
|
+
flexbox: 'no-2009'
|
12
|
+
},
|
13
|
+
stage: 3
|
14
|
+
})
|
15
|
+
]
|
16
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Webpacker
|
5
|
+
module Runner
|
6
|
+
def self.included(base)
|
7
|
+
base.alias_method :original_initialize, :initialize
|
8
|
+
base.send :private, :original_initialize
|
9
|
+
|
10
|
+
base.define_method :initialize do |argv|
|
11
|
+
original_initialize(argv)
|
12
|
+
decidim_initialize(argv)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def decidim_initialize(_argv)
|
19
|
+
# Write the runtime configuration and override the configuration
|
20
|
+
@webpacker_config = Decidim::Webpacker.configuration.configuration_file
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,97 @@
|
|
1
|
+
/* eslint-disable */
|
2
|
+
|
3
|
+
const path = require("path");
|
4
|
+
const { config } = require("@rails/webpacker");
|
5
|
+
|
6
|
+
module.exports = {
|
7
|
+
module: {
|
8
|
+
rules: [
|
9
|
+
{
|
10
|
+
test: require.resolve("quill"),
|
11
|
+
loader: "expose-loader",
|
12
|
+
options: {
|
13
|
+
exposes: ["Quill"]
|
14
|
+
}
|
15
|
+
},
|
16
|
+
{
|
17
|
+
test: require.resolve("jquery"),
|
18
|
+
loader: "expose-loader",
|
19
|
+
options: {
|
20
|
+
exposes: ["$", "jQuery"]
|
21
|
+
}
|
22
|
+
},
|
23
|
+
{
|
24
|
+
test: /\.(js|jsx)$/,
|
25
|
+
exclude: /node_modules\/(?!tributejs)/,
|
26
|
+
loader: "babel-loader"
|
27
|
+
},
|
28
|
+
{
|
29
|
+
test: /\.(graphql|gql)$/,
|
30
|
+
loader: "graphql-tag/loader"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
test: require.resolve("react"),
|
34
|
+
loader: "expose-loader",
|
35
|
+
options: {
|
36
|
+
exposes: ["React"]
|
37
|
+
}
|
38
|
+
},
|
39
|
+
{
|
40
|
+
test: require.resolve("@rails/ujs"),
|
41
|
+
loader: "expose-loader",
|
42
|
+
options: {
|
43
|
+
exposes: ["Rails"]
|
44
|
+
}
|
45
|
+
},
|
46
|
+
{
|
47
|
+
test: [
|
48
|
+
/\.md$/,
|
49
|
+
/\.odt$/,
|
50
|
+
],
|
51
|
+
exclude: [/\.(js|mjs|jsx|ts|tsx)$/],
|
52
|
+
type: 'asset/resource',
|
53
|
+
generator: {
|
54
|
+
filename: 'media/documents/[hash][ext][query]'
|
55
|
+
}
|
56
|
+
},
|
57
|
+
// Overwrite webpacker files rule to amend the filename output
|
58
|
+
// and include the name of the file, otherwise some SVGs
|
59
|
+
// are not generated because the hash is the same between them
|
60
|
+
{
|
61
|
+
test: [
|
62
|
+
/\.bmp$/,
|
63
|
+
/\.gif$/,
|
64
|
+
/\.jpe?g$/,
|
65
|
+
/\.png$/,
|
66
|
+
/\.tiff$/,
|
67
|
+
/\.ico$/,
|
68
|
+
/\.avif$/,
|
69
|
+
/\.webp$/,
|
70
|
+
/\.eot$/,
|
71
|
+
/\.otf$/,
|
72
|
+
/\.ttf$/,
|
73
|
+
/\.woff$/,
|
74
|
+
/\.woff2$/,
|
75
|
+
/\.svg$/
|
76
|
+
],
|
77
|
+
exclude: [/\.(js|mjs|jsx|ts|tsx)$/],
|
78
|
+
type: 'asset/resource',
|
79
|
+
generator: {
|
80
|
+
filename: 'media/images/[name]-[hash][ext][query]'
|
81
|
+
}
|
82
|
+
}
|
83
|
+
]
|
84
|
+
},
|
85
|
+
resolve: {
|
86
|
+
extensions: [".js", ".jsx", ".gql", ".graphql"],
|
87
|
+
fallback: {
|
88
|
+
crypto: false
|
89
|
+
}
|
90
|
+
},
|
91
|
+
// https://github.com/rails/webpacker/issues/2932
|
92
|
+
// As Decidim uses multiple packs, we need to enforce a single runtime, to prevent duplication
|
93
|
+
optimization: {
|
94
|
+
runtimeChunk: false
|
95
|
+
},
|
96
|
+
entry: config.entrypoints
|
97
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# File written by Decidim generator
|
2
|
+
# Note: You must restart bin/webpack-dev-server for changes to take effect
|
3
|
+
|
4
|
+
default: &default
|
5
|
+
source_path: app/packs
|
6
|
+
source_entry_path: entrypoints
|
7
|
+
public_output_path: decidim-packs
|
8
|
+
public_root_path: public
|
9
|
+
webpack_compile_output: true
|
10
|
+
cache_path: tmp/webpacker-cache
|
11
|
+
extract_css: true
|
12
|
+
|
13
|
+
additional_paths:
|
14
|
+
- node_modules
|
15
|
+
- app/packs
|
16
|
+
|
17
|
+
# Reload manifest.json on all requests so we reload latest compiled packs
|
18
|
+
cache_manifest: false
|
19
|
+
|
20
|
+
development:
|
21
|
+
<<: *default
|
22
|
+
compile: true
|
23
|
+
# Compile test packs to decidim decidim-packs folder
|
24
|
+
|
25
|
+
# Reference: https://webpack.js.org/configuration/dev-server/
|
26
|
+
dev_server:
|
27
|
+
https: false
|
28
|
+
host: localhost
|
29
|
+
# Notice that we use a different port (to prevent blocking the default one) as
|
30
|
+
# there will be at least two webpack servers running
|
31
|
+
port: 3035
|
32
|
+
public: localhost:3035
|
33
|
+
# Inject browserside javascript that required by both HMR and Live(full) reload
|
34
|
+
inject_client: true
|
35
|
+
# Hot Module Replacement updates modules while the application is running without a full reload
|
36
|
+
hmr: false
|
37
|
+
# Inline should be set to true if using HMR; it inserts a script to take care of live reloading
|
38
|
+
inline: true
|
39
|
+
# Should we show a full-screen overlay in the browser when there are compiler errors or warnings?
|
40
|
+
overlay: true
|
41
|
+
# Should we use gzip compression?
|
42
|
+
compress: true
|
43
|
+
# Note that apps that do not check the host are vulnerable to DNS rebinding attacks
|
44
|
+
disable_host_check: true
|
45
|
+
# This option lets the browser open with your local IP
|
46
|
+
use_local_ip: false
|
47
|
+
# When enabled, nothing except the initial startup information will be written to the console.
|
48
|
+
# This also means that errors or warnings from webpack are not visible.
|
49
|
+
quiet: false
|
50
|
+
pretty: false
|
51
|
+
headers:
|
52
|
+
'Access-Control-Allow-Origin': '*'
|
53
|
+
watch_options:
|
54
|
+
ignored: '**/node_modules/**'
|
55
|
+
|
56
|
+
test:
|
57
|
+
<<: *default
|
58
|
+
compile: true
|
59
|
+
public_output_path: packs-test
|
60
|
+
|
61
|
+
production:
|
62
|
+
<<: *default
|
63
|
+
|
64
|
+
# Production depends on precompilation of packs prior to booting for performance.
|
65
|
+
compile: false
|
66
|
+
|
67
|
+
# Cache manifest.json for performance
|
68
|
+
cache_manifest: true
|
data/docs/README.adoc
CHANGED
@@ -43,7 +43,7 @@ In detail each one of these steps are:
|
|
43
43
|
# 1. Clone the repository
|
44
44
|
git clone https://github.com/decidim/documentation
|
45
45
|
# 2. Install dependencies
|
46
|
-
npm
|
46
|
+
npm
|
47
47
|
# 3. Change the antora-playbook.yml url key in source
|
48
48
|
# 4. Build the antora playbook
|
49
49
|
npm run build
|
@@ -79,6 +79,22 @@ Whether SSL should be enabled or not. Recommended for extra security.
|
|
79
79
|
config.force_ssl = true
|
80
80
|
....
|
81
81
|
|
82
|
+
== CORS enabled
|
83
|
+
|
84
|
+
The SVG do not support CORS. When using custom asset host different than root url, set this value to `true`, in order to activate the available workaround.
|
85
|
+
|
86
|
+
Please refer to:
|
87
|
+
|
88
|
+
- https://github.com/w3c/svgwg/issues/707
|
89
|
+
- https://stackoverflow.com/questions/65811142/how-to-allow-external-images-referenced-within-embedded-svg
|
90
|
+
- https://groups.google.com/a/chromium.org/g/blink-dev/c/qemQwRpe2so/m/THi81oodSDgJ.
|
91
|
+
- https://www.w3.org/Graphics/SVG/WG/track/actions/3781
|
92
|
+
|
93
|
+
[source,ruby]
|
94
|
+
....
|
95
|
+
config.cors_enabled = true
|
96
|
+
....
|
97
|
+
|
82
98
|
== Geocoder configuration
|
83
99
|
|
84
100
|
Allows to make geographical mapping in some components, like Proposals or Meetings. It must be configured against a OpenStreetMap provider. See xref:services:geocoder.adoc[Geocoder service documentation].
|
@@ -374,3 +390,18 @@ step setting :amendments_visibility.
|
|
374
390
|
....
|
375
391
|
config.amendments_visibility_options = %w(all participants)
|
376
392
|
....
|
393
|
+
|
394
|
+
== Export fields
|
395
|
+
|
396
|
+
To customize export fields, you can subscribe to any serialize event. Every serializer event has unique event name in format: decidim.serialize.module_here.class_here
|
397
|
+
|
398
|
+
[source,ruby]
|
399
|
+
....
|
400
|
+
initializer "decidim_budgets.serializer_listener" do
|
401
|
+
ActiveSupport::Notifications.subscribe("decidim.serialize.budgets.project_serializer") do |_event_name, data|
|
402
|
+
# Implement your custom code for new or existing fields.
|
403
|
+
data[:serialized_data][:column_title] = "Row data #{data[:resource].class}"
|
404
|
+
end
|
405
|
+
end
|
406
|
+
....
|
407
|
+
|