decidim 0.21.0 → 0.22.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +1 -50
- data/docs/advanced/authorship.md +1 -2
- data/docs/advanced/components.md +40 -0
- data/docs/advanced/content_blocks.md +5 -3
- data/docs/advanced/data-picker.md +37 -9
- data/docs/advanced/embeddable.md +2 -1
- data/docs/advanced/endorsable.md +113 -0
- data/docs/advanced/how_to_fix_metrics.md +32 -19
- data/docs/advanced/metrics.md +7 -9
- data/docs/advanced/newsletter_templates.md +64 -0
- data/docs/advanced/notifications.md +114 -0
- data/docs/advanced/permissions.md +23 -0
- data/docs/advanced/releases.md +105 -0
- data/docs/advanced/testing.md +3 -0
- data/docs/customization/views.md +31 -2
- data/docs/development_guide.md +16 -43
- data/docs/getting_started.md +3 -2
- data/docs/manual-installation.md +4 -0
- data/docs/services/etherpad.md +1 -1
- data/docs/services/social_providers.md +33 -7
- data/lib/decidim/version.rb +1 -1
- metadata +47 -42
data/docs/advanced/metrics.md
CHANGED
@@ -37,6 +37,7 @@ Metrics calculations must be executed everyday. Some `rake task` have been added
|
|
37
37
|
```ruby
|
38
38
|
bundle exec rake decidim:metrics:list
|
39
39
|
```
|
40
|
+
|
40
41
|
Currently, available metrics are:
|
41
42
|
|
42
43
|
- **users**, created `Users`
|
@@ -78,20 +79,17 @@ persist metrics from all times and types.
|
|
78
79
|
The `decidim_metrics` table has the following fields:
|
79
80
|
|
80
81
|
- `day`: the day for which the metric has been computed.
|
81
|
-
- `metric_type`: the type of the metric. One of: users, proposals,
|
82
|
-
accepted_proposals, supports, assemblies.
|
82
|
+
- `metric_type`: the type of the metric. One of: users, proposals, accepted_proposals, supports, assemblies.
|
83
83
|
- `cumulative`: quantity accumulated to day ”day”.
|
84
84
|
- `quantity`: quantity for the current day, ”day”.
|
85
|
-
- `decidim_organization_id`: the FK to the organization to which this Metric
|
86
|
-
belongs to.
|
87
|
-
- `
|
88
|
-
participatory space to which this Metric belongs to, if any.
|
89
|
-
- `related_object_type` + `related_object_id`: the FK to the object to which
|
90
|
-
this Metric belongs to, if any.
|
85
|
+
- `decidim_organization_id`: the FK to the organization to which this Metric belongs to.
|
86
|
+
- `participatory_space_type` + `participatory_space_id`: the FK to the participatory space to which this Metric belongs to, if any.
|
87
|
+
- `related_object_type` + `related_object_id`: the FK to the object to which this Metric belongs to, if any.
|
91
88
|
- `decidim_category_id`: the FK to the category for this Metric, if any.
|
92
89
|
|
93
90
|
Relations around `decidim_metrics` table:
|
94
|
-
|
91
|
+
|
92
|
+
```ascii
|
95
93
|
+------------------------+
|
96
94
|
+--------------+ | ParticipatoryProcesses |
|
97
95
|
| Organization | +----+------------------------+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# Newsletter templates
|
2
|
+
|
3
|
+
The newsletter templates allow the user to select a template amongst a set of of them, and use it as base to send newsletters. This allow for more customization on newsletter, tematic newsletters, etc.
|
4
|
+
|
5
|
+
Code-wise, they use the content blocks system internally, so [check the docs](https://github.com/decidim/decidim/blob/master/docs/advanced/content_blocks.md) for that section first.
|
6
|
+
|
7
|
+
## Adding a new template
|
8
|
+
|
9
|
+
You'll first need to register the template as a content block, but specifying `:newsletter_template` as its scope:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
Decidim.content_blocks.register(:newsletter_template, :my_template) do |content_block|
|
13
|
+
content_block.cell "decidim/newsletter_templates/my_template"
|
14
|
+
content_block.settings_form_cell = "decidim/newsletter_templates/my_template_settings_form"
|
15
|
+
content_block.public_name_key "decidim.newsletter_templates.my_template.name"
|
16
|
+
|
17
|
+
content_block.images = [
|
18
|
+
{
|
19
|
+
name: :main_image,
|
20
|
+
uploader: "Decidim::NewsletterTemplateImageUploader",
|
21
|
+
preview: -> { ActionController::Base.helpers.asset_path("decidim/placeholder.jpg") }
|
22
|
+
}
|
23
|
+
]
|
24
|
+
|
25
|
+
content_block.settings do |settings|
|
26
|
+
settings.attribute(
|
27
|
+
:body,
|
28
|
+
type: :text,
|
29
|
+
translated: true,
|
30
|
+
preview: -> { ([I18n.t("decidim.newsletter_templates.my_template.body_preview")] * 100).join(" ") }
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
```
|
35
|
+
|
36
|
+
You'll need to add this into an initializer. Note that if you're adding this from a module, then you need to add it from the `engine.rb` file (check the docs for content blocks for more info).
|
37
|
+
|
38
|
+
This is the simplest template. It has a single attribute, in this case a translatable chunk of text. Let's go line by line.
|
39
|
+
|
40
|
+
Inside the block, first we define the path of the cell we'll use to render the email publicly. This cell will receive the `Decidim::ContentBlock` object, which will contain the attributes and any image we have (one in this example). In order to render cells, please note that emails have a very picky HTML syntax, so we suggest using some specialized tools to design the template, export the layout to HTML and render that through the cell. We suggest you make this cell inherit from `Decidim::NewsletterTemplates::BaseCell` for convenience.
|
41
|
+
|
42
|
+
Then we define the cell that will be used to render the form in the admin section. This form needs to show inputs for the attributes defined when registering the template. It will receive the `form` object to render the input fields. We suggest this cell to inherit from `Decidim::NewsletterTemplates::BaseSettingsFormCell`.
|
43
|
+
|
44
|
+
In the third line inside the block we define the I18n path to the public name of the template. This name will serve as identifier for the users who write the newsletters, so be sure to make it descriptive.
|
45
|
+
|
46
|
+
After that we define the images this newsletter supports. We give it a unique name, the class name of the uploader we'll use (the example one is the default one, but you might want to customize this value) and a way to preview this image. This preview image will only be used in the "Preview" page of the template, it's not a fallback. If you want a fallback, please implement it through a custom uploader (see `carrierwave`'s docs for that). There's no limit of the amount of images you add.
|
47
|
+
|
48
|
+
Finally, we define the attributes for the newsletter. In this case we define a body attribute, which is a translatable text. Whether this text require an editor or not will be defined by the settings cell. We also have a way to preview that attribute. There's no limit on the number of attributes you define.
|
49
|
+
|
50
|
+
## Interpolating the recipient name
|
51
|
+
|
52
|
+
Decidim accepts `%{name}` as a placeholder for the recipient name. If you want your template to use it, you'll need to call `parse_interpolations` in your public cell:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
class Decidim::NewsletterTemplates::MyTemplate < Decidim::ViewModel
|
56
|
+
include Decidim::NewslettersHelper
|
57
|
+
|
58
|
+
def body
|
59
|
+
parse_interpolations(uninterpolated_body, recipient_user, newsletter.id)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
```
|
63
|
+
|
64
|
+
The newsletter subject is automatically interpolated.
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# Notifications
|
2
|
+
|
3
|
+
In Decidim, notifications may mean two things:
|
4
|
+
|
5
|
+
- he concept of notifying an event to a user. This is the wider use of "notification".
|
6
|
+
- the notification's participant space, which lists the `Decidim::Notification`s she has received.
|
7
|
+
|
8
|
+
So, in the wider sense, notifications are messages that are sent to the users, admins or participants, when something interesting occurs in the platform.
|
9
|
+
|
10
|
+
Each notification is sent via two communication channels: email and internal notifications.
|
11
|
+
|
12
|
+
## A Decidim Event
|
13
|
+
|
14
|
+
Technically, a Decidim event is nothing but an `ActiveSupport::Notification` with a payload of the form
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
ActiveSupport::Notifications.publish(
|
18
|
+
event,
|
19
|
+
event_class: event_class.name,
|
20
|
+
resource: resource,
|
21
|
+
affected_users: affected_users.uniq.compact,
|
22
|
+
followers: followers.uniq.compact,
|
23
|
+
extra: extra
|
24
|
+
)
|
25
|
+
```
|
26
|
+
|
27
|
+
To publish an event to send a notification, Decidim's `EventManager` should be used:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
# Note the convention between the `event` key, and the `event_class` that will be used later to wrap the payload and be used as the email or notification model.
|
31
|
+
data = {
|
32
|
+
event: "decidim.events.comments.comment_created",
|
33
|
+
event_class: Decidim::Comments::CommentCreatedEvent,
|
34
|
+
resource: comment.root_commentable,
|
35
|
+
extra: {
|
36
|
+
comment_id: comment.id
|
37
|
+
},
|
38
|
+
affected_users: [user1, user2],
|
39
|
+
followers: [user3, user4]
|
40
|
+
}
|
41
|
+
|
42
|
+
Decidim::EventsManager.publish(data)
|
43
|
+
```
|
44
|
+
|
45
|
+
Both, `EmailNotificationGenerator` and `NotificationGenerator` are use the same arguments:
|
46
|
+
|
47
|
+
- **event**: A String with the name of the event.
|
48
|
+
- **event_class**: A class that wraps the event.
|
49
|
+
- **resource**: an instance of a class implementing the `Decidim::Resource` concern.
|
50
|
+
- **followers**: a collection of Users that receive the notification because they're following it.
|
51
|
+
- **affected_users**: a collection of Users that receive the notification because they're affected by it.
|
52
|
+
- **force_send**: boolean indicating if EventPublisherJob should skip the `notifiable?` check it performs before notifying.
|
53
|
+
- **extra**: a Hash with extra information to be included in the notification.
|
54
|
+
|
55
|
+
Again, both generators will check for each user
|
56
|
+
|
57
|
+
- in the *followers* array, if she has the `notification_types` set to "all" or "followed-only".
|
58
|
+
- in the *affected_users* array, if she has the `notification_types` set to "all" or "own-only".
|
59
|
+
|
60
|
+
Event names must start with "decidim.events." (the `event` data key). This way `Decidim::EventPublisherJob` will automatically process them. Otherwise no artifact in Decidim will process them, and will be the developer's responsibility to subscribe to them and process.
|
61
|
+
|
62
|
+
Sometimes, when something that must be notified to users happen, a service is defined to manage the logic involved to decide which events should be published. See for example `Decidim::Comments::NewCommentNotificationCreator`.
|
63
|
+
|
64
|
+
Please refer to [Ruby on Rails Notifications documentation](https://api.rubyonrails.org/classes/ActiveSupport/Notifications.html) if you need to hack the Decidim's events system.
|
65
|
+
|
66
|
+
## How Decidim's `EventPublisherJob` processes the events?
|
67
|
+
|
68
|
+
The `EventPublisherJob` in Decidim's core engine subscribes to all notifications matching the regular expression `/^decidim\.events\./`. This is, starting with "decidim.events.". It will then be invoked when an imaginary event named "decidim.events.harmonica_blues" is published.
|
69
|
+
|
70
|
+
When invoked it simply performs some validations and enqueue an `EmailNotificationGeneratorJob` and a `NotificationGeneratorJob`.
|
71
|
+
|
72
|
+
The validations it performs check if the resource, the component, or the participatory space are published (when the concept applies to the artifact).
|
73
|
+
|
74
|
+
## The \*Event class
|
75
|
+
|
76
|
+
Generates the email and notification messages from the information related with the notification.
|
77
|
+
|
78
|
+
Event classes are subclasses of `Decidim::Events::SimpleEvent`.
|
79
|
+
A subset of the payload of the notification is passed to the event class's constructor:
|
80
|
+
|
81
|
+
- The `resource`
|
82
|
+
- The `event` name
|
83
|
+
- The notified user, either from the `followers` or from the `affected_users` arrays
|
84
|
+
- The `extra` hash, with content specific for the given SimpleEvent subclass
|
85
|
+
- The user_role, either :follower or :affected_user
|
86
|
+
|
87
|
+
With the previous information the event class is able to generate the following contents.
|
88
|
+
|
89
|
+
Developers will be able to customize those messages by adding translations to the `config/locales/en.yml` file of the corresponding module.
|
90
|
+
The keys to be used will have the translation scope corresponding to the event name ("decidim.events.comments.comment_by_followed_user" for example) and the key will be the content to override (email_subject, email_intro, etc.)
|
91
|
+
|
92
|
+
### Email contents
|
93
|
+
|
94
|
+
The following are the parts of the notification email:
|
95
|
+
|
96
|
+
- *email_subject*, to be customized
|
97
|
+
- email_greeting, with a good default, usually there's no need to cusomize it
|
98
|
+
- *email_intro*, to be customized
|
99
|
+
- *resource_text* (optional), rendered `html_safe` if present
|
100
|
+
- *resource_url*, a link to the involved resource if resource_url and resource_title are present
|
101
|
+
- *email_outro*
|
102
|
+
|
103
|
+
All contents except the `email_greeting` use to require customization on each notification.
|
104
|
+
|
105
|
+
### Notification contents
|
106
|
+
|
107
|
+
Only the `notification_title` is generated in the event class. The rest of the contents are produced by the templates from the `resource` and the `notification` objects.
|
108
|
+
|
109
|
+
## Testing notifications
|
110
|
+
|
111
|
+
- Test that the event has been published (usually a command test)
|
112
|
+
- Test the event returns the expected contents for the email and the notification.
|
113
|
+
|
114
|
+
Developers should we aware when adding URLs in the email's content, be sure to use absolute URLs and not relative paths.
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Permissions
|
2
|
+
|
3
|
+
Since Decidim has multiple roles, we needed a permissions system to discover what actions can a user perform, given their roles. The basis of the current permissions system were added on [\#3029](https://github.com/decidim/decidim/pull/3029), so be sure to check that PR (and the related ones) to read the discussion and the motivations behind the change.
|
4
|
+
|
5
|
+
## Overview
|
6
|
+
|
7
|
+
When checking for permission to perform an action, we check this chain:
|
8
|
+
|
9
|
+
1. The component permissions
|
10
|
+
1. The participatory space permissions
|
11
|
+
1. The core permissions
|
12
|
+
|
13
|
+
This way we're going from more specific to more general.
|
14
|
+
|
15
|
+
## Explanation
|
16
|
+
|
17
|
+
We wrap the permission and its context in a `PermissionsAction` object. It also holds the state of the permission (whether it's been allowed or not).
|
18
|
+
|
19
|
+
Each component and space must define a `Permissions` class, inheriting from `Decidim::DefaultPermissions`. The `Permissions` class must define a `permissions` instance method. this class will receive the permission action, and the `permissions` method must return the permission action. The `Permissions` class can set the action as allowed or disallowed.
|
20
|
+
|
21
|
+
There's a small limitation in the permission action state machine: once it's been disallowed it can't be reallowed. This is to avoid mischievous modules modifying permissions.
|
22
|
+
|
23
|
+
Permission actions have a scope. It's usually either `:public` or `:admin`, and the `Permissions` class usually handles the `:public` scope, while it delegates the `:admin` one to another specialized class.
|
@@ -0,0 +1,105 @@
|
|
1
|
+
# Releasing new versions
|
2
|
+
|
3
|
+
In order to release new version you need to be owner of all the gems at RubyGems, ask one of the owners to add you before releasing. (Try `gem owner decidim`).
|
4
|
+
|
5
|
+
Remember to follow the Gitflow branching workflow.
|
6
|
+
|
7
|
+
## Create the release branch
|
8
|
+
|
9
|
+
1. Go to develop with `git checkout develop`
|
10
|
+
1. Create the release branch `git checkout -b release/x.y.z && git push origin release/x.y.z`, where release/x.y.z is the Gitflow release branch for this version.
|
11
|
+
1. If required, add the release branch to Crowdin so that any pending translations will generate a PR to this branch.
|
12
|
+
|
13
|
+
Mark `develop` as the reference to the next release:
|
14
|
+
|
15
|
+
1. Go back to develop with `git checkout develop`
|
16
|
+
1. Turn develop into the `dev` branch for the next release:
|
17
|
+
1. Update `.decidim-version` to the new `dev` development version: `x.y.z.dev`, where `x.y.z` is the new semver number for the next version
|
18
|
+
1. Run `bin/rake update_versions`, this will update all references to the new version.
|
19
|
+
1. Run `bin/rake bundle`, this will update all the `Gemfile.lock` files
|
20
|
+
1. Run `bin/rake webpack`, this will update the JavaScript bundle.
|
21
|
+
1. Update `SECURITY.md` and change the supported version to the new version.
|
22
|
+
1. Update the `CHANGELOG.MD`. At the top you should have an `Unreleased` header with the `Added`, `Changed`, `Fixed` and `Removed` empty sections. After that, the header with the current version and link with the same beforementioned sections and a `Previous versions` header at the bottom that links to the previous minor release stable branch.
|
23
|
+
|
24
|
+
```markdown
|
25
|
+
## [Unreleased](https://github.com/decidim/decidim/tree/HEAD)
|
26
|
+
|
27
|
+
### Added
|
28
|
+
|
29
|
+
### Changed
|
30
|
+
|
31
|
+
### Fixed
|
32
|
+
|
33
|
+
### Removed
|
34
|
+
|
35
|
+
## [v0.XX.0](https://github.com/decidim/decidim/releases/tag/v0.XX.0)
|
36
|
+
|
37
|
+
### Added
|
38
|
+
...
|
39
|
+
|
40
|
+
## Previous versions
|
41
|
+
|
42
|
+
Please check [0.XX-stable](https://github.com/decidim/decidim/blob/0.XX-stable/CHANGELOG.md) for previous changes.
|
43
|
+
```
|
44
|
+
|
45
|
+
1. Push the changes `git add . && git commit -m "Bump develop to next release version" && git push origin develop`
|
46
|
+
|
47
|
+
## Release Candidates
|
48
|
+
|
49
|
+
Release Candidates are the same as beta versions. They should be ready to go to production, but publicly released just before in order to be widely tested.
|
50
|
+
|
51
|
+
If this is a **Release Candidate version** release, the steps to follow are:
|
52
|
+
|
53
|
+
1. Go to the release branch `git checkout release/x.y.z`.
|
54
|
+
1. Update `.decidim-version` to the new version `x.y.z.rc1`
|
55
|
+
1. Run `bin/rake update_versions`, this will update all references to the new version.
|
56
|
+
1. Run `bin/rake bundle`, this will update all the `Gemfile.lock` files
|
57
|
+
1. Run `bin/rake webpack`, this will update the JavaScript bundle.
|
58
|
+
1. Commit all the changes: `git add . && git commit -m "Bump to rcXX version" && git push origin release/x.y.z`.
|
59
|
+
1. Follow the link resulting from the previous command to create the PR for the new version. The base branch of the PR must be `master`.
|
60
|
+
1. Usually, at this point, the release branch is deployed to meta-decidim during, at least, one week to validate the stability of the version.
|
61
|
+
|
62
|
+
### During the validation period
|
63
|
+
|
64
|
+
1. During the validation period bugfixes will go directly to the current `release/x.y.z` branch and ported to `develop`.
|
65
|
+
1. During the validation period, translations to the officially supported languages must be added to Crowdin and when done, merged into `release/x.y.z`.
|
66
|
+
|
67
|
+
### Major/Minor versions
|
68
|
+
|
69
|
+
Release Candidates will be tested in a production server (usually meta-decidim) during some period of time (a week at least), when they are considered ready, it is time for them to be merged into `master`:
|
70
|
+
|
71
|
+
1. Go to the release branch `git checkout release/x.y.z`.
|
72
|
+
1. Update `.decidim-version` by removing the `.rcN` suffix, leaving a clean version number like `x.y.z`
|
73
|
+
1. Run `bin/rake update_versions`, this will update all references to the new version.
|
74
|
+
1. Run `bin/rake bundle`, this will update all the `Gemfile.lock` files
|
75
|
+
1. Run `bin/rake webpack`, this will update the JavaScript bundle.
|
76
|
+
1. Commit all the changes: `git add . && git commit -m "Bump to v0.XX.0 final version" && git push origin release/x.y.z`.
|
77
|
+
1. Follow the link resulting from the previous command to create the PR for the new version in case it has not been created already, but still don't merge it. The base for the PR should be `master`.
|
78
|
+
1. Before merging the PR to upgrade `master`, check that the stable branch for the previous version exists. For instance, if we are going to release v0.22.0, there should be a `0.21-stable` branch in the repository. If such branch does not exists, it has to be created now, before merging the new release. So, if this is the release of v0.22.0, branch `0.21-stable` from `master`. These stable branches will be able to receive bugfixes, backports and will be the origin of patch releases for older releases.
|
79
|
+
1. Merge (after proper peer review) the PR to `master` and remove `release/x.y.z` branch.
|
80
|
+
1. Run `git checkout master && bin/rake release_all`, this will create all the tags, push the commits and tags and release the gems to RubyGems.
|
81
|
+
1. Once all the gems are published you should create a new release at this repository, just go to the [releases page](https://github.com/decidim/decidim/releases) and create a new one.
|
82
|
+
1. Create the stable branch for the current version. From `master`: `git checkout -b x.y-stable && git push origin x.y-stable`.
|
83
|
+
1. Update Decidim's Docker repository as explained in the Docker images section below.
|
84
|
+
1. Update Crowdin synchronization configuration with Github:
|
85
|
+
1. Add the new `x.y-stable` branch.
|
86
|
+
1. Remove from Crowdin branches that are not officially supported anymore. That way they don't synchronize with Github.
|
87
|
+
|
88
|
+
### Releasing patch versions
|
89
|
+
|
90
|
+
Releasing new versions from an ***x.y-stable*** branch is quite easy. The process is very similar from releasing a new Decidim version:
|
91
|
+
|
92
|
+
1. Checkout the branch you want to release: `git checkout -b VERSION-stable`
|
93
|
+
1. Update `.decidim-version` to the new version number.
|
94
|
+
1. Run `bin/rake update_versions`, this will update all references to the new version.
|
95
|
+
1. Run `bin/rake bundle`, this will update all the `Gemfile.lock` files
|
96
|
+
1. Run `bin/rake webpack`, this will update the JavaScript bundle.
|
97
|
+
1. Update `CHANGELOG.MD`. At the top you should have an `Unreleased` header with the `Added`, `Changed`, `Fixed` and `Removed` empty sections. After that, the header with the current version and link like `## [0.20.0](https://github.com/decidim/decidim/tree/v0.20.0)` and again the headers for the `Added`, `Changed`, `Fixed` and `Removed` sections.
|
98
|
+
1. Commit all the changes: `git add . && git commit -m "Prepare VERSION release"`
|
99
|
+
1. Run `bin/rake release_all`, this will create all the tags, push the commits and tags and release the gems to RubyGems.
|
100
|
+
1. Once all the gems are published you should create a new release at this repository, just go to the [releases page](https://github.com/decidim/decidim/releases) and create a new one.
|
101
|
+
1. Update Decidim's Docker repository as explained in the Docker images section.
|
102
|
+
|
103
|
+
### Docker images for each release
|
104
|
+
|
105
|
+
1. After each release, you should update our [Docker repository](https://github.com/decidim/docker) so new images are build for the new release. To do it, just update `DECIDIM_VERSION` at [circle.yml](https://github.com/decidim/docker/blob/master/circle.yml).
|
data/docs/advanced/testing.md
CHANGED
@@ -11,11 +11,14 @@ bundle exec rake test_app
|
|
11
11
|
## Running a specific test file or just a single spec
|
12
12
|
|
13
13
|
If you are writing new specs, you can run the tests contained in a single file by opening a console window in the corresponding module and calling `rspec`on the file. For example:
|
14
|
+
|
14
15
|
```bash
|
15
16
|
cd decidim-participatory_processes
|
16
17
|
bundle exec rspec spec/forms/participatory_process_form_spec.rb
|
17
18
|
```
|
19
|
+
|
18
20
|
You can also run a single test by appending its start line number to the command:
|
21
|
+
|
19
22
|
```bash
|
20
23
|
bundle exec rspec spec/forms/participatory_process_form_spec.rb:134
|
21
24
|
```
|
data/docs/customization/views.md
CHANGED
@@ -1,5 +1,34 @@
|
|
1
1
|
# Views (HTML)
|
2
2
|
|
3
|
-
|
3
|
+
As usual you should make some tests with the changes that you made and configure a Continuous Integration environment for checking that your overrides doesn't get removed with new decidim versions.
|
4
4
|
|
5
|
-
|
5
|
+
## Overrides
|
6
|
+
|
7
|
+
To find what you need to change you'll need to make some detective work to find out which partial or view do you need to change. You can do so by:
|
8
|
+
|
9
|
+
- looking at your application log and finding the lines that start with "Rendered"
|
10
|
+
- inspecting with the web development tools of your browser, copying a special class and using `grep`, github search or your IDE search by multiple files to find out on which file this exists.
|
11
|
+
|
12
|
+
### Filename method
|
13
|
+
|
14
|
+
If you want to override a view or partial given by Decidim you can do this just by naming it with the same filename that you already have. On more details, if you want to change the social media icons on the footer, you can do so by looking at which file you need to change, copying that file to your application with the same filename and directory structure, and making your local changes.
|
15
|
+
|
16
|
+
As an example, if I want to change the footer, you'd need to search for the file (on this case, it's on [`decidim-core/app/views/layouts/decidim/_mini_footer.html.erb`](https://github.com/decidim/decidim/blob/e181d7e67bdf915a3a8e58416c683f52346de047/decidim-core/app/views/layouts/decidim/_mini_footer.html.erb)), and copy that file to your own application on `app/views/layouts/decidim/_mini_footer.html.erb`).
|
17
|
+
|
18
|
+
## Deface method
|
19
|
+
|
20
|
+
You'll need the [`deface` gem](https://github.com/spree/deface) installed on your application, and follow their instructions on how to use the different overridign methods that they support.
|
21
|
+
|
22
|
+
As an example, if you want to change the footer, you can do so by creating the file `app/overrides/layouts/decidim/_main_footer/pre_footer.html.erb.deface` with these contents:
|
23
|
+
|
24
|
+
```html
|
25
|
+
<!-- insert_before ".main-footer" -->
|
26
|
+
hello world
|
27
|
+
```
|
28
|
+
|
29
|
+
## New pages
|
30
|
+
|
31
|
+
If you want to add a new HTML page, you can do this by working as a regular Rails application (ie, you can scaffold a new view and work with the HTML as usual).
|
32
|
+
|
33
|
+
As an example of how to do this on Decidim Barcelona application, there's the [StaticController](
|
34
|
+
https://github.com/AjuntamentdeBarcelona/decidim-barcelona/blob/d47d4a9ae6be26a0c5c4000907dda3c195579636/app/controllers/static_controller.rb) (main accountability section pages). You should inherit your controller from Decidim::ApplicationController.
|
data/docs/development_guide.md
CHANGED
@@ -50,6 +50,18 @@ git checkout -b feature/xxx
|
|
50
50
|
|
51
51
|
Implement the feature, and open a Pull Request as normal, but against `develop` branch. As this is the most common operation, `develop` is the default branch instead of `master`.
|
52
52
|
|
53
|
+
## Git commit messages and Pull Request titles
|
54
|
+
|
55
|
+
We recommend following [this guide](https://chris.beams.io/posts/git-commit/) for making good git commit messages. It also applies to Pull Request titles. The summary is:
|
56
|
+
|
57
|
+
1. Separate subject from body with a blank line
|
58
|
+
1. Limit the subject line to 50 characters
|
59
|
+
1. Capitalize the subject line
|
60
|
+
1. Do not end the subject line with a period
|
61
|
+
1. Use the imperative mood in the subject line
|
62
|
+
1. Wrap the body at 72 characters
|
63
|
+
1. Use the body to explain what and why vs. how
|
64
|
+
|
53
65
|
## During development
|
54
66
|
|
55
67
|
When creating new migrations in Decidim's modules, you will need to "apply" this migrations to your development_app. The way to do this is by copying the migration from your module into the db/migrate dir of your development_app. Luckily we already have a script that automates this: it copies all missing migrations in development_app/db/migrate. The command is:
|
@@ -85,11 +97,12 @@ bundle exec i18n-tasks normalize --locales en
|
|
85
97
|
|
86
98
|
### JavaScript linter
|
87
99
|
|
88
|
-
|
100
|
+
[eslint](https://eslint.org/docs/user-guide/command-line-interface) and [tslint](https://palantir.github.io/tslint/) are used to ensure homogeneous formatting of JavaScript code.
|
101
|
+
|
102
|
+
To lint and try to fix linting errors, run:
|
89
103
|
|
90
104
|
```console
|
91
|
-
|
92
|
-
yarn run lint --fix
|
105
|
+
npm run lint --fix
|
93
106
|
```
|
94
107
|
|
95
108
|
### Stylelinter
|
@@ -134,43 +147,3 @@ This project uses [markdownlint](https://github.com/markdownlint/markdownlint) t
|
|
134
147
|
## Testing
|
135
148
|
|
136
149
|
Refer to the [testing](advanced/testing.md) guide.
|
137
|
-
|
138
|
-
## Releasing new versions
|
139
|
-
|
140
|
-
In order to release new version you need to be owner of all the gems at RubyGems, ask one of the owners to add you before releasing. (Try `gem owners decidim`).
|
141
|
-
|
142
|
-
Releasing new ***patch versions*** is quite easy, it's the same process whether it's a new version or a patch:
|
143
|
-
|
144
|
-
1. Checkout the branch you want to release: `git checkout -b VERSION-stable`
|
145
|
-
1. Update `.decidim-version` to the new version number.
|
146
|
-
1. Run `bin/rake update_versions`, this will update all references to the new version.
|
147
|
-
1. Run `bin/rake bundle`, this will update all the `Gemfile.lock` files
|
148
|
-
1. Run `bin/rake webpack`, this will update the JavaScript bundle.
|
149
|
-
1. Update `CHANGELOG.MD`. At the top you should have an `Unreleased` header with the `Added`, `Changed`, `Fixed` and `Removed` empty section. After that, the header with the current version and link.
|
150
|
-
1. Commit all the changes: `git add . && git commit -m "Prepare VERSION release"`
|
151
|
-
1. Run `bin/rake release_all`, this will create all the tags, push the commits and tags and release the gems to RubyGems.
|
152
|
-
1. Once all the gems are published you should create a new release at this repository, just go to the [releases page](https://github.com/decidim/decidim/releases) and create a new one.
|
153
|
-
1. Finally, you should update our [Docker repository](https://github.com/decidim/docker) so new images are build for the new release. To do it, just update `DECIDIM_VERSION` at [circle.yml](https://github.com/decidim/docker/blob/master/circle.yml).
|
154
|
-
|
155
|
-
If this was a **major version** release:
|
156
|
-
|
157
|
-
1. Go back to master with `git checkout master`
|
158
|
-
1. Update `.decidim-version` to the new major development version
|
159
|
-
1. Run `bin/rake update_versions`, this will update all references to the new version.
|
160
|
-
1. Run `bin/rake bundle`, this will update all the `Gemfile.lock` files
|
161
|
-
1. Run `bin/rake webpack`, this will update the JavaScript bundle.
|
162
|
-
1. Update `SECURITY.md` and change the supported version to the new version.
|
163
|
-
1. Commit all the changes: `git add . && git commit -m "Bump version" && git push origin master`
|
164
|
-
1. Run `bin/rake release_all`, this will create all the tags, push the commits and tags and release the gems to RubyGems.
|
165
|
-
1. Once all the gems are published you should create a new release at this repository, just go to the [releases page](https://github.com/decidim/decidim/releases) and create a new one.
|
166
|
-
1. Finally, you should update our [Docker repository](https://github.com/decidim/docker) so new images are build for the new release. To do it, just update `DECIDIM_VERSION` at [circle.yml](https://github.com/decidim/docker/blob/master/circle.yml) and create the sibling branch at the Docker repository. NOTE: You should also take into account if the Ruby version has changed, in which case the Dockerfile should also be updated.
|
167
|
-
|
168
|
-
To branch the stable version and let master be the new devel branch again:
|
169
|
-
|
170
|
-
1. Create and push the stable branch from master: `git checkout master && git checkout -b VERSION-stable && git push origin VERSION-stable`
|
171
|
-
1. Update the `CHANGELOG.MD`. At the top you should have an `Unreleased` header with the `Added`, `Changed`, `Fixed` and `Removed` empty section. After that, the header with the current version and link.
|
172
|
-
1. Turn master into the dev branch for the next release:
|
173
|
-
1. Update `.decidim-version` to the new `dev` development version: x.y.z-dev
|
174
|
-
1. Run `bin/rake update_versions`, this will update all references to the new version.
|
175
|
-
1. Run `bin/rake bundle`, this will update all the `Gemfile.lock` files
|
176
|
-
1. Run `bin/rake webpack`, this will update the JavaScript bundle.
|