Sha256: 3359b192b06ce6d9272fe03ab2e912b73b9b2cf64325c39631fa5fb902d38442

Contents?: true

Size: 773 Bytes

Versions: 36

Compression:

Stored size: 773 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    module Admin
      # A form object used to create assembly user roles from the admin dashboard.
      #
      class AssemblyUserRoleForm < Form
        mimic :assembly_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::AssemblyUserRole::ROLES }

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

Version data entries

36 entries across 36 versions & 1 rubygems

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