Sha256: a40719822ad19ec5bb682483f1f4969b41337b676e927d6cf21074ae85fe6058

Contents?: true

Size: 684 Bytes

Versions: 9

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true

module Archangel
  ##
  # Field classification custom input for SimpleForm
  #
  class FieldClassificationInput < 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::Field::CLASSIFICATIONS.each do |classification|
          option <<
            [Archangel.t("classification.#{classification}"), classification]
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

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