Sha256: f3f971c850aa46422aa27fbbfe931445ceb5060959d7af64bfdc736607dbf42b

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module LatoCore

  class Inputs::Multipleselect::Cell < Cell

    @@requested_args = [:name]

    @@default_args = {
      label: '',
      help: '',
      class: 'md-12',
      selects: [] # {name: '', label: '', api: '', value: '', class: ''}
    }

    def initialize(args = {})
      @args = validate_args(
        args: args,
        requested_args: @@requested_args,
        default_args: @@default_args
      )

      set_conditions
    end

    def show
      render 'show.html'
    end

    protected

    def generate_select(select_settings, position)
      LatoCore::Inputs::Select::Cell.new(
        name: "#{@args[:name]}[#{select_settings[:name]}]",
        label: select_settings[:label],
        value: select_settings[:value],
        class: select_settings[:class],
        attributes: {
          api: select_settings[:api],
          position: position
        }
      )
    end

    private

    def set_conditions
      @show_label = !@args[:label].nil? && !@args[:label].blank?
      @show_help = !@args[:help].nil? && !@args[:help].blank?
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lato_core-2.2.2 app/cells/lato_core/inputs/multipleselect/cell.rb
lato_core-2.2.0 app/cells/lato_core/inputs/multipleselect/cell.rb
lato_core-2.1.4 app/cells/lato_core/inputs/multipleselect/cell.rb
lato_core-2.1.3 app/cells/lato_core/inputs/multipleselect/cell.rb