pivotal-jelly 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/jelly.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jelly}
8
- s.version = "0.3.5"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Pivotal Labs, Inc"]
@@ -11,6 +11,9 @@ module JellyHelper
11
11
  window._token = '#{form_authenticity_token}'
12
12
  Jelly.activatePage('#{controller.controller_path.camelcase}', '#{controller.action_name}');
13
13
  #{@content_for_javascript}
14
+ $(document).ready(function() {
15
+ #{@content_for_javascript_on_ready}
16
+ });
14
17
  JS
15
18
  end
16
19
 
@@ -27,4 +30,13 @@ module JellyHelper
27
30
  end
28
31
  end
29
32
 
33
+ def attach_javascript_component_on_ready(component_name, *args)
34
+ @jelly_attached_components_on_ready ||= []
35
+ key = "page.attach(#{component_name}, #{args.to_json});"
36
+ unless @jelly_attached_components_on_ready.include? key
37
+ @jelly_attached_components_on_ready << key
38
+ content_for(:javascript_on_ready, key)
39
+ end
40
+ end
41
+
30
42
  end
@@ -43,6 +43,12 @@ describe "JellyHelper" do
43
43
  assigns[:content_for_javascript].should == "page.attach(MyComponent, #{expected_args});"
44
44
  end
45
45
 
46
+ it "adds a call to page.attach in the javascript_on_ready content" do
47
+ helper.attach_javascript_component_on_ready("MyComponent", 'arg1', 'arg2', 'arg3')
48
+ expected_args = ['arg1','arg2','arg3'].to_json
49
+ assigns[:content_for_javascript_on_ready].should == "page.attach(MyComponent, #{expected_args});"
50
+ end
51
+
46
52
  end
47
53
 
48
54
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-jelly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pivotal Labs, Inc
@@ -52,7 +52,6 @@ files:
52
52
  - uninstall.rb
53
53
  has_rdoc: false
54
54
  homepage: http://github.com/pivotal/jelly
55
- licenses:
56
55
  post_install_message:
57
56
  rdoc_options:
58
57
  - --charset=UTF-8
@@ -73,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
72
  requirements: []
74
73
 
75
74
  rubyforge_project:
76
- rubygems_version: 1.3.5
75
+ rubygems_version: 1.2.0
77
76
  signing_key:
78
77
  specification_version: 3
79
78
  summary: a sweet unobtrusive javascript framework for jQuery and Rails