technotarek/timeliner — pull request #8 by luisalima (2013-12-30 12:27:29+00:00)
Title: Add multiple timeliners support and fix bug on initialization

Hi @technotarek , thanks for a great plugin.

I am using this in a rails application and needed support for multiple timeliners in the same page, so I implemented it.

I tried to follow your conventions and maintain the exact same public API (ie. `$.timeliner(options)` initializes the multiple timeliners, setting the options for each one now). It was hard to keep your indentations with emacs, so I basically merged my changes by hand. I really tried hard to keep them for my code, but it was nearly impossible. I hope that's ok.

I hope that it's self-documentable, but the approach that I followed was to create a global variable storing all the options for each timeline in an array (`$.timeliner.options`). Calling `$.timeliner` adds a new options hash to that global array, runs through it, and initializes a timeliner for each option (if it wasn't initialized already).

If you'd like me to add more stuff or document/comment the code a bit better just let me know.

Furthermore, I found a bug: the default `expandAll` and `collapseAll` strings were not being set on initialization, so I fixed that as well in this PR.

Finally, I think that this is useful for more rails people, so I [packaged the plugin as a gem](https://github.com/luisalima/timeliner_rails). If you want to link to it in your README, that would be greatly appreciated by more folks, I hope :) If you merge this PR I'll release a new version of the gem.

Happy holidays!