Sha256: 4a3c1de2d4bd1c3aea353900e632d450715e284e7603ebe68309af6dab42754b

Contents?: true

Size: 901 Bytes

Versions: 19

Compression:

Stored size: 901 Bytes

Contents

module Plugins
  module Core
    class IntegerCell < Plugins::Core::Cell
      def input
        render
      end

      private

      def max
        field.validations[:max]
      end

      def min
        field.validations[:min]
      end

      def input_display
        @options[:input_options]&.[](:display)
      end

      def input_classes
        input_display&.[](:classes)
      end

      def input_styles
        input_display&.[](:styles)
      end

      def value
        data&.[]('integer') || @options[:default_value]
      end

      def render_label
        @options[:form].label 'data[integer]', field.name, class: 'mdl-textfield__label'
      end

      def render_input
        @options[:form].number_field 'data[integer]', value: value, placeholder: @options[:placeholder]  , max: max, min: min, class: 'mdl-textfield__input', required: required?
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
cortex-plugins-core-3.2.0 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-3.1.0 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-3.0.0 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-2.1.1 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-2.1.0 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-2.0.1 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-1.1.1 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-1.1.0 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-1.0.0 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.12.4 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.12.3 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.12.2 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.12.1 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.12.0 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.11.3 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.11.2 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.11.1 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.11.0 app/cells/plugins/core/integer_cell.rb
cortex-plugins-core-0.10.4 app/cells/plugins/core/integer_cell.rb