swf_ditty 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -32,7 +32,16 @@ module Sinatra
32
32
 
33
33
  # Yank create_dom_container option out of the hash, if it exists
34
34
  # Create DOM container if option is set to something other than false or nil
35
- out << content_tag(:div, "", :id => dom_id) if options.delete(:create_dom_container)
35
+ if options.delete(:create_dom_container)
36
+ # Set the div's dimensions right away so the page doesn't jolt into
37
+ # the proper dimensions when the swf loads.
38
+ w = options[:width].to_s
39
+ h = options[:height].to_s
40
+ w += "px" unless w.include? "%"
41
+ h += "px" unless h.include? "%"
42
+ style = "width:#{w};height:#{h}"
43
+ out << content_tag(:div, "", :id => dom_id, :style => style)
44
+ end
36
45
 
37
46
  # Turn flashvars hash into a flashvars-style formatted string
38
47
  options[:flashvars] = "{" + hash_to_key_value_string(options[:flashvars]) + "}" if options[:flashvars]
@@ -68,9 +77,10 @@ module Sinatra
68
77
  end
69
78
 
70
79
  # Sinatra doesn't have this method, but Rails does..
80
+ # options are sorted alphabetically for predicatability
71
81
  unless method_defined?(:content_tag)
72
82
  def content_tag(name,content,options={})
73
- options = options.map{ |k,v| "#{k}='#{v}'" }.join(" ")
83
+ options = options.map{ |k,v| "#{k}='#{v}'" }.sort.join(" ")
74
84
  "<#{name} #{options}>#{content}</#{name}>"
75
85
  end
76
86
  end
data/swf_ditty.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{swf_ditty}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Zeke Sikelianos"]
12
- s.date = %q{2009-11-04}
12
+ s.date = %q{2009-11-10}
13
13
  s.description = %q{A simple and flexible Sinatra helper for embedding SWFs in your views. Depends on jQuery and jQuery SWFObject}
14
14
  s.email = %q{zeke@sikelianos.com}
15
15
  s.extra_rdoc_files = [
data/test/sinatra_app.rb CHANGED
@@ -22,7 +22,7 @@ end
22
22
  get "/swf_with_flashvars" do
23
23
  content_type "text/plain"
24
24
  <<"EOD"
25
- #{swf("foo.swf", :height => 50, :flashvars => {:a => 1, :b => 'two'})}
25
+ #{swf("foo.swf", :height => 50, :width => 600, :flashvars => {:a => 1, :b => 'two'})}
26
26
  EOD
27
27
  end
28
28
 
@@ -16,8 +16,8 @@ class TestSwfDitty < Test::Unit::TestCase
16
16
  get '/swf_plain'
17
17
  assert last_response.ok?
18
18
  assert_equal last_response.body, <<EOD
19
- <script type='text/javascript' charset='utf-8'>$(document).ready(function(){$('#foo_swf').flash({allowScriptAccess:'sameDomain', height:'100%', name:'foo_swf', swf:'swf/foo.swf', width:'100%', wmode:'opaque'});});</script>
20
- <div id='foo_swf'></div>
19
+ <script charset='utf-8' type='text/javascript'>$(document).ready(function(){$('#foo_swf').flash({allowScriptAccess:'sameDomain', height:'100%', name:'foo_swf', swf:'swf/foo.swf', width:'100%', wmode:'opaque'});});</script>
20
+ <div id='foo_swf' style='width:100%;height:100%'></div>
21
21
  EOD
22
22
  end
23
23
 
@@ -25,7 +25,7 @@ EOD
25
25
  get '/swf_with_custom_dom_id'
26
26
  assert last_response.ok?
27
27
  assert_equal last_response.body, <<EOD
28
- <script type='text/javascript' charset='utf-8'>$(document).ready(function(){$('#dombo').flash({allowScriptAccess:'sameDomain', height:'100%', name:'foo_swf', swf:'swf/foo.swf', width:'100%', wmode:'opaque'});});</script>
28
+ <script charset='utf-8' type='text/javascript'>$(document).ready(function(){$('#dombo').flash({allowScriptAccess:'sameDomain', height:'100%', name:'foo_swf', swf:'swf/foo.swf', width:'100%', wmode:'opaque'});});</script>
29
29
  EOD
30
30
  end
31
31
 
@@ -33,8 +33,8 @@ EOD
33
33
  get '/swf_with_flashvars'
34
34
  assert last_response.ok?
35
35
  assert_equal last_response.body, <<EOD
36
- <script type='text/javascript' charset='utf-8'>$(document).ready(function(){$('#foo_swf').flash({allowScriptAccess:'sameDomain', flashvars:{a:1, b:'two'}, height:50, name:'foo_swf', swf:'foo.swf', width:'100%', wmode:'opaque'});});</script>
37
- <div id='foo_swf'></div>
36
+ <script charset='utf-8' type='text/javascript'>$(document).ready(function(){$('#foo_swf').flash({allowScriptAccess:'sameDomain', flashvars:{a:1, b:'two'}, height:50, name:'foo_swf', swf:'foo.swf', width:600, wmode:'opaque'});});</script>
37
+ <div id='foo_swf' style='width:600px;height:50px'></div>
38
38
  EOD
39
39
  end
40
40
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swf_ditty
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zeke Sikelianos
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-04 00:00:00 -08:00
12
+ date: 2009-11-10 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency