Render a specific partial among a grouping of partials based on the current date/time
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
tasks
test
MIT-LICENSE
README
Rakefile
init.rb
install.rb
uninstall.rb

README

DateSensitivePartial
====================

Have you ever wanted to render a specific partial, based on what the current date/time was?

With date_sensitive_partial, you can specify in one place, a mapping of partial groupings to their corresponding start and stop date/times and can render them with a simple helper call.

Example
=======
In config/initializers/date_sensitive_partials.rb:
# set up partials with start/stop dates for the "boo" grouping:
DateSensitivePartial::GROUPINGS["boo"] = [
  DateSensitivePartial::DateRangePartial.new(DateTime.new(2009, 11, 1), DateTime.new(2009, 11, 10), "shared/boo"),
  DateSensitivePartial::DateRangePartial.new(DateTime.new(2009, 11, 10), DateTime.new(2009, 11, 20), "shared/booya"),
  ]


In a view within your app:
 <%= render :partial => date_sensitive_partial("boo") %>

Or, if you'd like to render the partial for a specific date/time:
 <%= render :partial => date_sensitive_partial("boo", DateTime.new(2009, 11, 7)) %>


Install
=======
script/plugin install git://github.com/briandoll/date_sensitive_partial.git


Copyright (c) 2009 Brian A. Doll, released under the MIT license