Sha256: 256b4cf1023e506328aa0dfdaf5642e205def96dd5220cad15fd1a0572c6675d

Contents?: true

Size: 985 Bytes

Versions: 7

Compression:

Stored size: 985 Bytes

Contents

module LatoCore

  class Elements::Table::Row::Cell < Cell

    @@requested_args = [:labels]

    @@default_args = {
      
    }

    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

    private

      def set_conditions
        @labels = prepare_labels
      end

      def prepare_labels
        prepared_labels = []
        @args[:labels].each do |label|
          if label.is_a?(Hash)
            if ['boolean', 'icon', 'component'].include? label[:type]
              prepared_labels.push({type: label[:type], value: label[:value]})
            else
              prepared_labels.push({type: 'string', value: ''})
            end
          else
            prepared_labels.push({type: 'string', value: label})
          end
        end
        return prepared_labels
      end

  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lato_core-2.2.2 app/cells/lato_core/elements/table/row/cell.rb
lato_core-2.2.0 app/cells/lato_core/elements/table/row/cell.rb
lato_core-2.1.4 app/cells/lato_core/elements/table/row/cell.rb
lato_core-2.1.3 app/cells/lato_core/elements/table/row/cell.rb
lato_core-2.1.2 app/cells/lato_core/elements/table/row/cell.rb
lato_core-2.1.1 app/cells/lato_core/elements/table/row/cell.rb
lato_core-2.1 app/cells/lato_core/elements/table/row/cell.rb