Sha256: 901485b27a23ffe42fd734d09728d70d28d285d8993acbcdcb1729a08657e5a1

Contents?: true

Size: 519 Bytes

Versions: 18

Compression:

Stored size: 519 Bytes

Contents

module Compony
  module ModelFields
    class Color < Base
      def value_for(data, controller: nil, **_)
        return transform_and_join(data.send(@name), controller:) do |el|
          next nil unless el
          next controller.helpers.raw "#{el}&nbsp;<span style=\"background-color: #{el}\">&nbsp;&nbsp;&nbsp;&nbsp;</span>"
        end
      end

      def simpleform_input(form, _component, name: nil, **input_opts)
        return form.input name || @name, as: :color, **input_opts
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
compony-0.5.3 lib/compony/model_fields/color.rb
compony-0.5.2 lib/compony/model_fields/color.rb
compony-0.5.1 lib/compony/model_fields/color.rb
compony-0.5.0 lib/compony/model_fields/color.rb
compony-0.4.1 lib/compony/model_fields/color.rb
compony-0.4.0 lib/compony/model_fields/color.rb
compony-0.3.3 lib/compony/model_fields/color.rb
compony-0.3.2 lib/compony/model_fields/color.rb
compony-0.3.1 lib/compony/model_fields/color.rb
compony-0.3.0 lib/compony/model_fields/color.rb
compony-0.2.3 lib/compony/model_fields/color.rb
compony-0.2.2 lib/compony/model_fields/color.rb
compony-0.2.1 lib/compony/model_fields/color.rb
compony-0.2.0 lib/compony/model_fields/color.rb
compony-0.1.1 lib/compony/model_fields/color.rb
compony-0.1.0 lib/compony/model_fields/color.rb
compony-0.0.9 lib/compony/model_fields/color.rb
compony-0.0.8 lib/compony/model_fields/color.rb