-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 2a7b428
Showing
13 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.gem | ||
.bundle | ||
Gemfile.lock | ||
pkg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source "http://rubygems.org" | ||
|
||
# Specify your gem's dependencies in swfobject-rails.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2010-2011 Corin Langosch | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to | ||
deal in the Software without restriction, including without limitation the | ||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||
sell copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Rails 3.1 Integration for swfobject | ||
== | ||
|
||
This gem integrates [swfobject](http://code.google.com/p/swfobject/) with the Rails 3.1 asset pipeline. | ||
|
||
|
||
Install | ||
-- | ||
|
||
Just add it got 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 3.1 assets directories (ex. app/assets/swfs/...). | ||
|
||
In your view you can now do: | ||
|
||
<%= swf_tag "video" %> | ||
|
||
|
||
Updating | ||
-- | ||
When new versions swfobject are released, simply update the gem to the latest version. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# encoding: utf-8 | ||
module SwfobjectHelper | ||
def swf_path(source) | ||
asset_paths.compute_public_path(source, 'swfs') | ||
end | ||
|
||
def swf_tag(name, options = {}) | ||
width = height = nil | ||
if options[:size] | ||
width, height = options[:size].split("x") | ||
else | ||
width = options.delete(:width) | ||
height = options.delete(:height) | ||
end | ||
|
||
if options[:flashvars] | ||
# we need to urlencode flashvars, see question 9 at | ||
# http://code.google.com/p/swfobject/wiki/faq | ||
flashvars = {} | ||
options[:flashvars].each_pair do |k, v| | ||
flashvars[CGI.escape(k.to_s)] = CGI.escape(v.to_s) | ||
end | ||
else | ||
flashvars = options[:flashvars] | ||
end | ||
|
||
code = "swfobject.embedSWF('%s', '%s', '%s', '%s', '%s', '%s', %s, %s, %s, %s);" % [ | ||
swf_path("#{name}.swf"), | ||
options[:dom_id] || name, | ||
width, | ||
height, | ||
options[:version] || "9.0.0", | ||
swf_path("expressInstall.swf"), | ||
flashvars.to_json, | ||
options[:params].to_json, | ||
options[:attributes].to_json, | ||
options[:callback] ? options[:callback] : "null", | ||
] | ||
|
||
javascript_tag(code) | ||
end | ||
|
||
def swfoject(*args) | ||
swf_tag(*args) | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require "swfobject/rails" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'swfobject/rails/version' | ||
require 'swfobject/rails/engine' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Swfobject | ||
module Rails | ||
class Engine < ::Rails::Engine | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module Swfobject | ||
VERSION = "2.2" | ||
|
||
module Rails | ||
VERSION = "1.0.0" | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# -*- encoding: utf-8 -*- | ||
$:.push File.expand_path("../lib", __FILE__) | ||
require "swfobject/rails/version" | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "swfobject-rails" | ||
s.version = Swfobject::Rails::VERSION | ||
s.authors = ["Corin Langosch"] | ||
s.email = ["info@corinlangosch.com"] | ||
s.homepage = "https://github.com/gucki/swfobject-rails" | ||
s.summary = %q{Integration of swfobject with the Rails 3.1 asset pipeline} | ||
s.description = %q{This gem integrates swfobject with the Rails 3.1 asset pipeline.} | ||
|
||
s.rubyforge_project = "swfobject-rails" | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
# specify any dependencies here; for example: | ||
# s.add_development_dependency "rspec" | ||
s.add_runtime_dependency "rails", "~>3.1.0" | ||
end | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.