0.02
No commit activity in last 3 years
No release in over 3 years
This gem integrates swfobject with the Rails 3.x asset pipeline.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.0
 Project Readme

Rails Integration for SWFObject

This gem integrates SWFObject with the Rails asset pipeline. It has been tested with Rails 3.1, 3.2 and 4.0.

Installation

Just add it to your Gemfile:

gem "swfobject-rails"

Quick Start

Add to your application.js:

//= require swfobject

Place your SWFs you want to incude somewhere in the rails assets directories (ex. app/assets/swfs/...).

swfobject-rails includes a helper for generating static embed code, #swf_tag:

<%= swf_tag "video", :id => "my_video", :params => {:loop => true}, :flashvars => {:debug => true} do %>
  <p>You should download the latest Flash player!</p>
<% end %>

This would generate the following HTML:

<object id="my_video" name="my_video" width="100%" height="100%" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
  <param name="movie" value="/assets/video.swf" />
  <param name="wmode" value="transparent" />
  <param name="loop" value="true" />
  <param name="allowfullscreen" value="true" />
  <param name="allowscriptaccess" value="always" />
  <param name="flashvars" value="debug=true" />
  <!--[if !IE]>-->
    <object data="/assets/video.swf" width="100%" height="100%">
      <param name="wmode" value="transparent" />
      <param name="loop" value="true" />
      <param name="allowfullscreen" value="true" />
      <param name="allowscriptaccess" value="always" />
      <param name="flashvars" value="debug=true" />
      <!--<![endif]-->
        <p>You should download the latest Flash player!</p>
      <!--[if !IE]>-->
    </object>
  <!--<![endif]-->
</object>
<script type="text/javascript">
  swfobject.registerObject("my_video", "9.0.0", "/assets/expressInstall.swf");
</script>

Updating

When new versions swfobject are released, simply update the gem to the latest version.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Copyright

Copyright (c) 2010 - 2013 Corin Langosch and contributors. Released unter the MIT license.