What you're describing is essentially a partial that is rendered based on some condition (i.e. is today's date between 'x' and 'y').
I'm not aware of a gem for this, but it shouldn't be too hard to build. Just create a class called Promotion
with the following fields:
datetime start_date
datetime end_date
text html_code
string block_id
boolean active
string landing_page
The block_id
is essentially an HTML id that is used to insert the content of this Promotion
to a <div>
with a matching id. Then, in your store's layout, you put place marker <div>
tags in places that would hold promotional call outs. The active
field could be used to turn a promotion on/off (ignoring the start_date
and end_date
values).
I think that's pretty much all you would need.
To answer you list of needs:
- Set the default value on the
html_code
field to whatever you want
- Scheduling is done via the
start_date
and end_date
fields
- Do you mean rotate as in how a jCarousel rotates content visually? You can easily add jCarousel support yourself.
- In your view code you can automatically add Google Analytics code to do this, and/or your own code to track how many times a promotion is shown in the rotation, and how many clicks it receives. If you did it a custom way, you would just add a
views
field for the number of times a given promotion was displayed, and a clicked
field for when it was clicked. You can count clicks through a Promotions
controller that handles redirects to the appropriate landing page, based on the landing_page
field.
- See the i18n gem