Sha256: ae1b26e45741c8c1194662e61030e0be82358cd6a433cd13b3908b4538411afe

Contents?: true

Size: 1.1 KB

Versions: 2

Compression:

Stored size: 1.1 KB

Contents

module LatoView
  class Input::Date::Cell < Cell

    @@widths = VIEW_INPUTWIDTH

    attr_accessor :name, :placeholder, :value, :label, :width, :required,
                  :disabled, :custom_class

    def initialize(name: 'input', placeholder: '', value: '', label: '',
                   width: 'large', required: false, disabled: false,
                   custom_class: '')
      # save params
      @name = name
      @placeholder = placeholder
      @value = value
      @label = label
      @width = width
      @required = required
      @disabled = disabled
      @custom_class = custom_class
      # check params
      check_params
    end

    def show
      render "show.html"
    end

    # return required string to input
    protected def required_data_input
      return "data-input='required'" if @required
    end

    # return disabled string to input
    protected def disabled_data_input
      return "disabled='disabled'" if @disabled
    end

    # check params
    private def check_params
      raise 'Input Cells: width has not a correct value' unless @@widths.include? width
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lato_view-1.1.4 app/cells/lato_view/input/date/cell.rb
lato_view-1.1.3 app/cells/lato_view/input/date/cell.rb