Sha256: 9f52fcffc09ee02c8ad9b32ed75520d8fdbf22f38e28bf5a07fdfee6a9e0400a

Contents?: true

Size: 979 Bytes

Versions: 13

Compression:

Stored size: 979 Bytes

Contents

module Plugins
  module Core
    class FloatCell < Plugins::Core::Cell
      def input
        render
      end
     
      private
      
      def max
        field.validations[:max]  
      end

      def min
        field.validations[:min] 
      end

      def step
        field.validations[:step] ||  0.01
      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&.[]('float') || @options[:default_value]
      end

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

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

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cortex-plugins-core-0.10.2 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.10.1 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.10.0 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.9.1 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.9.0 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.8.0 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.7.2 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.7.1 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.7.0 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.6.0 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.5.0 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.4.8 app/cells/plugins/core/float_cell.rb
cortex-plugins-core-0.4.7 app/cells/plugins/core/float_cell.rb