Sha256: e688f1a0c568c0542e034e5705a7dd74ab1df8aeff50cbb11f3e69218fba64ac

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

module <%= class_name %>
  module TimestampGlipper

    def timestamp(field=:created_at, format=:default, config=Veil.config)
      h.content_tag :span, get_date(field),
        data: { :toggle => "tooltip", :placement => "top", :timestamp => get_date(field), 'timestamp-format' => timestamp_format(field, format) },
        class: 'timestamp',
        title: get_date(field)
    end

    # possible values: fromNow, default
    private def timestamp_format(field, format)
      format
    end

    private def get_date(field)
      o.public_send(field).try(:iso8601) || '-'
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
billet-0.0.1 lib/generators/billet/namespace/templates/drappers/concerns/timestamp_glipper.rb.erb