Skip to content

Instantly share code, notes, and snippets.

@digitalpulp
Created April 12, 2010 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalpulp/363609 to your computer and use it in GitHub Desktop.
Save digitalpulp/363609 to your computer and use it in GitHub Desktop.
= text_field_tag "page[parts_attributes][#{page_part_counter}][content]", page_part.content.try(:strftime, "%B %d, %Y"), :class => 'date'
class DatePagePart < PagePart
content :datetime
show_filters false
part_name "Date Select"
end
@digitalpulp
Copy link
Author

A page part for selecting and storing dates. The view partial uses Radiant's built-in date picker behavior.

The class uses some of PagePart's helpers: content :datetime means this part will store its content in a native datetime column instead of treating it as plain text. show_filters false hides the filter/tag references, since they're not needed for this page part. part_name "Date Select" sets the label in the part selection dropdown, if we don't want the default of the class name minus "PagePart."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment