0.0
No commit activity in last 3 years
No release in over 3 years
Provides integration with ruby and JavaScript versions of Cyclical recurring events library for your rails application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.1.0
>= 3.1
 Project Readme

Cyclical for Rails

Integration with ruby and JavaScript versions of Cyclical recurring events library for yourrails application.

About

Cyclical lets you list recurring events with complex recurrence rules like "every 4 years, the first Tuesday after a Monday in November" in a simple way both in the front-end and the back-end of your application.

Install

Add the cyclical-rails gem in your Gemfile

gem "cyclical-rails"

The cyclical JavaScript library will be added to the asset pipeline. To use them add the following to app/assets/javascript/application.js:

//= require cyclical

Usage

Ruby & JavaScript

In your controller you do:

schedule = Cyclical::Schedule.new Time.now, Cyclical::Rule.daily(2).count(3)
schedule.occurrences

in your javascript you do:

var schedule = new Schedule(new Date, Schedule.Rule.daily(2).count(3));
var occ = schedule.occurrences();

and you get the same results.

You can send schedules over the wire as JSON. Serialize in ERB

schedule_json = '<%= @schedule.to_json.html_safe %>';

and load in javascript

var schedule = Schedule.fromJSON(schedule_json);

The same also works the other way round.

For more information about Cyclical and Cyclical.js see the respective repos.

License

Released under the MIT License.