decidim 0.30.1 → 0.31.0.rc1

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 (86) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +5 -9
  3. data/decidim-core/lib/decidim/{webpacker → shakapacker}/configuration.rb +4 -4
  4. data/decidim-core/lib/decidim/{webpacker → shakapacker}/runner.rb +3 -3
  5. data/decidim-core/lib/decidim/shakapacker/shakapacker.rb +8 -0
  6. data/decidim-core/lib/decidim/{webpacker → shakapacker}/shakapacker.yml +3 -1
  7. data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/custom.js +1 -1
  8. data/decidim.gemspec +1 -1
  9. data/docs/antora.yml +1 -1
  10. data/docs/modules/configure/pages/environment_variables.adoc +184 -35
  11. data/docs/modules/configure/pages/index.adoc +2 -3
  12. data/docs/modules/configure/pages/initializer.adoc +45 -31
  13. data/docs/modules/configure/pages/system.adoc +3 -3
  14. data/docs/modules/customize/assets/images/social-share-modal-default.png +0 -0
  15. data/docs/modules/customize/pages/admin_filters.adoc +2 -2
  16. data/docs/modules/customize/pages/content_security_policy.adoc +1 -1
  17. data/docs/modules/customize/pages/images.adoc +1 -1
  18. data/docs/modules/customize/pages/index.adoc +1 -0
  19. data/docs/modules/customize/pages/javascript.adoc +5 -18
  20. data/docs/modules/customize/pages/localization.adoc +75 -0
  21. data/docs/modules/customize/pages/oauth.adoc +12 -0
  22. data/docs/modules/customize/pages/social_shares.adoc +0 -3
  23. data/docs/modules/customize/pages/styles.adoc +3 -16
  24. data/docs/modules/develop/assets/attachments/grafana/metadecidim-csv.json +1106 -0
  25. data/docs/modules/develop/assets/attachments/grafana/metadecidim-graphql.json +632 -0
  26. data/docs/modules/develop/assets/images/grafana/create_account_confirm.png +0 -0
  27. data/docs/modules/develop/assets/images/grafana/create_account_form.png +0 -0
  28. data/docs/modules/develop/assets/images/grafana/create_account_setup.png +0 -0
  29. data/docs/modules/develop/assets/images/grafana/dashboard_example_csv.png +0 -0
  30. data/docs/modules/develop/assets/images/grafana/dashboard_example_graphql.png +0 -0
  31. data/docs/modules/develop/assets/images/grafana/dashboard_import.png +0 -0
  32. data/docs/modules/develop/assets/images/grafana/dashboard_import_csv.png +0 -0
  33. data/docs/modules/develop/assets/images/grafana/dashboards.png +0 -0
  34. data/docs/modules/develop/assets/images/grafana/homepage.png +0 -0
  35. data/docs/modules/develop/pages/api.adoc +12 -2
  36. data/docs/modules/develop/pages/classes/models.adoc +2 -2
  37. data/docs/modules/develop/pages/commentable.adoc +9 -11
  38. data/docs/modules/develop/pages/components.adoc +10 -10
  39. data/docs/modules/develop/pages/elections.adoc +101 -0
  40. data/docs/modules/develop/pages/fixing_locales.adoc +7 -12
  41. data/docs/modules/develop/pages/grafana.adoc +100 -0
  42. data/docs/modules/develop/pages/likeable.adoc +106 -0
  43. data/docs/modules/develop/pages/machine_translations.adoc +6 -2
  44. data/docs/modules/develop/pages/maintainers/releases.adoc +40 -202
  45. data/docs/modules/develop/pages/maps.adoc +8 -8
  46. data/docs/modules/develop/pages/modules.adoc +1 -1
  47. data/docs/modules/develop/pages/notifications.adoc +27 -56
  48. data/docs/modules/develop/pages/permissions.adoc +19 -19
  49. data/docs/modules/develop/pages/share_tokens.adoc +2 -2
  50. data/docs/modules/develop/pages/taxonomies.adoc +1 -15
  51. data/docs/modules/install/pages/checklist.adoc +2 -1
  52. data/docs/modules/install/pages/index.adoc +7 -12
  53. data/docs/modules/install/pages/manual.adoc +27 -35
  54. data/docs/modules/install/pages/update.adoc +0 -2
  55. data/docs/modules/install/partials/version_matrix.adoc +4 -2
  56. data/docs/modules/services/pages/activestorage.adoc +4 -3
  57. data/docs/modules/services/pages/aitools.adoc +0 -2
  58. data/docs/modules/services/pages/etherpad.adoc +5 -20
  59. data/docs/modules/services/pages/machine_translation.adoc +38 -0
  60. data/docs/modules/services/pages/maps.adoc +8 -66
  61. data/docs/modules/services/pages/pdf.adoc +33 -0
  62. data/docs/modules/services/pages/sms.adoc +6 -7
  63. data/docs/modules/services/pages/social_providers.adoc +1 -1
  64. data/docs/modules/services/pages/timestamp.adoc +47 -0
  65. data/lib/decidim/version.rb +1 -1
  66. data/package-lock.json +2413 -2624
  67. data/package.json +3 -2
  68. data/packages/browserslist-config/package.json +1 -1
  69. data/packages/core/package.json +2 -3
  70. data/packages/dev/package.json +2 -2
  71. data/packages/eslint-config/package.json +1 -1
  72. data/packages/prettier-config/package.json +1 -1
  73. data/packages/stylelint-config/package.json +1 -1
  74. data/packages/webpacker/package.json +3 -2
  75. data/packages/webpacker/src/loaders/decidim-sass-loader.js +18 -11
  76. metadata +68 -54
  77. data/docs/modules/develop/pages/endorsable.adoc +0 -110
  78. data/docs/modules/develop/pages/guide_migrate_webpacker_app.adoc +0 -257
  79. data/docs/modules/develop/pages/guide_migrate_webpacker_module.adoc +0 -132
  80. data/docs/modules/develop/pages/metrics.adoc +0 -123
  81. data/docs/modules/develop/pages/troubleshooting_metrics.adoc +0 -255
  82. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/esbuild.config.js +0 -0
  83. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/postcss.config.js +0 -0
  84. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/tsconfig.json +0 -0
  85. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/.modernizrrc +0 -0
  86. /data/decidim-core/lib/decidim/{webpacker → shakapacker}/webpack/webpack.config.js +0 -0
@@ -28,18 +28,13 @@ gem install decidim
28
28
  decidim decidim_application
29
29
  ----
30
30
 
31
- You can see the xref:install:manual.adoc[official manual installation tutorial], and also you have https://platoniq.github.io/decidim-install/[another manual installation tutorial] made by the nice people of http://www.platoniq.net/[Platoniq].
31
+ You can see the xref:install:manual.adoc[official manual installation tutorial] for all the instructions on how to install Decidim.
32
32
 
33
- === B. Installation script [experimental]
33
+ === B. Docker / docker-compose
34
34
 
35
- There is also an installation script made by http://www.platoniq.net/[Platoniq] that allows you to install Decidim automatically. You can even check it on a Vagrant virtual machine if you want to. https://platoniq.github.io/decidim-install/script/[More information].
35
+ If you are proficient with Docker you can use the docker-compose.yml file that we provide as an example. The main limitation that you will have is that you cannot use modules with this image, only the official ones. It can be a good starting point if you want to check out Decidim locally quickly and before going to the manual installation approach.
36
36
 
37
- [source,console]
38
- ----
39
- wget -O install-decidim.sh https://raw.githubusercontent.com/Platoniq/decidim-install/master/script/install-decidim.sh
40
- chmod +x install-decidim.sh
41
- ./install-decidim.sh decidim_application
42
- ----
37
+ You can see the docker instructions at the https://github.com/decidim/docker/[Docker repository].
43
38
 
44
39
  == Initializing your application for local development
45
40
 
@@ -107,9 +102,6 @@ For production environments, you can configure these tasks with `crontab -e`. Fo
107
102
  # Remove expired download your data files
108
103
  0 0 * * * cd /home/user/decidim_application && RAILS_ENV=production bundle exec rake decidim:delete_download_your_data_files
109
104
 
110
- # Compute metrics
111
- 1 0 * * * cd /home/user/decidim_application && RAILS_ENV=production bundle exec rake decidim:metrics:all
112
-
113
105
  # Compute open data
114
106
  2 0 * * * cd /home/user/decidim_application && RAILS_ENV=production bundle exec rake decidim:open_data:export
115
107
 
@@ -127,6 +119,9 @@ For production environments, you can configure these tasks with `crontab -e`. Fo
127
119
 
128
120
  # Change active step in participatory processes
129
121
  */15 * * * * cd /home/user/decidim_application && RAILS_ENV=production bundle exec rake decidim_participatory_processes:change_active_step
122
+
123
+ # Delete inactive participants accounts
124
+ 0 0 * * * cd /home/user/decidim_application && RAILS_ENV=production bundle exec rake decidim:participants:delete_inactive_participants
130
125
  ----
131
126
 
132
127
  === Scheduled tasks from modules
@@ -3,22 +3,22 @@
3
3
  In order to develop on decidim, you will need:
4
4
 
5
5
  * *Git* 2.34+
6
- * *PostgreSQL* 14.5+
7
- * *Ruby* 3.1.1
8
- * *NodeJS* 18.17.x
9
- * *Npm* 9.6.x
6
+ * *PostgreSQL* 17.4+
7
+ * *Ruby* 3.3.0
8
+ * *NodeJS* 22.14.x
9
+ * *Npm* 10.9.x
10
10
  * *ImageMagick*
11
- * *Chrome* browser and https://sites.google.com/a/chromium.org/chromedriver/[chromedriver].
11
+ * *Chrome* browser and https://sites.google.com/a/chromium.org/chromedriver/[chromedriver] (if you need to run specs/tests)
12
12
 
13
13
  The compatibility between the different versions of the components is the following:
14
14
 
15
15
  include::install:partial$version_matrix.adoc[]
16
16
 
17
- We are starting with an Ubuntu 22.04.3 LTS. This is an opinionated guide, so you are free to use the technology that you are most comfortable. If you have any doubts and you are blocked you can go and ask on https://matrix.to/#/#decidimdevs:matrix.org[our Matrix.org chat room for developers].
17
+ We are starting with an Ubuntu 24.04.3 LTS. This is an opinionated guide, so you are free to use the technology that you are most comfortable. If you have any doubts and you are blocked you can go and ask on https://matrix.to/#/#decidimdevs:matrix.org[our Matrix.org chat room for developers].
18
18
 
19
19
  We recommend to have at least some basic proficiency in GNU/Linux (i.e. how to use the command-line, packages, etc), networking knowledge, server administration, development in general, and some basic knowledge about software package managers. It would be great to have Ruby on Rails development basics (a good starting point is http://guides.rubyonrails.org/getting_started.html[Getting Started with Ruby on Rails]) and have some knowledge on how package libraries are working (we use `bundler` for handling ruby packages, and `npm`/`yarn` for handling javascript).
20
20
 
21
- In this guide, we will see how to install rbenv, PostgreSQL, Node.js and, Decidim, and how to configure everything together for a development environment. Mind that if you want to make a production deployment with real users this guide is not enough, you should configure a web server (like nginx), backups, monitoring, etc. This is out of the scope of this guide, but you can follow the https://platoniq.github.io/decidim-install/[Platoniq guide].
21
+ In this guide, we will see how to install rbenv, PostgreSQL, Node.js and, Decidim, and how to configure everything together for a development environment. Mind that if you want to make a production deployment with real users this guide is not enough, you should configure a web server (like nginx), backups, monitoring, etc. This is out of the scope of this guide, but you can follow any Ruby on Rails guide on how to configure it for production or use a service like Render, Fly.io, Heroku, etc.
22
22
 
23
23
  == 1. Installing rbenv
24
24
 
@@ -27,14 +27,14 @@ First, we are going to install https://github.com/rbenv/rbenv[rbenv], for managi
27
27
  [source,bash]
28
28
  ----
29
29
  sudo apt update
30
- sudo apt install -y build-essential curl git libssl-dev zlib1g-dev
30
+ sudo apt install -y build-essential curl git libssl-dev zlib1g-dev libffi-dev libyaml-dev
31
31
  git clone https://github.com/rbenv/rbenv.git ~/.rbenv
32
32
  echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
33
33
  echo 'eval "$(rbenv init -)"' >> ~/.bashrc
34
34
  source ~/.bashrc
35
35
  git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
36
- rbenv install 3.1.1
37
- rbenv global 3.1.1
36
+ rbenv install 3.3.0
37
+ rbenv global 3.3.0
38
38
  ----
39
39
 
40
40
  == 2. Installing PostgreSQL
@@ -55,13 +55,10 @@ An important component for Decidim is Node.js and Yarn. With this commands you w
55
55
 
56
56
  [source,bash]
57
57
  ----
58
- sudo mkdir -p /etc/apt/keyrings
59
- curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
60
- echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
61
- sudo apt-get update && sudo apt-get install -y nodejs
62
- curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/yarnkey.gpg >/dev/null
63
- echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
64
- sudo apt-get update && sudo apt-get install -y yarn
58
+ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
59
+ source "$HOME/.nvm/nvm.sh"
60
+ nvm install 24
61
+ npm install -g yarn
65
62
  ----
66
63
 
67
64
  == 4. Installing Decidim
@@ -79,25 +76,18 @@ Then we can create an application with the `decidim` executable, where `decidim_
79
76
  [source,bash]
80
77
  ----
81
78
  decidim decidim_application
82
- cd decidim_application
83
- ----
84
-
85
- We recommend that you save it all on Git.
86
-
87
- [source,bash]
88
- ----
89
- git add .
90
- git commit -m "Initial commit. Generated with Decidim https://decidim.org"
91
79
  ----
92
80
 
93
81
  == 5. Configure the database
94
82
 
95
- Modify your secrets (see `config/database.yml`). For this you can use https://github.com/laserlemon/figaro[figaro], https://github.com/bkeepers/dotenv[dotenv] or https://github.com/rbenv/rbenv-vars[rbenv-vars]. You
96
- should always be careful of not uploading your plain secrets on git or your version control system. You can also upload the encrypted secrets, using the sekrets gem or if you are on Ruby on Rails greater than 5.1 you can do it natively.
83
+ For configuring the database and other parts of Decidim, we use xref:configure:environment_variables.adoc[Environment variables]. We recommend using https://github.com/rbenv/rbenv-vars[rbenv-vars].
97
84
 
98
- For a development environment, and if you are using rbenv, we strongly recommend you to use the https://github.com/rbenv/rbenv-vars[rbenv-vars] to facilitate the edition of ENV vars.
85
+ [NOTE]
86
+ ====
87
+ Be careful with your `.rbenv-vars` file, as if you put it in the same folder of your decidim generated application you could publish it without you noticing and there will be secrets there. We strongly recommend adding it to other directory
88
+ ====
99
89
 
100
- First you will need to install the rbenv-vars plugin:
90
+ For installing `rbenv-vars`:
101
91
 
102
92
  [source,bash]
103
93
  ----
@@ -115,15 +105,17 @@ DATABASE_PASSWORD=thepassword
115
105
  EOF
116
106
  ----
117
107
 
118
- Be careful where you put the `.rbenv-vars` file, as if you put it in the same folder of your decidim generated application, and if you use a version control system (like `git`, which we strongly recommend), then you should ignore this file (ie with the `.gitignore` file).
108
+ == 6. Initializing your app for local development
109
+
110
+ At this point we recommend that you save it all on Git.
119
111
 
120
112
  [source,bash]
121
113
  ----
122
- echo -e "\n\n# Ignore environment variables\n.rbenv-vars" >> .gitignore
114
+ cd decidim_application
115
+ git add .
116
+ git commit -m "Initial commit. Generated with Decidim https://decidim.org"
123
117
  ----
124
118
 
125
- == 6. Initializing your app for local development
126
-
127
119
  [NOTE]
128
120
  ====
129
121
  Please refer to xref:install:empty-database.adoc[Empty database installation] section if you want to setup your instance with an empty database (without any seeds).
@@ -152,7 +144,7 @@ Visit http://localhost:3000 to see your app running. 🎉 🎉
152
144
 
153
145
  [NOTE]
154
146
  ====
155
- With these steps you would only have an initial installation for trying Decidim, but it still needs lots of things to take in account. If you want a working production system then we recommend that you follow the https://platoniq.github.io/decidim-install/[Decidim Install guide by Platoniq].
147
+ With these steps you would only have an initial installation for trying Decidim, but it still needs lots of things to take in account.
156
148
  ====
157
149
 
158
150
  == Extra notes
@@ -1,7 +1,5 @@
1
1
  = Updating Decidim
2
2
 
3
- IMPORTANT: This section was initially copied from https://platoniq.github.io/decidim-install/decidim-update/[Platoniq's Guide]
4
-
5
3
  Because Decidim is a gem in our system, to update it we will have to edit our `Gemfile` and specify the new version number.
6
4
 
7
5
  To keep our system up to date, we can visit the page https://github.com/decidim/decidim/releases[Releases] and compare with our `Gemfile`. See if the lines specifying the gem called "decidim-something" are followed by the number corresponding to the latest release:
@@ -2,11 +2,13 @@
2
2
  |===
3
3
  |Decidim version |Ruby version |Node version | Status
4
4
 
5
- |develop | 3.3.4 | 18.17.x | Unreleased
5
+ |develop | 3.3.4 | 22.14.x | Unreleased
6
+
7
+ |v0.30 | 3.3.4 | 18.17.x | Bug fixes and security updates
6
8
 
7
9
  |v0.29 | 3.2.2 | 18.17.x | Bug fixes and security updates
8
10
 
9
- |v0.28 | 3.1.1 | 18.17.x | Bug fixes and security updates
11
+ |v0.28 | 3.1.1 | 18.17.x | Not maintained
10
12
 
11
13
  |v0.27 | 3.0.2 | 16.18.x | Security updates
12
14
 
@@ -23,6 +23,7 @@ Locate the bucket, go into the "Permissions" tab and find the section titled "CO
23
23
  "*"
24
24
  ],
25
25
  "AllowedMethods": [
26
+ "GET"
26
27
  "PUT"
27
28
  ],
28
29
  "AllowedOrigins": [
@@ -57,7 +58,7 @@ Before running that command you need to have a `cors.json` file in the same dire
57
58
  [
58
59
  {
59
60
  "origin": ["https://www.example.com"],
60
- "method": ["PUT"],
61
+ "method": ["GET", "PUT"],
61
62
  "responseHeader": ["Origin", "Content-Type", "Content-MD5", "Content-Disposition"],
62
63
  "maxAgeSeconds": 3600
63
64
  }
@@ -71,7 +72,7 @@ Read more at https://cloud.google.com/storage/docs/configuring-cors[Google Cloud
71
72
  Locate the storage account from the Azure Portal and go to the "Resource sharing (CORS)" section under "Settings. Fill in the following configuration options in the "Blob service" tab of that section (replace `https://www.example.com` with the actual domain of your service):
72
73
 
73
74
  - **Allowed origins**: https://www.example.com
74
- - **Allowed methods**: PUT
75
+ - **Allowed methods**: GET,PUT
75
76
  - **Allowed headers**: *
76
77
  - **Exposed headers**: Origin, Content-Type, Content-MD5, x-ms-blob-content-disposition, x-ms-blob-type
77
78
  - **Max age**: 3600
@@ -83,7 +84,7 @@ When using the Azure REST API, you can use the `Set Blob Service Properties` ope
83
84
  <Cors>
84
85
  <CorsRule>
85
86
  <AllowedOrigins>https://www.example.com</AllowedOrigins>
86
- <AllowedMethods>PUT</AllowedMethods>
87
+ <AllowedMethods>GET,PUT</AllowedMethods>
87
88
  <AllowedHeaders>*</AllowedHeaders>
88
89
  <ExposedHeaders>Origin, Content-Type, Content-MD5, x-ms-blob-content-disposition, x-ms-blob-type</ExposedHeaders>
89
90
  <MaxAgeInSeconds>3600</MaxAgeInSeconds>
@@ -72,7 +72,6 @@ Decidim::Ai::SpamDetection.resource_models = {
72
72
  "Decidim::Meetings::Meeting" => "Decidim::Ai::SpamDetection::Resource::Meeting",
73
73
  "Decidim::Proposals::Proposal" => "Decidim::Ai::SpamDetection::Resource::Proposal",
74
74
  "Decidim::Proposals::CollaborativeDraft" => "Decidim::Ai::SpamDetection::Resource::CollaborativeDraft",
75
- "Decidim::UserGroup" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity",
76
75
  "Decidim::User" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity"
77
76
  }
78
77
 
@@ -110,7 +109,6 @@ Decidim::Ai::SpamDetection.user_analyzers = [
110
109
  # override what we register by default, or to register your own resources.
111
110
  # Follow the documentation on how to trail more resources
112
111
  Decidim::Ai::SpamDetection.user_models = {
113
- "Decidim::UserGroup" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity",
114
112
  "Decidim::User" => "Decidim::Ai::SpamDetection::Resource::UserBaseEntity"
115
113
  }
116
114
 
@@ -18,28 +18,13 @@ docker swarm init # just one time
18
18
  docker stack deploy --compose-file docker-compose-etherpad.yml decidim-etherpad
19
19
  ----
20
20
 
21
- After deploying Etherpad, you should get back to Decidim's server and set the Etherpad host and API Key at
22
- `config/initializers/decidim.rb` and `config/secrets.yml`
21
+ After deploying Etherpad, you should get back to Decidim's server and set the Etherpad host and API Key using the xref:configure:environment_variables.adoc[environment variables].
23
22
 
24
- An example snippet in `config/initializers/decidim.rb` may be:
25
-
26
- [source,ruby]
27
- ----
28
- config.etherpad = {
29
- server: Rails.application.secrets.etherpad[:server],
30
- api_key: Rails.application.secrets.etherpad[:api_key],
31
- api_version: Rails.application.secrets.etherpad[:api_version]
32
- }
33
- ----
34
-
35
- and then in `config/secrets.yml`:
36
-
37
- [source,yaml]
23
+ [source,console]
38
24
  ----
39
- etherpad:
40
- server: <%= ENV["ETHERPAD_SERVER"] %>
41
- api_key: <%= ENV["ETHERPAD_API_KEY"] %>
42
- api_version: <%= ENV["ETHERPAD_API_VERSION"] %>
25
+ export ETHERPAD_SERVER=...
26
+ export ETHERPAD_API_KEY=....
27
+ export ETHERPAD_API_VERSION=...
43
28
  ----
44
29
 
45
30
  == How is Etherpad Lite integrated in Meetings?
@@ -0,0 +1,38 @@
1
+ = Machine Translations
2
+
3
+ To enable machine translations you need to enable the service and specify the class used for translation (this usually is the one contacting an external API from a 3d party service that actually translates the string).
4
+
5
+ [source,ruby]
6
+ ....
7
+ class MyTranslationService
8
+ attr_reader :text, :source_locale, :target_locale, :resource, :field_name
9
+
10
+ def initialize(resource, field_name, text, target_locale, source_locale)
11
+ @resource = resource
12
+ @field_name = field_name
13
+ @text = text
14
+ @target_locale = target_locale
15
+ @source_locale = source_locale
16
+ end
17
+
18
+ def translate
19
+ # Actual code to translate the text
20
+ end
21
+ end
22
+ ....
23
+
24
+ The arguments provided for the initialize method are:
25
+
26
+ - `resource` - The object of the resource that being translated (ex: a `Decidim::Meetings::Meeting` instance )
27
+ - `field_name` - The name of the field that is being translated (ex: "title")
28
+ - `text` - The text that is going to be translated (ex: "This meeting is great" )
29
+ - `target_locale` - The language in which you want to translate ( ex: "ca" )
30
+ - `source_locale` - The language in which the content has been created (ex: "en")
31
+
32
+ Then you will need to configure it with the help of Environment Variables:
33
+
34
+ [source,bash]
35
+ ....
36
+ export DECIDIM_ENABLE_MACHINE_TRANSLATION="true"
37
+ export DECIDIM_MACHINE_TRANSLATION_SERVICE="MyTranslator"
38
+ ....
@@ -26,56 +26,20 @@ If you want to integrate Decidim to some other map service provider, read how to
26
26
 
27
27
  == Configuring maps and geocoding
28
28
 
29
- After generating your app, you will see that your `config/initializers/decidim.rb` file includes commented code about map services:
29
+ After generating your app, you will need to configure the maps service by setting your environment variables.
30
30
 
31
- [source,ruby]
32
- ----
33
- # Map and Geocoder configuration
34
- # config.maps = {
35
- # ...
36
- # }
37
- ----
38
-
39
- The initializer comments provide examples for the services mentioned in this documentation.
40
31
  Please refer to the section below for the service you have registered for the maps functionality.
41
32
 
42
33
  If you want to enable geocoding in your app:
43
34
 
44
35
  . Select a service provider for the maps functionality and register an account with that provider
45
- . Uncomment or add the code under the selected service provider in your `config/initializers/decidim.rb`.
46
- . Make sure your `config/secrets.yml` file has the needed section (it should be added by the generator automatically).
47
- . Configure the service provider credentials in `config/secrets.yml` and refer to them from your `config/initializers/decidim.rb`.
36
+ . Set the `MAPS_GEOCODING_HOST` environment variable, or, if the setup is more complex, customize using the initializer.
48
37
  . If you had your Rails server running, restart it so the changes apply.
49
38
 
50
39
  === Configuring HERE Maps
51
40
 
52
41
  Use the following configuration for HERE Maps:
53
42
 
54
- `config/initializers/decidim.rb`:
55
-
56
- [source,ruby]
57
- ----
58
- # Map and Geocoder configuration
59
- # == HERE Maps ==
60
- config.maps = {
61
- provider: :here,
62
- api_key: Rails.application.secrets.maps[:api_key],
63
- static: { url: "https://image.maps.hereapi.com/mia/v3/base/mc/overlay" }
64
- }
65
- ----
66
-
67
- `config/secrets.yml`:
68
-
69
- [source,yaml]
70
- ----
71
- default: &default
72
- # ...
73
- maps:
74
- api_key: <%= ENV["MAPS_API_KEY"] %>
75
- ----
76
-
77
- `.env`:
78
-
79
43
  [source,bash]
80
44
  ----
81
45
  MAPS_PROVIDER=here
@@ -84,9 +48,7 @@ MAPS_API_KEY=your_api_key_here
84
48
 
85
49
  === Configuring Open Street Maps based service providers
86
50
 
87
- Use the following configuration for Open Street Maps based service providers:
88
-
89
- `config/initializers/decidim.rb`:
51
+ Use the following configuration for Open Street Maps based service providers, by creating your xref:configure:initializer.adoc[initializer]:
90
52
 
91
53
  [source,ruby]
92
54
  ----
@@ -94,7 +56,7 @@ Use the following configuration for Open Street Maps based service providers:
94
56
  # == OpenStreetMap (OSM) services ==
95
57
  config.maps = {
96
58
  provider: :osm,
97
- api_key: Rails.application.secrets.maps[:api_key],
59
+ api_key: ENV["MAPS_API_KEY"],
98
60
  dynamic: {
99
61
  tile_layer: {
100
62
  url: "https://tiles.example.org/{z}/{x}/{y}.png?key={apiKey}",
@@ -112,16 +74,6 @@ config.maps = {
112
74
  }
113
75
  ----
114
76
 
115
- `config/secrets.yml`:
116
-
117
- [source,yaml]
118
- ----
119
- default: &default
120
- # ...
121
- maps:
122
- api_key: <%= ENV["MAPS_API_KEY"] %>
123
- ----
124
-
125
77
  `.env`:
126
78
 
127
79
  [source,bash]
@@ -134,7 +86,7 @@ For further information, see the service provider's documentation or take a look
134
86
  === Combining multiple service providers
135
87
 
136
88
  It is also possible to combine multiple service providers for the different categories of map services.
137
- For instance, if you want to use HERE Maps for the map tiles but host the other services yourself, use the following configuration:
89
+ For instance, if you want to use HERE Maps for the map tiles but host the other services yourself, use the following configuration, that can be added only in an initializer:
138
90
 
139
91
  [source,ruby]
140
92
  ----
@@ -144,7 +96,7 @@ config.maps = {
144
96
  provider: :osm,
145
97
  dynamic: {
146
98
  provider: :here,
147
- api_key: Rails.application.secrets.maps[:here_api_key]
99
+ api_key: ENV["MAPS_API_KEY"]
148
100
  },
149
101
  static: { url: "https://staticmap.example.org/" },
150
102
  geocoding: { host: "nominatim.example.org", use_https: true },
@@ -152,16 +104,6 @@ config.maps = {
152
104
  }
153
105
  ----
154
106
 
155
- `config/secrets.yml`:
156
-
157
- [source,yaml]
158
- ----
159
- default: &default
160
- # ...
161
- maps:
162
- here_api_key: <%= ENV["MAPS_HERE_API_KEY"] %>
163
- ----
164
-
165
107
  `.env`:
166
108
 
167
109
  [source,bash]
@@ -181,7 +123,7 @@ For example, if you want to use HERE Maps as your default but disable the static
181
123
  ----
182
124
  config.maps = {
183
125
  provider: :here,
184
- api_key: Rails.application.secrets.maps[:api_key],
126
+ api_key: ENV["MAPS_API_KEY"],
185
127
  static: false,
186
128
  autocomplete: false
187
129
  }
@@ -191,7 +133,7 @@ Decidim works fine when some of the services are disabled individually but obvio
191
133
 
192
134
  === Global geocoder configurations
193
135
 
194
- In the Decidim initialiser (`config/initializers/decidim.rb`) you will also see a commented section for the global geocoder configurations commented as follows:
136
+ In order to fully customize the geocoding service, you may need to create the xref:configure:initializer.adoc[initializer] file, and customize your config as follows:
195
137
 
196
138
  [source,ruby]
197
139
  ----
@@ -0,0 +1,33 @@
1
+ = PDF signature service
2
+
3
+ Used by `decidim-initiatives` and `decidim-budgets`.
4
+
5
+ Provide a class to process a pdf and return the document including a digital signature. The instances of this class are initialized with a hash containing the :pdf key with the pdf file content as value. The instances respond to a signed_pdf method containing the pdf with the signature.
6
+
7
+ An example class would be something like:
8
+
9
+ [source,ruby]
10
+ ....
11
+ class MyPDFSignatureService
12
+ attr_accessor :pdf
13
+
14
+ def initialize(args = {})
15
+ @pdf = args.fetch(:pdf)
16
+ end
17
+
18
+ def signed_pdf
19
+ # Code to return the pdf signed
20
+ end
21
+ end
22
+ ....
23
+
24
+ The arguments provided for the initialize method are:
25
+
26
+ - `pdf` - The document that needs to be signed
27
+
28
+ Then you will need to configure it with the help of Environment Variables:
29
+
30
+ [source,bash]
31
+ ....
32
+ export DECIDIM_PDF_SIGNATURE_SERVICE="PdfSignatureExample"
33
+ ....
@@ -1,8 +1,7 @@
1
- = SMS
1
+ = SMS gateway configuration
2
2
 
3
- If you want to verify your users by sending a verification code via SMS you need to provide a SMS gateway service class through the xref:configure:initializer.adoc[initializer].
4
-
5
- This service can also be used by some spaces, and external modules could use it too.
3
+ If you want to verify your users by sending a verification code via
4
+ SMS (mobile/cell phones text messages) you need to provide a SMS gateway service class.
6
5
 
7
6
  An example class would be something like:
8
7
 
@@ -28,11 +27,11 @@ The arguments provided for the initialize method are:
28
27
  - `code` - The code or the message to be sent to the given mobile phone number.
29
28
  - `context` - An extra context attribute which can be used to pass e.g. the correct organization for the gateway to utilize.
30
29
 
31
- Then you will need to configure it in the Decidim initializer:
30
+ Then you will need to configure it with the help of Environment Variables:
32
31
 
33
- [source,ruby]
32
+ [source,bash]
34
33
  ....
35
- config.sms_gateway_service = "MySMSGatewayService"
34
+ export DECIDIM_SMS_GATEWAY_SERVICE="MySMSGatewayService"
36
35
  ....
37
36
 
38
37
  You can find an example on how this is set up at https://github.com/AjuntamentdeBarcelona/decidim-barcelona/blob/672f5a8938d884940899b4304f0a17e25d42d2a0/app/services/sms_gateway.rb[DecidimBarcelona's app/services/sms_gateway.rb]. Your final implementation will depend on how your SMS provider works.
@@ -101,7 +101,7 @@ An example of custom initializer could be written as:
101
101
  [source,ruby]
102
102
  ----
103
103
  #config/initializers/omniauth_myprovider.rb
104
- if Rails.application.secrets.dig(:omniauth, :myprovider).present?
104
+ if Decidim.omniauth_providers[:myprovider]
105
105
  Rails.application.config.middleware.use OmniAuth::Builder do
106
106
  provider(
107
107
  :myprovider,
@@ -0,0 +1,47 @@
1
+ = Timestamp service configuration
2
+
3
+ Used by `decidim-initiatives`.
4
+
5
+ Provide a class to generate a timestamp for a document. The instances of this class are initialized with a hash containing the :document key with the document to be timestamped as value. The instances respond to a timestamp public method with the timestamp.
6
+
7
+ An example class would be something like:
8
+
9
+ [source,ruby]
10
+ ....
11
+ class MyTimestampService
12
+ attr_accessor :document
13
+ def initialize(args = {})
14
+ @document = args.fetch(:document)
15
+ end
16
+ def timestamp
17
+ # Code to generate timestamp
18
+ "My timestamp"
19
+ end
20
+ end
21
+ ....
22
+
23
+ [source,ruby]
24
+ ....
25
+ class MyTimestampService
26
+ attr_accessor :document
27
+
28
+ def initialize(args = {})
29
+ @document = args.fetch(:document)
30
+ end
31
+
32
+ def timestamp
33
+ # Actual code to add the timestamp
34
+ end
35
+ end
36
+ ....
37
+
38
+ The arguments provided for the initialize method are:
39
+
40
+ - `document` - The document that needs to be timestamped
41
+
42
+ Then you will need to configure it with the help of Environment Variables:
43
+
44
+ [source,bash]
45
+ ....
46
+ export DECIDIM_TIMESTAMP_SERVICE="MyTimestampService"
47
+ ....
@@ -3,6 +3,6 @@
3
3
  # This holds the decidim version and the faker version it uses.
4
4
  module Decidim
5
5
  def self.version
6
- "0.30.1"
6
+ "0.31.0.rc1"
7
7
  end
8
8
  end