Sha256: 5b45f2a167f8a465d6f251d4e24e297fb3502b82d44264caf2d0a4604e424ebe

Contents?: true

Size: 645 Bytes

Versions: 1

Compression:

Stored size: 645 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 Occams::Content::Tag::Date < Occams::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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
occams-1.0.1 lib/occams/content/tags/date.rb