Sha256: aa4437636ad7f5b7b9ed983b47b74c86303265d4d37a56ca6ddfb3c425c655da

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 Bytes

Contents

# frozen_string_literal: true

# Tag for text content that is going to be rendered using text input with date widget
#   {{ cms:date identifier }}
#
class ComfortableMediaSurfer::Content::Tags::Date < ComfortableMediaSurfer::Content::Tags::Datetime
  def form_field(object_name, view, index)
    name    = "#{object_name}[fragments_attributes][#{index}][datetime]"
    options = { id: form_field_id, class: 'form-control', data: { 'cms-date' => true } }
    value   = content.present? ? content.to_s(:db) : ''
    input   = view.send(:text_field_tag, name, value, options)

    yield input
  end
end

ComfortableMediaSurfer::Content::Renderer.register_tag(
  :date, ComfortableMediaSurfer::Content::Tags::Date
)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
comfortable_media_surfer-3.0.0 lib/comfortable_media_surfer/content/tags/date.rb