Sha256: 32bb336cc635422ae7570ceed580e776e9f3a3ef67780faee7d0b6655f4d876c

Contents?: true

Size: 868 Bytes

Versions: 64

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcesses
    module Admin
      # A form object used to create participatory process user roles from the
      # admin dashboard.
      #
      class ParticipatoryProcessUserRoleForm < Form
        mimic :participatory_process_user_role

        attribute :name, String
        attribute :email, String
        attribute :role, String

        validates :email, :role, presence: true
        validates :name, presence: true
        validates :role, inclusion: { in: Decidim::ParticipatoryProcessUserRole::ROLES }

        def roles
          Decidim::ParticipatoryProcessUserRole::ROLES.map do |role|
            [
              I18n.t(role, scope: "decidim.admin.models.participatory_process_user_role.roles"),
              role
            ]
          end
        end
      end
    end
  end
end

Version data entries

64 entries across 64 versions & 2 rubygems

Version Path
decidim-participatory_processes-0.22.0 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.21.0 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.20.1 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.20.0 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.19.1 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.18.1 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.19.0 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.17.2 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.18.0 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.17.1 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.16.1 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.17.0 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.16.0 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.15.2 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.15.1 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.15.0 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.14.4 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.14.3 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.14.2 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb
decidim-participatory_processes-0.14.1 app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb