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
@@ -6,7 +6,7 @@
6
6
 
7
7
  When commenting a resource, the comments counter is increased and a notification to all the followers of the participant, the participatory space and/or the resource is sent.
8
8
 
9
- Participants can comment with their own identity or with the identify of the `user_groups` they belong to.
9
+ Participants can comment with their own identity.
10
10
 
11
11
  == Data model
12
12
 
@@ -16,16 +16,14 @@ For performance, a commentable has a counter cache of comments.
16
16
  [source,ascii]
17
17
  ----
18
18
  +----------------------+
19
- | Decidim::Commentable |
20
- | ((Proposal,...)) | +-------------+
21
- +----------------------+ 0..N +-------------------+ +--+Decidim::User|
22
- |-has_many comments |-------+Decidim::Comment | | +-------------+
23
- |#counter cache column | +-------------------+ |
24
- |-comments_counter | |-author: may be a |<--+
25
- +----------------------+ | user or a | |
26
- | user_group| | +------------------+
27
- +-------------------+ +--+Decidim::UserGroup|
28
- +------------------+
19
+ | Decidim::Commentable |
20
+ | ((Proposal,...)) |
21
+ +----------------------+ 0..N +-------------------+
22
+ |-has_many comments |-------+Decidim::Comment |
23
+ |#counter cache column | +-------------------+ +-------------+
24
+ |-comments_counter | |-author: a user |<-----+Decidim::User|
25
+ +----------------------+ +-------------------+ +-------------+
26
+
29
27
  ----
30
28
 
31
29
  Thus, each commentable must have the comments counter cache column.
@@ -140,7 +140,7 @@ Decidim.register_component(:my_component) do |component|
140
140
 
141
141
  component.settings(:step) do |settings|
142
142
  settings.attribute :a_text_setting, type: :text, default: false, required: true, translated: true, editor: true
143
- settings.attribute :a_lambda_enum_setting, type: :enum, default: "all", choices: -> { SomeClass.enum_options }
143
+ settings.attribute :a_lambda_enum_setting, type: :enum, default: "all", choices: ->(_context) { SomeClass.enum_options }
144
144
  settings.attribute :a_readonly_setting, type: :string, readonly: ->(context) { SomeClass.readonly?(context[:component]) }
145
145
  end
146
146
 
@@ -171,30 +171,30 @@ This sections explains how to add dummy content to a development application.
171
171
 
172
172
  == Assets
173
173
 
174
- In order to attach the new component assets to Webpacker configuration, you need to follow a few steps. We are considering two scenarios:
174
+ In order to attach the new component assets to Shakapacker configuration, you need to follow a few steps. We are considering two scenarios:
175
175
 
176
- - while the component is being developed, where changes in Webpacker configuration should be done in the development for simplicity
177
- - once the component has been completed, change the Webpacker templates for the app generators
176
+ - while the component is being developed, where changes in Shakapacker configuration should be done in the development for simplicity
177
+ - once the component has been completed, change the Shakapacker templates for the app generators
178
178
 
179
179
  In both cases, changes are the same:
180
180
 
181
- 1. Add the new component `app/packs` folder to webpacker.yml
181
+ 1. Add the new component `app/packs` folder to shakapacker.yml
182
182
  2. Add the new entrypoints of the component to `config/webpack/custom.js`
183
183
 
184
184
  === Updating the development application
185
185
 
186
- While the component is being developed, it will be simpler and faster to update Webpacker configuration inside the development app. The new component `app/packs` folder needs to be added to the list of paths that Webpack will use to look for assets.
186
+ While the component is being developed, it will be simpler and faster to update Shakapacker configuration inside the development app. The new component `app/packs` folder needs to be added to the list of paths that Webpack will use to look for assets.
187
187
 
188
188
  Also, components might have one or many entrypoints (for CSSs and javascripts) and images. These entrypoints need to be manually added to `config/webpack/custom.js`. **Any change in both files** requires to restart `webpack-dev-server` process.
189
189
 
190
- Take into account that generating a new development application **overwrites** Webpacker configuration so these changes might be overwritten. That is why it is necessary, once the changes are stable enough, to update the generators files.
190
+ Take into account that generating a new development application **overwrites** Shakapacker configuration so these changes might be overwritten. That is why it is necessary, once the changes are stable enough, to update the generators files.
191
191
 
192
- === Updating Webpacker configuration for the generators
192
+ === Updating Shakapacker configuration for the generators
193
193
 
194
- Decidim webpacker configuration lives in `decidim-core/lib/decidim/webpacker`. Any change performed in the development app should be replicated in these files.
194
+ Decidim shakapacker configuration lives in `decidim-core/lib/decidim/shakapacker`. Any change performed in the development app should be replicated in these files.
195
195
 
196
196
  Also, any npm package added to package.json should be replicated in Decidim package.json file.
197
197
 
198
198
  === Updating the design app
199
199
 
200
- These changes should also be translated to the design app `config/webpacker.yml` and `config/webpack/custom.js` files. And if there are changes in the npm packages, these should be moved to.
200
+ These changes should also be translated to the design app `config/shakapacker.yml` and `config/webpack/custom.js` files. And if there are changes in the npm packages, these should be moved to.
@@ -0,0 +1,101 @@
1
+ = Elections
2
+
3
+ The Elections component can be embedded in participatory spaces. To enable it, ensure it is included in your Gemfile by adding or uncommenting the following line:
4
+
5
+ [source,ruby]
6
+ ----
7
+ gem "decidim-elections", DECIDIM_VERSION
8
+ ----
9
+
10
+ The Elections component provides a way to organize voting based on a census. Depending on the type of census, users may be required to register before voting. Since the method for verifying a person against a census can vary, censuses are implemented using a manifest.
11
+ Any Decidim application or plugin can implement its own type of census just by defining the corresponding manifest.
12
+
13
+ == Registering a Census Manifest
14
+
15
+ Census types use the same manifests-registry pattern used in other places around Decidim. Here is how to register them:
16
+
17
+ [source,ruby]
18
+ ----
19
+ Decidim::Elections.census_registry.register(:my_census_type) do |manifest|
20
+ # Define your census manifest here
21
+ # Example:
22
+ manifest.admin_form = "Decidim::MyCensuses::MyCensusForm"
23
+ manifest.admin_form_partial = "decidim/my_censuses/my_census_form"
24
+ # Add additional configuration as needed
25
+ end
26
+ ----
27
+
28
+ Note that census types need to be registered from an initializer. If you are adding a census type from a module, use this in the `engine.rb` file of your module:
29
+
30
+ [source,ruby]
31
+ ----
32
+ module Decidim::MyModule::Engine < ::Rails::Engine
33
+ # ...
34
+
35
+ initializer "decidim_my_module.election_census" do
36
+ Decidim::Elections.census_registry.register(:my_census_type) do |manifest|
37
+ # ...
38
+ end
39
+ end
40
+
41
+ # ...
42
+ end
43
+ ----
44
+
45
+
46
+ == Options for the census manifest
47
+
48
+ The manifest is defined in the class `Decidim::Elections::CensusManifest`, possible attributes are:
49
+
50
+ [cols="1,2,2", options="header"]
51
+ |===
52
+ | Attribute
53
+ | Type
54
+ | Description
55
+
56
+ | admin_form
57
+ | String
58
+ | Name of the form class used in the admin interface for configuring the census. **Optional**.
59
+ If not defined, the admin interface will not show any additional form for configuring the census.
60
+ Note that, if you need to save different settings as a result of this form, the class needs to implement the method `census_settings` (check the `Decidim::Elections::Admin::Censuses::InternalUsersForm` for an example).
61
+
62
+ | admin_form_partial
63
+ | String
64
+ | Path to the partial rendered for the form in the admin interface. **Required if admin_form is set**.
65
+
66
+ | after_update_command
67
+ | String
68
+ | Command called after the census is updated in the admin interface. Receives the form and the election. **Optional**.
69
+ If not defined, there will be no post-processing after saving the census.
70
+ Note that you can use this command to upload a fixed list of voters in the generic model `Decidim::Elections::Voter` which only has one JSON column called `data`.
71
+ Check the command `Decidim::Elections::Admin::Censuses::TokenCsv` for an example on how to fill this table.
72
+
73
+ | user_presenter
74
+ | String
75
+ | Name of the presenter class for users in the census. Defaults to `"Decidim::Elections::Censuses::UserPresenter"` which should be enough for most cases.
76
+
77
+ | user_query
78
+ | Proc
79
+ | Block returning an `ActiveRecord::Relation` of users for the census. If set, automatically defines user validation, readiness, counting, and iteration.
80
+ Note that you can ignore this parameter if you define the next methods independently.
81
+
82
+ | user_validator
83
+ | Proc
84
+ | Block for custom user validation. Receives the election and user data. This is used to check if a user is in a census, must return a "truthy" value if ok.
85
+ Note that, if the `user_query` block is defined and this block is not set, the default behavior is to check the passed data against the query to see if there is any existing record.
86
+
87
+ | census_ready_validator
88
+ | Proc
89
+ | Block for custom census readiness validation. Receives the election. Must return a "truthy" value if the census is ready (for instance a census might require you to upload a file in order to be ready).
90
+ Note that, if the `user_query` block is defined and this block is not set, the default behavior is to check if there is at least one entry on the query.
91
+
92
+ | census_counter
93
+ | Proc
94
+ | Block for custom census user counting. Receives the election. Must return an integer of the number of users in the census. This does not mean necessarily that only that amount of users will be able to vote.
95
+ Dynamic censuses can grow/shrink while the election.
96
+ Note that, if the `user_query` block is defined and this block is not set, the default behavior is to count the number of elements in the query.
97
+
98
+ | user_iterator
99
+ | Proc
100
+ | Block for custom user iteration. Receives the election and offset. This is currently used only to show a preview of the census in the admin (so the offset is always zero, this might change in the future). If not defined and there is a `user_query` the first 5 elements will be listed.
101
+ |===
@@ -10,17 +10,12 @@ When you create an organization, you choose the available languages for it (thro
10
10
  However, when trying to edit it, the language selector is not available anymore.
11
11
  Here is a way to update that locales manually:
12
12
 
13
- First, make sure that your initializer file has all the locales you want:
13
+ First, make sure you have set your environment variables to use all the locales that you want
14
14
 
15
- Edit the file `config/initializers/decidim.rb` and be sure to include all the necessary locales:
16
-
17
- [source,ruby]
15
+ [source,bash]
18
16
  ----
19
- ...
20
- # Change these lines to set your preferred locales
21
- config.default_locale = :en
22
- config.available_locales = [:en, :ca, :es, :fr, :pt]
23
- ..
17
+ export DECIDIM_DEFAULT_LOCALE="en"
18
+ export DECIDIM_AVAILABLE_LOCALES="en,ca,es,fr,pt"
24
19
  ----
25
20
 
26
21
  Then you need to access the rails console and update the organization locales manually.
@@ -76,12 +71,12 @@ In order to solve that you can make use of these rake tasks:
76
71
  bundle exec rake decidim:locales:sync_all
77
72
  ----
78
73
 
79
- Run this task if you have changed `available_locales` or `default_locale` in `config/initializers/decidim.rb` and you think that some organization have values not supported by the Decidim installation.
74
+ Run this task if you have changed `DECIDIM_AVAILABLE_LOCALES` or `DECIDIM_DEFAULT_LOCALE` environment variables, and you think that some organization has values not supported by the Decidim installation.
80
75
 
81
76
  Examples:
82
77
 
83
- * `Decidim.available_locales` is set to `[:en, :ca, :fr]` and your organization has `available_locales` to `[:es, :ca]`, running this script will change it to `[:ca]` as `:es` is not supported.
84
- * `organization.default_locale` is set to `:fr` and your `available_locales` to `[:en, :es]`, running this script will change `organization.default_locale` to `:en`.
78
+ * `DECIDIM_AVAILABLE_LOCALES` is set to `"en,ca,fr"` and your organization has `available_locales` set to `"es,ca"`, running this script will change it to `ca` as `es` is not supported.
79
+ * `organization.default_locale` is set to `:fr` and your `DECIDIM_AVAILABLE_LOCALES` is set to `"en,es"`, running this script will change `organization.default_locale` to `:en`.
85
80
 
86
81
  It is safe to run this task as it respects organizations with less languages than the supported.
87
82
 
@@ -0,0 +1,100 @@
1
+ # Grafana
2
+
3
+ For improving the data visualization capabilities of Decidim, we have a working dashboard that can be imported to Grafana, an open-source observability and monitoring platform that allows users to visualize metrics, logs, and traces in real time from various data sources.
4
+
5
+ ## Initial set-up
6
+
7
+ The steps for having this dashboard are the following. For this tutorial we will use link:https://grafana.com[Grafana Cloud]
8
+
9
+ . Go to http://grafana.com
10
+
11
+ +
12
+ image::grafana/homepage.png[Grafana.com homepage]
13
+
14
+ . Click in button "Create account"
15
+ . Fill the account creation form with your information
16
+
17
+ +
18
+ image::grafana/create_account_form.png[Create an account form]
19
+
20
+ . Confirm your email address
21
+
22
+ +
23
+ image::grafana/create_account_confirm.png[Create an account form - confirm step]
24
+
25
+ . Finish the setup account process
26
+
27
+ +
28
+ image::grafana/create_account_setup.png[Create an account form - setup step]
29
+
30
+ ## Methods
31
+
32
+ Then, you have two options for connecting to any Decidim instance.
33
+
34
+ a. CSV (Comma-Separated Values): A simple file format used to store tabular data, such as spreadsheets or databases. Each line in a CSV file represents a row, with values separated by commas or other separators (semi colons in the case of Decidim).
35
+
36
+ b. GraphQL: A query language for APIs and a runtime for executing those queries. It allows clients to request only the data they need, reducing over-fetching and improving performance.
37
+
38
+ For demonstration purposes, we will use the link:https://meta.decidim.org[Metadecidim installation].
39
+
40
+ [cols="1,1", options="header"]
41
+ |===
42
+ |CSV
43
+ |GraphQL
44
+
45
+ |Using the Open Data features from https://meta.decidim.org/open-data
46
+ |Using the GraphQL API features from https://meta.decidim.org/api
47
+
48
+ |Only has access to the last 24 hours data
49
+ |Has real-time access
50
+
51
+ |Has access to all the public data
52
+ |Has a limit on the number of resources. See link:https://github.com/grafana/grafana-infinity-datasource/discussions/601[Pagination of API responses]
53
+ |===
54
+
55
+ So, taking into account the last limitation from the Grafana Infinity GraphQL connector, **we recommend using the CSV method** if you need to access more than the last 10 or 20 resources.
56
+
57
+ ## Examples
58
+
59
+ As a starting point to check-out the possibilities of this integration, we have provided some examples with the two methods.
60
+
61
+ ### CSV example
62
+
63
+ ++++
64
+ <a href="_attachments/grafana/metadecidim-csv.json" download>Download the example for CSV integration</a>
65
+ ++++
66
+
67
+ ### GraphQL example
68
+
69
+ ++++
70
+ <a href="_attachments/grafana/metadecidim-graphql.json" download>Download the example for GraphQL integration</a>
71
+ ++++
72
+
73
+ ## Import
74
+
75
+ For importing any of these methods, follow these instructions:
76
+
77
+ . Go to the "Dashboards" page and in the "New" button click in the "Import" option
78
+
79
+ +
80
+ image::grafana/dashboards.png[Dashboards page]
81
+
82
+ . In the text area, paste the contents of any of the examples provided (see below).
83
+
84
+ +
85
+ image::grafana/dashboard_import.png[Import a dashboard page]
86
+
87
+ . Click in the "Import" button
88
+
89
+ +
90
+ image::grafana/dashboard_import_csv.png[Dashboards page]
91
+
92
+ . Then you will see the imported Dashboard. Even though the examples are based on Metadecidim, are a good starting point to understand how to connect any Decidim API with Grafana.
93
+
94
+ +
95
+ image::grafana/dashboard_example_csv.png[Dashboard CSV example page]
96
+
97
+ +
98
+ image::grafana/dashboard_example_graphql.png[Dashboard GraphQL API example page]
99
+
100
+ 😊⌨️✨Happy hacking!
@@ -0,0 +1,106 @@
1
+ = Likeable
2
+
3
+ == Things can be likeable
4
+
5
+ `Likeable` is a feature to allow participants to promote (reivindicate, etc.) resources in the platform to their followers.
6
+
7
+ When liking an element the likes counter for this element is increased and a notification to all the followers of the participant is sent.
8
+
9
+ Participants can like with their own identity. Each liking identity on its own will increment the likes counter by one.
10
+
11
+ == Data model
12
+
13
+ A `decidim_likes` table registers each like that each identity gives to each element. This is, one likeable has many likes, and each like belongs to one likeable.
14
+ For performance, a likeable has a counter cache of likes.
15
+
16
+ [source,ascii]
17
+ ----
18
+ +----------------------+
19
+ | Decidim::Likeable |
20
+ | ((Proposal,...)) |
21
+ +----------------------+ 0..N +--------------------+
22
+ |-has_many likes|-------+Decidim::Like|
23
+ |#counter cache column | +--------------------+ +-------------+
24
+ |-likes_counter | |-author: a user |<--+Decidim::User|
25
+ +----------------------+ +--------------------+ +-------------+
26
+ ----
27
+
28
+ Thus, each likeable must have the likes counter cache column.
29
+ This is an example migration to add the likes counter cache column to a resource:
30
+
31
+ [source,ruby]
32
+ ----
33
+ class AddLikesCounterCacheToProposals < ActiveRecord::Migration[5.2]
34
+ def change
35
+ add_column :decidim_proposals_proposals, :likes_count, :integer, null: false, default: 0
36
+ end
37
+ end
38
+ ----
39
+
40
+ == Administration Panel
41
+
42
+ It is a good practice to give the opportunity to the admin to switch Likes on and off.
43
+
44
+ There are two switches that are normally defined in the manifest of the element in the following way (usually this would be at component.rb in a Decidim engine):
45
+
46
+ [source,ruby]
47
+ ----
48
+ settings.attribute :likes_enabled, type: :boolean, default: true
49
+ settings.attribute :likes_blocked, type: :boolean
50
+ ----
51
+
52
+ * `likes_enabled`: when enabled like functionality appears in the public views, when disabled, this functionality is hidden.
53
+ * `likes_blocked`: when blocked, the counter of likes is visible but no more likes can be added or withdrawn, the button is hidden.
54
+
55
+ == Permissions
56
+
57
+ In some cases, it may be interesting to require the user to be verified in order to be able to like. To do so, add the like action to the component manifest:
58
+
59
+ [source,ruby]
60
+ ----
61
+ component.actions = %w(like vote create withdraw amend)
62
+ ----
63
+
64
+ Given that some settings have been defined in the Administration Panel, for the user to have permissions to like likes should be enabled and not blocked.
65
+
66
+ == Public view
67
+
68
+ === The "Like" buttons cell
69
+
70
+ It normally appears in the resource detail view (show), at the bottom of the resource content, but above the comments when comments are enabled.
71
+ It allows users to like with any of their personal identity.
72
+ It also shows the current number of likes for this resource.
73
+
74
+ To render this button, `decidim-core` offers the `decidim/like_buttons` cell. It is strongly recommended to use this cell to make new resources likeable.
75
+
76
+ [source,ruby]
77
+ ----
78
+ cell("decidim/like_buttons", resource)
79
+ ----
80
+
81
+ This cell will render the like buttons depending on whether user liked the resource or not. The likes are labeled as *Likes*.
82
+
83
+ [source,ruby]
84
+ ----
85
+ # By default the `show` method is invoked as usual
86
+ # Renders `render_likes_count` and `render_likes_button` in a block.
87
+ #
88
+ # It takes into account:
89
+ # - if likes are enabled
90
+ # - if users are logged in
91
+ # - if users require verification
92
+ #
93
+ cell("decidim/like_buttons", resource)
94
+ ----
95
+
96
+ === The list of likes
97
+
98
+ The `Decidim::LikersListCell` renders the list of likes of a resource. It is usually rendered in the show page of the resource, just upside the comments. Additionally, this cell also renders the pop-up required to view the likes of a certain resource.
99
+
100
+ [source,ruby]
101
+ ----
102
+ # to render the list of likes, the cell requires the likeable resource, and the current user
103
+ cell "decidim/likers_list", resource
104
+ # or using the helper
105
+ likers_list_cell(resource)
106
+ ----
@@ -16,8 +16,12 @@ This workflow will only start if the machine translation service is configured i
16
16
  == Create your own machine translation service
17
17
 
18
18
  You can use the `Decidim::Dev::DummyTranslator` service as a base. Any new translator service will need to implement the same API as this class.
19
- In order to test the `Decidim::Dev::DummyTranslator` you will need to add at the top of `config/initializers/decidim.rb` the following line:
20
- `require "decidim/dev/dummy_translator"`
19
+ In order to test the `Decidim::Dev::DummyTranslator` you will need to set the `DECIDIM_MACHINE_TRANSLATION_SERVICE` environment variable.
20
+
21
+ [source,bash]
22
+ ----
23
+ export DECIDIM_MACHINE_TRANSLATION_SERVICE="Decidim::Dev::DummyTranslator"
24
+ ----
21
25
 
22
26
  == Integrating with async services
23
27