Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

decidim-user_fields

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

decidim-user_fields

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Decidim - Octree: Participatory Democracy on a Robust and Open Source Solution

Octree | Contact Us | Our Blog (FR)

Decidim | Decidim Docs | Participatory Governance (Meta Decidim)

Decidim Community (Matrix+Element.io)

Participe Gland — Give Life to Your Ideas with the Participatory Budget MKUTANO is a participatory platform where Black Canadians can effectively & democratically organize at scale Voca – Open-Source SaaS Platform for Decidim

Decidim User Fields

Add custom user fields through a configuration file and without migration. This module aims to configure in a blast new fields for subscription and profile editing. It supports:

  • User registration
  • User profiles
  • User invitations

⚠️ It does not support:

  • Omniauth registrations

Set up the module

Add the gem to your Gemfile

gem "decidim-user_fields"

Run bundle

bundle install

Create an initializer config/initializers/custom_user_fields.rb

Decidim::CustomUserFields.configure do |config|
  config.add_field :birthdate, type: :date, required: true
  config.add_field :province, type: :select, options: [:vd, :vs, :ar], default: :vd, required: true
  config.add_field :address, type: :textarea, required: false, rows: 10
  config.add_field :purpose, type: :text, required: false
end

Available field types

:date

parameters:

  • required: must choose a date
  • min: date in ISO8601 where the user cannot select before
  • max: date in ISO8601 where the user cannot select after

:textarea

parameters:

  • required: if the field is required
  • min: minimal length
  • max: maximal length
  • rows: how many rows the field should display

:text

parameters:

  • required: if the field is required

Labels

Labels are translated and are under the translation scope decidim.custom_user_fields. Example of a fr.yml file:

fr:
  activemodel:
    attributes:
      user:
        birthday: "Birthday"
        address: "Address"
        purpose: "Reason for Being Here"
        province: "Canton"
  decidim:
    custom_user_fields:
      province:
        options:
          vd: "Vaud"
          vs: "Valais"
          ar: "Aarau"

Run locally

To run this module locally, we use Docker-compose:

docker-compose up

This will run a decidim-user_fields container, which sleeps. You can run any command you want in the running container, like:

CommandDescription
docker-compose exec -it decidim-user_fields bundle exec rails db:seedSeed the database (run on localhost:3000)
docker-compose exec -it decidim-user_fields bin/webpack-dev-serverCompile assets and watch for changes
docker-compose exec -it decidim-user_fields bin/rails s -b 0.0.0.0Run the Rails server in development
docker-compose exec -it decidim-user_fields bundle exec rspec /home/decidim/module/specRun tests for the module
docker-compose exec -it decidim-user_fields bundle exec rubocop -a /home/decidim/moduleCorrect lint errors with RuboCop
docker-compose exec -it decidim-user_fields bashNavigate your container in bash

While developing locally, you have two environment variables that can help you:

  • ROOT: the root of the application using the module
  • MODULE_ROOT: the place where your gem code is.

FAQs

Package last updated on 22 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc