Sha256: bf6ad281244bfaf259f45f3b2747c7779a2b7e3c49efe872bac24997a90bdb22

Contents?: true

Size: 711 Bytes

Versions: 16

Compression:

Stored size: 711 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 ComfortableMexicanSofa::Content::Tag::Date < ComfortableMexicanSofa::Content::Tag::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

ComfortableMexicanSofa::Content::Renderer.register_tag(
  :date, ComfortableMexicanSofa::Content::Tag::Date
)

Version data entries

16 entries across 16 versions & 6 rubygems

Version Path
comfortable_mexican_sofa-2.0.19 lib/comfortable_mexican_sofa/content/tags/date.rb
PixelForce_ETS-0.0.2 lib/comfortable_mexican_sofa/content/tags/date.rb
PixelForce_ETS-0.0.1 lib/comfortable_mexican_sofa/content/tags/date.rb
kcyEtsTest2-0.0.4 lib/comfortable_mexican_sofa/content/tags/date.rb
kcyEtsTest2-0.0.3 lib/comfortable_mexican_sofa/content/tags/date.rb
kcyEtsTest2-0.0.2 lib/comfortable_mexican_sofa/content/tags/date.rb
kcyEtsTest2-0.0.1 lib/comfortable_mexican_sofa/content/tags/date.rb
kcyEtsTest-0.0.1 lib/comfortable_mexican_sofa/content/tags/date.rb
kcyEtsTest-2.2.19 lib/comfortable_mexican_sofa/content/tags/date.rb
ComfortableMexicanSofa-2.0.18 lib/comfortable_mexican_sofa/content/tags/date.rb
kcy1-1.0 lib/comfortable_mexican_sofa/content/tags/date.rb
comfortable_mexican_sofa-2.0.18 lib/comfortable_mexican_sofa/content/tags/date.rb
comfortable_mexican_sofa-2.0.17 lib/comfortable_mexican_sofa/content/tags/date.rb
comfortable_mexican_sofa-2.0.16 lib/comfortable_mexican_sofa/content/tags/date.rb
comfortable_mexican_sofa-2.0.15 lib/comfortable_mexican_sofa/content/tags/date.rb
comfortable_mexican_sofa-2.0.14 lib/comfortable_mexican_sofa/content/tags/date.rb