Sha256: 7afede470f19f786a866031675118456b4be215b2c254c850fc432b13ac8c503

Contents?: true

Size: 591 Bytes

Versions: 9

Compression:

Stored size: 591 Bytes

Contents

# frozen_string_literal: true

module Archangel
  ##
  # Role select custom input for SimpleForm
  #
  class RoleInput < SimpleForm::Inputs::CollectionSelectInput
    ##
    # Do not include blank select option
    #
    # @return [Boolean] to skip blank select option
    #
    def skip_include_blank?
      true
    end

    protected

    def collection
      @collection ||= resource_options
    end

    def resource_options
      [].tap do |option|
        Archangel::ROLES.each do |role|
          option << [Archangel.t("role.#{role}"), role]
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
archangel-0.4.0 app/inputs/archangel/role_input.rb
archangel-0.3.0 app/inputs/archangel/role_input.rb
archangel-0.0.8 app/inputs/archangel/role_input.rb
archangel-0.0.7 app/inputs/archangel/role_input.rb
archangel-0.0.6 app/inputs/archangel/role_input.rb
archangel-0.0.5 app/inputs/archangel/role_input.rb
archangel-0.0.4 app/inputs/archangel/role_input.rb
archangel-0.0.3 app/inputs/archangel/role_input.rb
archangel-0.0.2 app/inputs/archangel/role_input.rb