Class: ComfortableMexicanSofa::Content::Tag::Date
- Inherits:
-
Datetime
- Object
- ComfortableMexicanSofa::Content::Tag
- Fragment
- Datetime
- ComfortableMexicanSofa::Content::Tag::Date
- Defined in:
- lib/comfortable_mexican_sofa/content/tags/date.rb
Overview
Tag for text content that is going to be rendered using text input with date widget
{{ cms:date identifier }}
Instance Attribute Summary
Attributes inherited from Datetime
Attributes inherited from Fragment
#identifier, #namespace, #options, #renderable
Attributes inherited from ComfortableMexicanSofa::Content::Tag
Instance Method Summary collapse
Methods inherited from Datetime
#content, #initialize, #render
Methods inherited from Fragment
#content, #form_field_id, #fragment, #initialize, #render
Methods inherited from ComfortableMexicanSofa::Content::Tag
#allow_erb?, #content, #initialize, #nodes, #render
Constructor Details
This class inherits a constructor from ComfortableMexicanSofa::Content::Tag::Datetime
Instance Method Details
#form_field(object_name, view, index) {|input| ... } ⇒ Object
8 9 10 11 12 13 14 15 |
# 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]" = { 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, ) yield input end |