Sha256: 83e6bbb566e70ce9b3bb89a53535c600c8176dd1c70a112335317b633f509ce3

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

class TableColumnComponentPreview < ViewComponent::Preview
  class TempObj
    attr_accessor :fieldname

    def initialize(fieldname = 'Example value')
      @fieldname = fieldname
    end
  end

  layout false

  def default
    temp_obj = TempObj.new
    render(TableColumnComponent.new(value: nil, obj: temp_obj, fieldname: :fieldname, url: nil, options: {}))
  end

  def with_url
    temp_obj = TempObj.new
    render(TableColumnComponent.new(value: nil, obj: temp_obj, fieldname: :fieldname, url: 'example/url', options: {}))
  end

  def with_date
    temp_obj = TempObj.new(Time.zone.today)
    render(TableColumnComponent.new(value: nil, obj: temp_obj, fieldname: :fieldname, url: 'example/url', options: { date: true }))
  end

  def with_time
    temp_obj = TempObj.new(Time.zone.now)
    render(TableColumnComponent.new(value: nil, obj: temp_obj, fieldname: :fieldname, url: 'example/url', options: { time: true }))
  end

  def with_custom_value
    temp_obj = TempObj.new
    render(TableColumnComponent.new(value: 'custom value', obj: temp_obj, fieldname: :fieldname, url: nil, options: {}))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alveole-0.0.1 lib/alveole/previews/table_column_component_preview.rb