Simple Object Embed Tags for Ruby on Rails
I really dig SWFObject in Javascript for making nice lightweight flash objects. What I really need, much more often though, is a way to present any Flash, Movie, Game, Song, or Thing easily in a view, and for it to be just like any other ActionView Helper.
So here is what I use, probably more often than any other plugin (except acts_as_authenticated)
./script/plugin install svn://ahgsoftware.com/simple_object/trunk |
It’ll take whatever arbitrary parameters you give it, however, I’m lazy as hell and I just call it with no parameters, and let the code handle inferring decent defaults (although for video/image/swf you’ll want at least the width/height). Here’s how I use it.
1 2 3 4 5 6 7 8 9 |
simple_object '/swfs/game.swf' simple_object '/songs/test.mp3' simple_object '/swfs/mp3player.swf',:url=>"/mp3s/tool.mp3" simple_object 'test.mov',:width=>"640",:height=>"480" # and so on.. |
I’ll be adding support for more filetypes shortly. Enjoy!