class ComfortableMexicanSofa::Content::Tag::Date

Tag for text content that is going to be rendered using text input with date widget

{{ cms:date identifier }}

Public Instance Methods

form_field(object_name, view, index) { |input| ... } click to toggle source
# File lib/comfortable_mexican_sofa/content/tags/date.rb, line 8
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