https://github.com/populatetools/decidim-module-extra_user_fields
Add dynamic custom fields to users
https://github.com/populatetools/decidim-module-extra_user_fields
decidim ruby rubygem rubyonrails
Last synced: about 2 months ago
JSON representation
Add dynamic custom fields to users
- Host: GitHub
- URL: https://github.com/populatetools/decidim-module-extra_user_fields
- Owner: PopulateTools
- License: agpl-3.0
- Created: 2020-11-12T14:49:28.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-08T17:11:25.000Z (11 months ago)
- Last Synced: 2024-07-08T21:45:29.758Z (11 months ago)
- Topics: decidim, ruby, rubygem, rubyonrails
- Language: Ruby
- Homepage: https://decidim.org
- Size: 1010 KB
- Stars: 3
- Watchers: 5
- Forks: 13
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE-AGPLv3.txt
Awesome Lists containing this project
README
# Decidim::ExtraUserFields
This module allows administrators to define a set of extra fields for users. The fields are configurable in the admin panel of the organization. When enabled, they are shown in the user profile and in the registration form.
Supported extra fields for users:
* Country
* Date of birth
* Gender
* Location
* Phone number
* Postal codeThis module also enables an Export action in the participants admin panel, which allows to download a list of participants in CSV, JSON or Excel.
## Installation
Pick the version of the gem that matches your Decidim version.
For Decidim 0.27:
```ruby
gem "decidim-extra_user_fields", git: "https://github.com/PopulateTools/decidim-module-extra_user_fields.git", branch: "release/0.27-stable"
```For Decidim 0.26:
```ruby
gem "decidim-extra_user_fields", git: "https://github.com/PopulateTools/decidim-module-extra_user_fields.git", branch: "release/0.26-stable"
```For Decidim 0.25:
```ruby
gem "decidim-extra_user_fields", git: "https://github.com/PopulateTools/decidim-module-extra_user_fields.git", branch: "release/0.25-stable"
```For Decidim 0.24:
```ruby
gem "decidim-extra_user_fields", git: "https://github.com/PopulateTools/decidim-module-extra_user_fields.git", branch: "release/0.24-stable"
```And then execute:
```bash
bundle install
# For versions >= 0.27
bundle exec rake railties:install:migrations
bundle exec rake db:migrate
```## Usage
### Admin setup
After installing the gem and migrating the database, you can enable the extra fields in the admin panel of the organization. Go to Settings > Manage extra user fields. There you can enable the fields you want to use. By default all fields are required and don't include any format validation.

Most of the fields are plain text inputs, but other have a special format:
* Date of birth displays a date picker
* Country displays a country list dropdown### User signup and profile
Once the fields are enabled, they will be shown in the user signup form and in the user profile.


### Admin users export
An extra feature of this plugin is to enable an Export action in the participants admin panel. This action allows to download a list of participants in CSV, JSON or Excel. The fields included in the export are the Decidim User attributes plus the extra fields enabled in the admin panel.

## Contributing
This module follows the regular git workflow:
* Fork the project from master branch
* Create a feature branch
* Commit your changes
* Open a pull request
* Wait for a review and check that the CI is greenWe'll merge the PR ASAP and release a new version of the gem.
### Adding a new field to the module
You can find the development guidelines for adding a new field in this module in the docs/create_new_field.md file.
### Contribute to Decidim
See [Decidim](https://github.com/decidim/decidim).
## Roadmap
Some of the features we would like to add to this module:
* custom validations for the fields
* enable/disable the mandatory flag for each field
* find a way to add the fields to the user export without having to modify this module## License
This engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.