decidim 0.28.6 → 0.29.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.
- checksums.yaml +4 -4
- data/decidim-core/lib/decidim/webpacker/esbuild.config.js +14 -0
- data/decidim-core/lib/decidim/webpacker/shakapacker.yml +2 -2
- data/decidim-core/lib/decidim/webpacker/tsconfig.json +11 -0
- data/decidim-core/lib/decidim/webpacker/webpack/custom.js +13 -35
- data/decidim.gemspec +3 -2
- data/docs/README.adoc +2 -2
- data/docs/antora.yml +1 -1
- data/docs/modules/configure/pages/environment_variables.adoc +7 -103
- data/docs/modules/configure/pages/index.adoc +1 -1
- data/docs/modules/configure/pages/initializer.adoc +2 -2
- data/docs/modules/customize/pages/admin_filters.adoc +32 -0
- data/docs/modules/customize/pages/data_consent.adoc +1 -1
- data/docs/modules/customize/pages/index.adoc +2 -1
- data/docs/modules/customize/pages/javascript.adoc +2 -2
- data/docs/modules/customize/pages/logic.adoc +1 -1
- data/docs/modules/customize/pages/oauth.adoc +1 -1
- data/docs/modules/customize/pages/social_shares.adoc +2 -2
- data/docs/modules/customize/pages/styles.adoc +3 -3
- data/docs/modules/customize/pages/views.adoc +1 -1
- data/docs/modules/develop/pages/authorable.adoc +3 -3
- data/docs/modules/develop/pages/backports.adoc +6 -5
- data/docs/modules/develop/pages/c4_component.adoc +2 -7
- data/docs/modules/develop/pages/c4_container.adoc +1 -3
- data/docs/modules/develop/pages/c4_context.adoc +0 -2
- data/docs/modules/develop/pages/classes/commands.adoc +204 -25
- data/docs/modules/develop/pages/classes/jobs.adoc +1 -1
- data/docs/modules/develop/pages/components.adoc +5 -5
- data/docs/modules/develop/pages/custom_seed_data.adoc +1 -1
- data/docs/modules/develop/pages/embeddable.adoc +1 -1
- data/docs/modules/develop/pages/endorsable.adoc +2 -2
- data/docs/modules/develop/pages/guide_conventions.adoc +6 -6
- data/docs/modules/develop/pages/guide_development_app.adoc +2 -1
- data/docs/modules/develop/pages/guide_example_apps.adoc +1 -1
- data/docs/modules/develop/pages/guide_github_projects.adoc +1 -1
- data/docs/modules/develop/pages/guide_migrate_webpacker_app.adoc +2 -2
- data/docs/modules/develop/pages/guide_migrate_webpacker_module.adoc +1 -1
- data/docs/modules/develop/pages/maintainers/releases.adoc +2 -4
- data/docs/modules/develop/pages/managing_translations_i18n.adoc +2 -2
- data/docs/modules/develop/pages/maps.adoc +5 -5
- data/docs/modules/develop/pages/metrics.adoc +1 -1
- data/docs/modules/develop/pages/modules.adoc +1 -1
- data/docs/modules/develop/pages/newsletter_templates.adoc +2 -2
- data/docs/modules/develop/pages/notifications.adoc +124 -1
- data/docs/modules/develop/pages/reminders.adoc +2 -2
- data/docs/modules/develop/pages/reportable.adoc +1 -1
- data/docs/modules/develop/pages/testing.adoc +2 -2
- data/docs/modules/develop/pages/troubleshooting_metrics.adoc +2 -2
- data/docs/modules/develop/pages/view_models_aka_cells.adoc +1 -1
- data/docs/modules/install/pages/checklist.adoc +3 -2
- data/docs/modules/install/pages/empty-database.adoc +3 -3
- data/docs/modules/install/pages/index.adoc +5 -5
- data/docs/modules/install/pages/manual.adoc +3 -2
- data/docs/modules/install/pages/update.adoc +2 -2
- data/docs/modules/install/partials/version_matrix.adoc +2 -4
- data/docs/modules/services/pages/activestorage.adoc +1 -1
- data/docs/modules/services/pages/index.adoc +0 -1
- data/docs/modules/services/pages/maps.adoc +3 -3
- data/docs/modules/services/pages/sms.adoc +1 -1
- data/docs/modules/services/pages/social_providers.adoc +3 -3
- data/lib/decidim/gem_manager.rb +2 -0
- data/lib/decidim/version.rb +1 -1
- data/package-lock.json +6372 -19624
- data/package.json +4 -6
- data/packages/browserslist-config/package.json +2 -2
- data/packages/core/package.json +13 -13
- data/packages/dev/package.json +2 -2
- data/packages/eslint-config/index.js +58 -82
- data/packages/eslint-config/package.json +2 -2
- data/packages/prettier-config/package.json +2 -2
- data/packages/stylelint-config/package.json +2 -2
- data/packages/webpacker/index.js +2 -1
- data/packages/webpacker/package.json +6 -12
- metadata +62 -62
- data/babel.config.json +0 -25
- data/docs/modules/develop/pages/consulations_removal.bash +0 -117
- data/docs/modules/services/pages/elections_bulletin_board.adoc +0 -55
- data/lib/decidim/backporter.rb +0 -98
- data/lib/decidim/backports_reporter/cli_report.rb +0 -44
- data/lib/decidim/backports_reporter/csv_report.rb +0 -32
- data/lib/decidim/backports_reporter/report.rb +0 -46
- data/lib/decidim/git_backport_checker.rb +0 -70
- data/lib/decidim/git_backport_manager.rb +0 -179
- data/lib/decidim/github_manager/poster.rb +0 -70
- data/lib/decidim/github_manager/querier/base.rb +0 -78
- data/lib/decidim/github_manager/querier/by_issue_id.rb +0 -46
- data/lib/decidim/github_manager/querier/by_label.rb +0 -95
- data/lib/decidim/github_manager/querier/related_issues.rb +0 -51
- data/lib/decidim/github_manager/querier.rb +0 -20
- data/packages/elections/package.json +0 -17
- data/packages/webpacker/package-lock.json +0 -18045
@@ -11,7 +11,7 @@ title System Component diagram for Decidim Applications (https://decidim.org)
|
|
11
11
|
|
12
12
|
ContainerDb(rel_db, "Relational Database", "PostgreSQL 9.5.x", "Stores users, participatory processes, assemblies, initiatives, proposals, meetings, etc.")
|
13
13
|
Container(filesystem, "File System", "Local or remote", "Stores uploads (images, documents, etc.)")
|
14
|
-
Container(worker, "Worker", "Ruby on Rails 5.2", "ActiveJob queues for non
|
14
|
+
Container(worker, "Worker", "Ruby on Rails 5.2", "ActiveJob queues for non synchronous jobs. Works for open data requests, sending emails, etc.")
|
15
15
|
|
16
16
|
Container_Boundary(web_app, "Web Application") {
|
17
17
|
|
@@ -25,7 +25,7 @@ Container_Boundary(web_app, "Web Application") {
|
|
25
25
|
Component(system, "System module", "Ruby On Rails Engine", "Multitenant configuration, mounted in /system. Can create and manage all the instances of an installation.")
|
26
26
|
Component(verifications, "Verifications module", "Ruby On Rails Engine", " Offers several methods for allowing participants to get authorization to perform certain privileged actions.")
|
27
27
|
|
28
|
-
Component(assemblies, "Assemblies module", "Ruby On Rails Engine (Space)", "A
|
28
|
+
Component(assemblies, "Assemblies module", "Ruby On Rails Engine (Space)", "A permanent Space, mounted in /assemblies.")
|
29
29
|
Component(conferences, "Conferences module", "Ruby On Rails Engine (Space)", "A temporal Space, mounted in /conferences.")
|
30
30
|
Component(initiatives, "Initiatives module", "Ruby On Rails Engine (Space)", "A bottom-up Space, mounted in /initiatives. A participant can collect signatures to bring an issue to the organization.")
|
31
31
|
Component(participatory_processes, "Participatory Processes module (Space)", "Ruby On Rails Engine", "A temporal Space, mounted in /processes.")
|
@@ -34,7 +34,6 @@ Container_Boundary(web_app, "Web Application") {
|
|
34
34
|
Component(budgets, "Budgets module", "Ruby On Rails Engine", "Component. Adds a participatory budgets system to any participatory space.")
|
35
35
|
Component(blogs, "Blogs module", "Ruby On Rails Engine", "Component. Makes possible to add posts ordered by publication time to spaces.")
|
36
36
|
Component(debates, "Debates module", "Ruby On Rails Engine", "Component. Adds a CRUD engine to the admin and public view scoped inside the participatory process.")
|
37
|
-
Component(elections, "Elections module", "Ruby On Rails Engine", "Components. Adds voting with cryptographic capabilities.")
|
38
37
|
Component(meetings, "Meetings module", "Ruby On Rails Engine", "Component. Adds a CRUD engine to the admin and public view scoped inside the participatory process.")
|
39
38
|
Component(pages, "Pages module", "Ruby On Rails Engine", "Component. adds static page capabilities to any participatory space. It basically provides an interface to include arbitrary HTML content to any step.")
|
40
39
|
Component(proposals, "Proposals module", "Ruby On Rails Engine", "Component. Adds one of the main components of Decidim: allows users to contribute to a participatory space by creating proposals.")
|
@@ -43,7 +42,6 @@ Container_Boundary(web_app, "Web Application") {
|
|
43
42
|
|
44
43
|
Rel(surveys, forms, "Consumes")
|
45
44
|
Rel(meetings, forms, "Consumes")
|
46
|
-
Rel_Back(forms, elections, "Consumes")
|
47
45
|
|
48
46
|
' Rel(proposals, assemblies, "Mounts in")
|
49
47
|
' Rel(proposals, participatory_processes, "Mounts in")
|
@@ -67,17 +65,14 @@ Container_Boundary(web_app, "Web Application") {
|
|
67
65
|
' Rel(debates, admin, "Managed in")
|
68
66
|
' Rel(proposals, admin, "Managed in")
|
69
67
|
' Rel(blogs, admin, "Managed in")
|
70
|
-
' Rel(elections, admin, "Managed in")
|
71
68
|
|
72
69
|
}
|
73
70
|
|
74
|
-
System_Ext(decidim_bulletin_board_system, "Decidim Bulletin Board", "Allows participants to cast end-to-end verifiable secret votes.")
|
75
71
|
System_Ext(mail_system, "SMTP system (e-mail)", "Sends mails to users, like confirmations, reminders, notifications, etc.")
|
76
72
|
System_Ext(etherpad_system, "Etherpad-Lite system", "Optional. Allows real-time text edition in Meetings.")
|
77
73
|
System_Ext(geocoding_system, "Geocoding system", "Optional. An Open Street Maps provider, allows geographical localization of Proposals and Meetings..")
|
78
74
|
System_Ext(oauth_system, "OAUTH2 System", "Optional. Third party sign on systems. Could be Twitter, Facebook, Google or any other OAUTH2 providers.")
|
79
75
|
|
80
|
-
Rel_Back_Neighbor(decidim_bulletin_board_system, elections, "Uses")
|
81
76
|
Rel_Neighbor(worker, mail_system, "Sends e-mails", "SMTP")
|
82
77
|
Rel(web_app, rel_db, "Uses")
|
83
78
|
Rel(web_app, filesystem, "Uses")
|
@@ -17,10 +17,9 @@ System_Boundary(decidim_system, "decidim"){
|
|
17
17
|
Container(web_app, "Web Application", "Ruby on Rails 5.2", "Allows participants to make decisions collaboratively through participatory processes, assemblies, initiatives, etc.")
|
18
18
|
ContainerDb(rel_db, "Relational Database", "PostgreSQL 9.5.x", "Stores users, participatory processes, assemblies, initiatives, proposals, meetings, etc.")
|
19
19
|
Container(filesystem, "File System", "Local or remote", "Stores uploads (images, documents, etc.)")
|
20
|
-
Container(worker, "Worker", "Ruby on Rails 5.2", "ActiveJob queues for non
|
20
|
+
Container(worker, "Worker", "Ruby on Rails 5.2", "ActiveJob queues for non synchronous jobs. Works for open data requests, sending emails, etc.")
|
21
21
|
}
|
22
22
|
|
23
|
-
System_Ext(decidim_bulletin_board_system, "Decidim Bulletin Board", "Allows participants to cast end-to-end verifiable secret votes.")
|
24
23
|
System_Ext(mail_system, "SMTP system (e-mail)", "Sends mails to users, like confirmations, reminders, notifications, etc.")
|
25
24
|
System_Ext(etherpad_system, "Etherpad-Lite system", "Optional. Allows real-time text edition in Meetings.")
|
26
25
|
System_Ext(geocoding_system, "Geocoding system", "Optional. An Open Street Maps provider, allows geographical localization of Proposals and Meetings..")
|
@@ -31,7 +30,6 @@ Rel(participant_user, web_app, "Uses")
|
|
31
30
|
Rel(administration_user, web_app, "Uses")
|
32
31
|
Rel_Back(participant_user, mail_system, "Sends e-mails to")
|
33
32
|
Rel_Back(administration_user, mail_system, "Sends e-mails to")
|
34
|
-
Rel_Back_Neighbor(decidim_bulletin_board_system, web_app, "Uses")
|
35
33
|
Rel_Neighbor(worker, mail_system, "Sends e-mails", "SMTP")
|
36
34
|
Rel(web_app, rel_db, "Uses")
|
37
35
|
Rel(web_app, filesystem, "Uses")
|
@@ -15,7 +15,6 @@ Person(administration_user, "Administration User", "A registered user with speci
|
|
15
15
|
|
16
16
|
System(decidim_system, "Decidim", "Allows participants to make decisions collaboratively through participatory processes, assemblies, initiatives, etc.")
|
17
17
|
|
18
|
-
System_Ext(decidim_bulletin_board_system, "Decidim Bulletin Board", "Allows participants to cast end-to-end verifiable secret votes.")
|
19
18
|
System_Ext(mail_system, "SMTP system (e-mail)", "Sends mails to users, like confirmations, reminders, notifications, etc.")
|
20
19
|
System_Ext(etherpad_system, "Etherpad-Lite system", "Optional. Allows real-time text edition in Meetings.")
|
21
20
|
System_Ext(geocoding_system, "Geocoding system", "Optional. An Open Street Maps provider, allows geographical localization of Proposals and Meetings..")
|
@@ -26,7 +25,6 @@ Rel(participant_user, decidim_system, "Uses")
|
|
26
25
|
Rel(administration_user, decidim_system, "Uses")
|
27
26
|
Rel_Back(participant_user, mail_system, "Sends e-mails to")
|
28
27
|
Rel_Back(administration_user, mail_system, "Sends e-mails to")
|
29
|
-
Rel_Back_Neighbor(decidim_bulletin_board_system, decidim_system, "Uses")
|
30
28
|
Rel_Neighbor(decidim_system, mail_system, "Sends e-mails", "SMTP")
|
31
29
|
Rel(decidim_system, oauth_system, "Uses")
|
32
30
|
Rel(decidim_system, geocoding_system, "Uses")
|
@@ -2,11 +2,188 @@
|
|
2
2
|
|
3
3
|
A command is custom class that manages the logic between your input, usually a xref:develop:classes/forms.adoc[form] object, an object and an user.
|
4
4
|
|
5
|
-
Usually, a command is used to
|
5
|
+
Usually, a command is used to handle the interaction between the controller and the model.
|
6
6
|
|
7
7
|
Commands are located in the `app/commands/decidim/<my_module>` directory, and named: `<action>_<my_resource>.rb`.
|
8
8
|
|
9
|
-
|
9
|
+
Because most of the time, a command is used to create, update a resource, we are shipping 3 commands by default, which you can inherit in your own commands:
|
10
|
+
|
11
|
+
- xref:_decidimcommandscreateresource[`Decidim::Commands::CreateResource`] - for creating resources
|
12
|
+
- xref:_decidimcommandsupdateresource[`Decidim::Commands::UpdateResource`] - for updating resources
|
13
|
+
- xref:_decidimcommandsdestroyresource[`Decidim::Commands::DestroyResource`] - for destroying resources
|
14
|
+
|
15
|
+
== Decidim::Commands::CreateResource
|
16
|
+
|
17
|
+
In order to create a resource, you need to provide the form with the values you want to create.
|
18
|
+
|
19
|
+
This is a custom implementation for demonstration purposes:
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# frozen_string_literal: true
|
23
|
+
|
24
|
+
# app/commands/decidim/my_module/create_my_resource.rb
|
25
|
+
module Decidim
|
26
|
+
module MyModule
|
27
|
+
class CreateMyResource < Decidim::Commands::CreateResource
|
28
|
+
# Tell the parent class which fields are going to be
|
29
|
+
# copied from the form
|
30
|
+
fetch_form_attributes :title, :description, :component
|
31
|
+
|
32
|
+
# Tell the parent class which files are going to be
|
33
|
+
# extracted from the form and attached to the resource
|
34
|
+
fetch_file_attributes :logo, :banner
|
35
|
+
|
36
|
+
# This is the class initializer. It can be ignored if you do not need
|
37
|
+
# to do anything special.
|
38
|
+
def initialize(form)
|
39
|
+
@form = form
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
# Tell the parent what is the ActiveRecord class needed
|
44
|
+
def resource_class = Decidim::MyModule::MyResource
|
45
|
+
|
46
|
+
# This method allows you to customize the log visibility
|
47
|
+
def extra_params = { visibility: "all" }
|
48
|
+
|
49
|
+
# The command has a before hook that you can use:
|
50
|
+
def run_before_hooks
|
51
|
+
# do something
|
52
|
+
end
|
53
|
+
|
54
|
+
# The command has an after hook that you can use:
|
55
|
+
def run_after_hooks
|
56
|
+
# do something
|
57
|
+
end
|
58
|
+
|
59
|
+
# Additionally, you can override the `attributes` method
|
60
|
+
# to add more attributes to the resource
|
61
|
+
def attributes
|
62
|
+
super.merge({
|
63
|
+
my_custom_attribute: form.my_custom_attribute
|
64
|
+
})
|
65
|
+
end
|
66
|
+
|
67
|
+
# You can also provide a custom form validation
|
68
|
+
# by overriding the `invalid?` method
|
69
|
+
def invalid?
|
70
|
+
return true if form.my_custom_attribute.blank?
|
71
|
+
super
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
```
|
77
|
+
|
78
|
+
== Decidim::Commands::UpdateResource
|
79
|
+
|
80
|
+
In order to update a resource, you need to provide the resource you want to update, and the form with the new values.
|
81
|
+
|
82
|
+
This is a custom implementation for demonstration purposes:
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
# frozen_string_literal: true
|
86
|
+
|
87
|
+
# app/commands/decidim/my_module/update_my_resource.rb
|
88
|
+
module Decidim
|
89
|
+
module MyModule
|
90
|
+
class UpdateMyResource < Decidim::Commands::UpdateResource
|
91
|
+
# Tell the parent class which fields are going to be
|
92
|
+
# copied from the form
|
93
|
+
fetch_form_attributes :title, :description, :component
|
94
|
+
|
95
|
+
# Tell the parent class which files are going to be
|
96
|
+
# extracted from the form and attached to the resource
|
97
|
+
fetch_file_attributes :logo, :banner
|
98
|
+
|
99
|
+
# This is the class initializer. It can be ignored if you do not need
|
100
|
+
# to do anything special.
|
101
|
+
def initialize(form, resource)
|
102
|
+
@form = form
|
103
|
+
@resource = resource
|
104
|
+
end
|
105
|
+
|
106
|
+
private
|
107
|
+
# Tell the parent what is the ActiveRecord class needed
|
108
|
+
def resource_class = Decidim::MyModule::MyResource
|
109
|
+
|
110
|
+
# This method allows you to customize the log visibility
|
111
|
+
def extra_params = { visibility: "all" }
|
112
|
+
|
113
|
+
# The command has a before hook that you can use:
|
114
|
+
def run_before_hooks
|
115
|
+
# do something
|
116
|
+
end
|
117
|
+
|
118
|
+
# The command has an after hook that you can use:
|
119
|
+
def run_after_hooks
|
120
|
+
# do something
|
121
|
+
end
|
122
|
+
|
123
|
+
# Additionally, you can override the `attributes` method
|
124
|
+
# to add more attributes to the resource
|
125
|
+
def attributes
|
126
|
+
super.merge({
|
127
|
+
my_custom_attribute: form.my_custom_attribute
|
128
|
+
})
|
129
|
+
end
|
130
|
+
|
131
|
+
# You can also provide a custom form validation
|
132
|
+
# by overriding the `invalid?` method
|
133
|
+
def invalid?
|
134
|
+
return true if form.my_custom_attribute.blank?
|
135
|
+
super
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
```
|
141
|
+
|
142
|
+
== Decidim::Commands::DestroyResource
|
143
|
+
|
144
|
+
If you do not need to do anything special, you can just call this command for any resource you want to destroy.
|
145
|
+
|
146
|
+
If you still want to customize the command, you can do it like this:
|
147
|
+
|
148
|
+
```ruby
|
149
|
+
# frozen_string_literal: true
|
150
|
+
|
151
|
+
# app/commands/decidim/my_module/destroy_my_resource.rb
|
152
|
+
module Decidim
|
153
|
+
module MyModule
|
154
|
+
class DestroyMyResource < Decidim::Commands::DestroyResource
|
155
|
+
# This is the class initializer, that can be safely ignored if you do not perform additional actions
|
156
|
+
def initialize(resource, current_user)
|
157
|
+
@resource = resource
|
158
|
+
@current_user = current_user
|
159
|
+
end
|
160
|
+
|
161
|
+
private
|
162
|
+
|
163
|
+
# This method allows you to customize the log visibility
|
164
|
+
def extra_params = { visibility: "all" }
|
165
|
+
|
166
|
+
# The command has a before hook that you can use:
|
167
|
+
def run_before_hooks
|
168
|
+
# do something
|
169
|
+
end
|
170
|
+
|
171
|
+
# The command has an after hook that you can use:
|
172
|
+
def run_after_hooks
|
173
|
+
# do something
|
174
|
+
end
|
175
|
+
|
176
|
+
# You can also provide a custom validation by overriding the `invalid?` method
|
177
|
+
def invalid? = false
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
181
|
+
```
|
182
|
+
|
183
|
+
== Advanced usage
|
184
|
+
|
185
|
+
In the below example, you will be able to see an advanced example on how you can write your custom command (`CreateMyResource`), events (`Decidim::MyModule::MyResourceEvent`) and jobs (`Decidim::MyModule::MyCustomJob`) can be used.
|
186
|
+
|
10
187
|
```ruby
|
11
188
|
# frozen_string_literal: true
|
12
189
|
|
@@ -23,23 +200,23 @@ module Decidim
|
|
23
200
|
end
|
24
201
|
|
25
202
|
def call
|
26
|
-
|
203
|
+
return broadcast(:invalid) if form.invalid?
|
27
204
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
205
|
+
transaction do
|
206
|
+
create_resource
|
207
|
+
dispatch_event
|
208
|
+
process_jobs
|
209
|
+
end
|
210
|
+
broadcast(:ok)
|
32
211
|
end
|
33
|
-
broadcast(:ok)
|
34
|
-
end
|
35
212
|
|
36
213
|
private
|
37
214
|
|
38
215
|
attr_reader :form, :resource
|
39
216
|
|
40
217
|
def process_jobs
|
41
|
-
|
42
|
-
|
218
|
+
Decidim::MyModule::MyCustomJob.perform_later(resource)
|
219
|
+
end
|
43
220
|
|
44
221
|
def dispatch_event
|
45
222
|
Decidim::EventsManager.publish(
|
@@ -47,31 +224,33 @@ module Decidim
|
|
47
224
|
event_class: Decidim::MyModule::MyResourceEvent,
|
48
225
|
resource:
|
49
226
|
)
|
50
|
-
|
227
|
+
end
|
51
228
|
|
52
229
|
def create_resource
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
230
|
+
@resource = Decidim.traceability.create!(
|
231
|
+
resource,
|
232
|
+
form.current_user,
|
233
|
+
**attributes,
|
234
|
+
visibility: "public-only"
|
235
|
+
)
|
236
|
+
end
|
60
237
|
|
61
238
|
# this is mapping of
|
62
239
|
# ActiveRecord::attribute => form.attribute
|
63
240
|
def attributes
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
241
|
+
{
|
242
|
+
title: form.title,
|
243
|
+
description: form.description,
|
244
|
+
resource: form.resource
|
245
|
+
}
|
246
|
+
end
|
70
247
|
end
|
71
248
|
end
|
72
249
|
end
|
73
250
|
```
|
74
251
|
|
252
|
+
== Overriding Decidim commands
|
253
|
+
|
75
254
|
Sometimes you may need to extend a `Decidim` supplied command, then you can either override the `attributes` method, either extend it with a `super` call.
|
76
255
|
|
77
256
|
```ruby
|
@@ -1,6 +1,6 @@
|
|
1
1
|
= Jobs
|
2
2
|
|
3
|
-
Decidim jobs classes do not implement anything different than what `ActiveJob` has to offer.
|
3
|
+
Decidim jobs classes are not do not implement anything different than what `ActiveJob` has to offer.
|
4
4
|
|
5
5
|
Jobs classes are located in the `app/jobs/decidim/<my_module>` directory, and named: `<my_custom>_job.rb`.
|
6
6
|
|
@@ -6,7 +6,7 @@ Components are the core contract between external xref:develop:modules.adoc[modu
|
|
6
6
|
|
7
7
|
If you want to create a new component, you can use https://github.com/decidim/decidim/tree/develop/decidim-generators[decidim-generators] to
|
8
8
|
automatically generate a decidim component skeleton, or copy the basic structure
|
9
|
-
of an existing
|
9
|
+
of an existing maintained plugin.
|
10
10
|
|
11
11
|
[source,console]
|
12
12
|
----
|
@@ -43,7 +43,7 @@ Decidim.register_component(:my_component) do |component|
|
|
43
43
|
|
44
44
|
# Component hooks get called whenever relevant lifecycle events happen, like
|
45
45
|
# adding a new component o destroying it. You always get passed the instance
|
46
|
-
# so you can act on it. Creating or destroying a
|
46
|
+
# so you can act on it. Creating or destroying a component is transactional
|
47
47
|
# along with its hooks, so you can decide to halt the transaction by raising
|
48
48
|
# an exception.
|
49
49
|
#
|
@@ -125,7 +125,7 @@ Each attribute defined can be described through properties:
|
|
125
125
|
* `text` and `string` attributes can be `translated`, which will allow admin users to enter values for every language.
|
126
126
|
* `text` attributes can use an `editor` to edit them as HTML code
|
127
127
|
* `enum` attributes should have a `choices` attributes that list all the possible values. This could be a lambda function.
|
128
|
-
* they can be `readonly` in some cases,
|
128
|
+
* they can be `readonly` in some cases, through a lambda function that received the current component within the `context`.
|
129
129
|
|
130
130
|
[source,ruby]
|
131
131
|
----
|
@@ -167,7 +167,7 @@ This sections explains how to add dummy content to a development application.
|
|
167
167
|
=== Tips and Tricks
|
168
168
|
|
169
169
|
* Take advantage of the Faker gem, already in decidim.
|
170
|
-
* If you need content for i18n fields, you can use https://github.com/decidim/decidim/blob/develop/decidim-core/lib/decidim/faker/localized.rb[
|
170
|
+
* If you need content for i18n fields, you can use https://github.com/decidim/decidim/blob/develop/decidim-core/lib/decidim/faker/localized.rb[Localized], which uses `Faker` internally.
|
171
171
|
|
172
172
|
== Assets
|
173
173
|
|
@@ -187,7 +187,7 @@ While the component is being developed, it will be simpler and faster to update
|
|
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
|
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.
|
191
191
|
|
192
192
|
=== Updating Webpacker configuration for the generators
|
193
193
|
|
@@ -27,5 +27,5 @@ If you set the variables _before_ creating the seeds data, the values in those v
|
|
27
27
|
* `SMTP_PORT`: The port used to connect to your email sending system.
|
28
28
|
* `DECIDIM_SYSTEM_USER_PASSWORD`: The password for the System user. Useful to hide access to the System panel, where the SMTP config can be retrieved in plain text.
|
29
29
|
|
30
|
-
This is useful, for example, to set up a staging application open to anyone, and use
|
30
|
+
This is useful, for example, to set up a staging application open to anyone, and use SendGrid as a mailing system. By changing the default password only you will be able to access the System panel, so nobody will be able to see the credentials used to connect to SendGrid.
|
31
31
|
|
@@ -11,7 +11,7 @@ or even `Meetings` component in an easy way with the `embeddable` option that of
|
|
11
11
|
|
12
12
|
== How to
|
13
13
|
|
14
|
-
All that you have to do, is to enter into
|
14
|
+
All that you have to do, is to enter into whatever space/component you want to share info to, and look for down right part of the page to find embeddable share option.
|
15
15
|
|
16
16
|
If it is embeddable, you will see `embed <\>` option there.
|
17
17
|
|
@@ -20,7 +20,7 @@ For performance, an endorsable has a counter cache of endorsements.
|
|
20
20
|
| ((Proposal,...)) | +-------------+
|
21
21
|
+----------------------+ 0..N +--------------------+ +--+Decidim::User|
|
22
22
|
|-has_many endorsements|-------+Decidim::Endorsement| | +-------------+
|
23
|
-
|#counter
|
23
|
+
|#counter cache column | +--------------------+ |
|
24
24
|
|-endorsements_counter | |-author: may be a |<--+
|
25
25
|
+----------------------+ | user or a | |
|
26
26
|
| user_group | | +------------------+
|
@@ -81,7 +81,7 @@ To render this button, `decidim-core` offers the `decidim/endorsement_buttons` c
|
|
81
81
|
cell("decidim/endorsement_buttons", resource)
|
82
82
|
----
|
83
83
|
|
84
|
-
This cell, renders the endorsements counter and the endorsement button by default. But it has the possibility to be invoked to render elements
|
84
|
+
This cell, renders the endorsements counter and the endorsement button by default. But it has the possibility to be invoked to render elements separately.
|
85
85
|
|
86
86
|
[source,ruby]
|
87
87
|
----
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
== GitFlow Branching model
|
4
4
|
|
5
|
-
The Decidim
|
5
|
+
The Decidim repository follows the GitFlow branching model. There are good documentations on it at:
|
6
6
|
|
7
7
|
* https://nvie.com/posts/a-successful-git-branching-model/[the original post]
|
8
8
|
* https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow[Atlassian tutorial]
|
@@ -25,7 +25,7 @@ Please note that Decidim does not use the `master` branch.
|
|
25
25
|
|
26
26
|
== Naming branches
|
27
27
|
|
28
|
-
We would like to have all branches following this
|
28
|
+
We would like to have all branches following this naming convention:
|
29
29
|
|
30
30
|
|===
|
31
31
|
| Branch prefix | Comment
|
@@ -34,7 +34,7 @@ We would like to have all branches following this namings:
|
|
34
34
|
| Internal work. For instance, automatisms, etc. No production code change.
|
35
35
|
|
36
36
|
| ci/
|
37
|
-
| For
|
37
|
+
| For continuous integration related tasks. No production code change.
|
38
38
|
|
39
39
|
| deps/
|
40
40
|
| For dependency management tasks.
|
@@ -67,7 +67,7 @@ After the prefix we recommend to add some words that describe what the change is
|
|
67
67
|
. feature/add-pagination-to-moderated-users
|
68
68
|
. fix/free-text-choice-answer
|
69
69
|
|
70
|
-
The rationale behind this is that we do not like to have the issue number (`fix/9123` or just `9123`) as that
|
70
|
+
The rationale behind this is that we do not like to have the issue number (`fix/9123` or just `9123`) as that is difficult to work with in `git`.
|
71
71
|
|
72
72
|
== Git commit messages and Pull Request titles
|
73
73
|
|
@@ -87,7 +87,7 @@ For keeping track of changes we like the rules of https://keepachangelog.com/en/
|
|
87
87
|
|
88
88
|
In the past we kept a file for all the development of a given version but that was difficult to maintain, as we had conflicts all the time. See the full discussion in https://github.com/decidim/decidim/issues/5908[#5908]. We decided that:
|
89
89
|
|
90
|
-
* We will not ask CHANGELOG for all the changes make on this repository. We will ask for CHANGELOG instructions only for special changes that really need some actions on part of developers/implementers or something to
|
90
|
+
* We will not ask CHANGELOG for all the changes make on this repository. We will ask for CHANGELOG instructions only for special changes that really need some actions on part of developers/implementers or something to communicate on the releases notes
|
91
91
|
* The CHANGELOG will be manually made as part of the release process with the tooling from git (`git log v0.20.0..v0.20.1 --grep " (#[0-9]\+)" --oneline`) or https://github.com/decidim/decidim/compare/v0.20.0...v0.20.1[github]
|
92
92
|
|
93
93
|
== Semantic Versioning
|
@@ -105,5 +105,5 @@ For more information, refer to the xref:develop:guide_accessibility.adoc[Decidim
|
|
105
105
|
|
106
106
|
== JavaScript
|
107
107
|
|
108
|
-
* Do not use CSS classes to bind JavaScript selectors or Ruby specs. Try to use an `id` (with the `js-`
|
108
|
+
* Do not use CSS classes to bind JavaScript selectors or Ruby specs. Try to use an `id` (with the `js-` prefix) or a `data-attribute` as selector, in order to shrink the coupling between changing technologies.
|
109
109
|
* Do not use jQuery if you can do it with vanilla JavaScript. Specially try to not introduce new code with jQuery, and if you are working with a legacy file take consider migrating it to vanilla JS.
|
@@ -3,7 +3,7 @@
|
|
3
3
|
In order to start developing you will need what is called a `development_app`. This is nearly the same as a new Decidim
|
4
4
|
app (that you can create with `decidim app_name`) but with a Gemfile pre-configured for local development and some other small config modifications.
|
5
5
|
|
6
|
-
We recommend that you first have a xref:install:manual.adoc[working Decidim app] so that you have
|
6
|
+
We recommend that you first have a xref:install:manual.adoc[working Decidim app] so that you have fulfilled all the necessary
|
7
7
|
system and services requirements, like having a working Ruby installation, PostgreSQL, Node.JS, etc.
|
8
8
|
|
9
9
|
You will need to configure the PostgreSQL database before anything. For this,
|
@@ -49,6 +49,7 @@ On creation, these steps are automatically invoked by the generator:
|
|
49
49
|
* `bin/rails decidim:upgrade`
|
50
50
|
* `bin/rails db:create`
|
51
51
|
* `bin/rails db:migrate`
|
52
|
+
* `bin/rails assets:precompile`
|
52
53
|
* `bin/rails db:seed`
|
53
54
|
|
54
55
|
Mind that if everything went well you should not need to run these commands manually.
|
@@ -27,7 +27,7 @@ image::helsinki.png[Helsinki OmaStadi]
|
|
27
27
|
|
28
28
|
Some highlights:
|
29
29
|
|
30
|
-
* They have their https://github.com/City-of-Helsinki/decidim-helsinki/blob/b9a09e570eb6090dee93f2ee73b5951882c74755/Gemfile[Gemfile] with lots of modules with their own code. Some of them are also in ruybgems (like `decidim-access_requests`, `decidim-antivirus`, `decidim-mpassid`, `decidim-process_groups_content_block`, `decidim-suomifi`, `decidim-term_customizer`), others are only in
|
30
|
+
* They have their https://github.com/City-of-Helsinki/decidim-helsinki/blob/b9a09e570eb6090dee93f2ee73b5951882c74755/Gemfile[Gemfile] with lots of modules with their own code. Some of them are also in ruybgems (like `decidim-access_requests`, `decidim-antivirus`, `decidim-mpassid`, `decidim-process_groups_content_block`, `decidim-suomifi`, `decidim-term_customizer`), others are only in GitHub (`decidim-accountability_simple`, `decidim-apiauth`, `decidim-combined_budgeting`, `decidim-plans`, `decidim-redirects`). They even use a module made by other organization in the community (`decidim-budgets_enhanced`)
|
31
31
|
* They have their UI customized to their needs. See the https://github.com/City-of-Helsinki/decidim-helsinki/tree/a7396a312cc04198654a86d66c2a7de556c212af/app/assets/stylesheets[CSS] and https://github.com/City-of-Helsinki/decidim-helsinki/tree/a7396a312cc04198654a86d66c2a7de556c212af/app/views[HTML (views)].
|
32
32
|
* They have an awesome README explaining how it works and what changes have made.
|
33
33
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
= GitHub Projects Workflow
|
2
2
|
|
3
|
-
This is an internal document on how we are organizing the development of Decidim with external contractors through
|
3
|
+
This is an internal document on how we are organizing the development of Decidim with external contractors through GitHub projects.
|
4
4
|
|
5
5
|
There are three teams:
|
6
6
|
|
@@ -43,7 +43,7 @@ This task do a few steps to allow the Rails instance to have a webpacker instanc
|
|
43
43
|
|
44
44
|
This task is automatically performed every time decidim is updated, to get the latest Webpack configuration. This happens when you run the `decidim:upgrade` task.
|
45
45
|
|
46
|
-
=== Copy Decidim custom CSS and
|
46
|
+
=== Copy Decidim custom CSS and JavaScript
|
47
47
|
|
48
48
|
`webpacker:install` task should have created to you the following dirs structure:
|
49
49
|
|
@@ -104,7 +104,7 @@ If any of the CSS is re-defining CSS vars add them to `_decidim-settings.scss`.
|
|
104
104
|
|
105
105
|
=== Migrate javascripts
|
106
106
|
|
107
|
-
Existing javascripts should be moved from `app/assets/
|
107
|
+
Existing javascripts should be moved from `app/assets/javascripts` to `app/packs/src` and imported with `import` into `decidim_application.js`. Take into account that you might need to adjust a bit the paths of the `import` to adjust them to the new locations.
|
108
108
|
|
109
109
|
If that JS file is replacing a Decidim file, there is no need to add it to `decidim_application.js`
|
110
110
|
|
@@ -109,7 +109,7 @@ What you should do instead is to follow the asset compilation migration guide ab
|
|
109
109
|
|
110
110
|
base_path = File.expand_path("..", __dir__)
|
111
111
|
|
112
|
-
# Register the
|
112
|
+
# Register the additional path for Webpacker in order to make the module's
|
113
113
|
# stylesheets available for inclusion.
|
114
114
|
Decidim::Webpacker.register_path("#{base_path}/app/packs")
|
115
115
|
|
@@ -231,10 +231,10 @@ NOTE: When you bump the version, the generator tests will fail because the gems
|
|
231
231
|
.. Re-run the failed generators tests at the release branch.
|
232
232
|
.. Create a new release at this repository, just go to the https://github.com/decidim/decidim/releases[releases page] and create a new one.
|
233
233
|
. Update Decidim's Docker repository as explained in the Docker images section below.
|
234
|
-
. Update Crowdin synchronization configuration with
|
234
|
+
. Update Crowdin synchronization configuration with GitHub:
|
235
235
|
.. Add the new `release/x.y-stable` branch.
|
236
236
|
.. Remove from Crowdin branches that are not officially supported anymore.
|
237
|
-
That way they do not synchronize with
|
237
|
+
That way they do not synchronize with GitHub.
|
238
238
|
. Update the version in the documentation system that we use, Antora. For the https://github.com/decidim/decididm[decidim repository] this is done automatically when bumping the versions. For the https://github.com/decidim/documentation[documentation repository]:
|
239
239
|
... Create and push the branch in that repository: `git checkout release/0.XX-stable && git push origin release/x.y-stable`
|
240
240
|
... Add the new version on the https://github.com/decidim/documentation/blob/develop/antora-playbook.yml[antora-playbook.yml] `branches` key, for the both sources (decidim and documentation repository). Do not forget to also remove the oldest and change the new default in the `start_page` key. For instance for v0.28 this is how it'd look like:
|
@@ -267,8 +267,6 @@ index 31be47c..75c7d5e 100644
|
|
267
267
|
- release/0.27-stable
|
268
268
|
- - release/0.26-stable
|
269
269
|
- develop
|
270
|
-
- url: https://github.com/decidim/decidim-bulletin-board
|
271
|
-
start_path: docs
|
272
270
|
----
|
273
271
|
After you commit this change in `develop` branch you will have to wait a couple minutes for the automatic deployment to see it live at https://docs.decidim.org.
|
274
272
|
|
@@ -5,12 +5,12 @@
|
|
5
5
|
Decidim uses https://crowdin.com/[Crowdin] to manage the translations.
|
6
6
|
|
7
7
|
* Whenever someone https://github.com/decidim/decidim/pull/1814/files#diff-c78c80097da59920d55b3f462ca21afaR177[adds a new translation key] to _Decidim_, _Crowdin_ gets notified and the new content is available to be translated from https://crowdin.com/project/decidim[Crowdin's Decidim dashboard].
|
8
|
-
* When a translator translates any key from Crowdin, it automatically creates a https://github.com/decidim/decidim/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Adecidim-bot%20Crowdin[PR in
|
8
|
+
* When a translator translates any key from Crowdin, it automatically creates a https://github.com/decidim/decidim/pulls?utf8=%E2%9C%93&q=is%3Apr%20author%3Adecidim-bot%20Crowdin[PR in GitHub], adding the keys in the corresponding _yaml_ files.
|
9
9
|
* 🌈
|
10
10
|
|
11
11
|
== Adding a new language
|
12
12
|
|
13
|
-
* Setup the new language in https://crowdin.com/project/decidim[_Crowdin's Decidim project_] (or open an issue on
|
13
|
+
* Setup the new language in https://crowdin.com/project/decidim[_Crowdin's Decidim project_] (or open an issue on GitHub asking an admin to do that).
|
14
14
|
* Add the locale mapping in the `crowdin.yml` file
|
15
15
|
* Translate at least one key from every engine, so, your _yaml_ files are not empty. The easiest way to do this is to automatically translate and sync all the content. Later you will be able to fix the content that was not properly translated.
|
16
16
|
* Add the new language to `available_locales` (https://github.com/decidim/decidim/pull/1991[PR]).
|