Sha256: 7ab071ce748638e916487a4b442813154bbff2a5dd2444064f19abd81951d45f

Contents?: true

Size: 1.62 KB

Versions: 36

Compression:

Stored size: 1.62 KB

Contents

module CustomFields

  module Types

    module Text

      module Field

        extend ActiveSupport::Concern

        included do

          field :text_formatting, default: 'html'

        end

      end

      module Target

        extend ActiveSupport::Concern

        module ClassMethods

          # Adds a text field (simply a string field)
          #
          # @param [ Class ] klass The class to modify
          # @param [ Hash ] rule It contains the name of the field and if it is required or not
          #
          def apply_text_custom_field(klass, rule)
            apply_custom_field(klass, rule)
          end

          # Build a hash storing the raw value for
          # a string custom field of an instance.
          #
          # @param [ Object ] instance An instance of the class enhanced by the custom_fields
          # @param [ String ] name The name of the string custom field
          #
          # @return [ Hash ] field name => raw value
          #
          def text_attribute_get(instance, name)
            default_attribute_get(instance, name)
          end

          # Set the value for the instance and the text field specified by
          # the 2 params.
          #
          # @param [ Object ] instance An instance of the class enhanced by the custom_fields
          # @param [ String ] name The name of the text custom field
          # @param [ Hash ] attributes The attributes used to fetch the values
          #
          def text_attribute_set(instance, name, attributes)
            self.default_attribute_set(instance, name, attributes)
          end

        end

      end

    end

  end

end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
custom_fields-2.12.1 lib/custom_fields/types/text.rb
custom_fields-2.12.0 lib/custom_fields/types/text.rb
custom_fields-2.10.0 lib/custom_fields/types/text.rb
custom_fields-2.10.0.rc1 lib/custom_fields/types/text.rb
custom_fields-2.10.0.beta3 lib/custom_fields/types/text.rb
custom_fields-2.10.0.beta2 lib/custom_fields/types/text.rb
custom_fields-2.9.0 lib/custom_fields/types/text.rb
custom_fields-2.9.0.rc2 lib/custom_fields/types/text.rb
custom_fields-2.9.0.rc1 lib/custom_fields/types/text.rb
custom_fields-2.8.0 lib/custom_fields/types/text.rb
custom_fields-2.7.0 lib/custom_fields/types/text.rb
custom_fields-2.7.0.rc1 lib/custom_fields/types/text.rb
custom_fields-2.6.0 lib/custom_fields/types/text.rb
custom_fields-2.5.0 lib/custom_fields/types/text.rb
custom_fields-2.5.0.rc1 lib/custom_fields/types/text.rb
custom_fields-2.4.0.rc8 lib/custom_fields/types/text.rb
custom_fields-2.4.0.rc7 lib/custom_fields/types/text.rb
custom_fields-2.4.0.rc6 lib/custom_fields/types/text.rb
custom_fields-2.3.4 lib/custom_fields/types/text.rb
custom_fields-2.4.0.rc5 lib/custom_fields/types/text.rb