pivotal-jelly 0.3.1 → 0.3.5
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/VERSION.yml +4 -0
- data/jelly.gemspec +7 -3
- data/lib/jelly/jelly_helper.rb +10 -1
- data/spec/helpers/jelly_helper_spec.rb +16 -1
- metadata +3 -2
data/VERSION.yml
ADDED
data/jelly.gemspec
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
# Generated by jeweler
|
|
2
|
+
# DO NOT EDIT THIS FILE
|
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
|
|
1
4
|
# -*- encoding: utf-8 -*-
|
|
2
5
|
|
|
3
6
|
Gem::Specification.new do |s|
|
|
4
7
|
s.name = %q{jelly}
|
|
5
|
-
s.version = "0.3.
|
|
8
|
+
s.version = "0.3.5"
|
|
6
9
|
|
|
7
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
11
|
s.authors = ["Pivotal Labs, Inc"]
|
|
9
|
-
s.date = %q{2009-08-
|
|
12
|
+
s.date = %q{2009-08-19}
|
|
10
13
|
s.description = %q{Jelly provides a set of tools and conventions for creating rich ajax/javascript web applications with jQuery and Ruby on Rails.}
|
|
11
14
|
s.email = %q{opensource@pivotallabs.com}
|
|
12
15
|
s.extra_rdoc_files = [
|
|
@@ -18,6 +21,7 @@ Gem::Specification.new do |s|
|
|
|
18
21
|
"README.markdown",
|
|
19
22
|
"Rakefile",
|
|
20
23
|
"VERSION",
|
|
24
|
+
"VERSION.yml",
|
|
21
25
|
"generators/jelly/USAGE",
|
|
22
26
|
"generators/jelly/jelly_generator.rb",
|
|
23
27
|
"generators/jelly/templates/javascripts/ajax_with_jelly.js",
|
|
@@ -35,7 +39,7 @@ Gem::Specification.new do |s|
|
|
|
35
39
|
s.homepage = %q{http://github.com/pivotal/jelly}
|
|
36
40
|
s.rdoc_options = ["--charset=UTF-8"]
|
|
37
41
|
s.require_paths = ["lib"]
|
|
38
|
-
s.rubygems_version = %q{1.3.
|
|
42
|
+
s.rubygems_version = %q{1.3.5}
|
|
39
43
|
s.summary = %q{a sweet unobtrusive javascript framework for jQuery and Rails}
|
|
40
44
|
s.test_files = [
|
|
41
45
|
"spec/controllers/jelly_controller_spec.rb",
|
data/lib/jelly/jelly_helper.rb
CHANGED
|
@@ -14,8 +14,17 @@ module JellyHelper
|
|
|
14
14
|
JS
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
def clear_jelly_attached()
|
|
18
|
+
@jelly_attached_components = []
|
|
19
|
+
end
|
|
20
|
+
|
|
17
21
|
def attach_javascript_component(component_name, *args)
|
|
18
|
-
|
|
22
|
+
@jelly_attached_components ||= []
|
|
23
|
+
key = "page.attach(#{component_name}, #{args.to_json});"
|
|
24
|
+
unless @jelly_attached_components.include? key
|
|
25
|
+
@jelly_attached_components << key
|
|
26
|
+
content_for(:javascript, key)
|
|
27
|
+
end
|
|
19
28
|
end
|
|
20
29
|
|
|
21
30
|
end
|
|
@@ -23,11 +23,26 @@ describe "JellyHelper" do
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
describe "#attach_javascript_component" do
|
|
26
|
+
|
|
27
|
+
after do
|
|
28
|
+
#need to clear this since it's saving state between tests
|
|
29
|
+
assigns[:content_for_javascript] = ""
|
|
30
|
+
helper.clear_jelly_attached()
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "fails to add multiple calls to page.attach for the same component" do
|
|
34
|
+
helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg3')
|
|
35
|
+
helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg3')
|
|
36
|
+
helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg5')
|
|
37
|
+
assigns[:content_for_javascript].should == 'page.attach(MyComponent, ["arg1","arg2","arg3"]);page.attach(MyComponent, ["arg1","arg2","arg5"]);'
|
|
38
|
+
end
|
|
39
|
+
|
|
26
40
|
it "adds a call to page.attach in the javascript content" do
|
|
27
41
|
helper.attach_javascript_component("MyComponent", 'arg1', 'arg2', 'arg3')
|
|
28
42
|
expected_args = ['arg1','arg2','arg3'].to_json
|
|
29
|
-
assigns[:content_for_javascript].should
|
|
43
|
+
assigns[:content_for_javascript].should == "page.attach(MyComponent, #{expected_args});"
|
|
30
44
|
end
|
|
45
|
+
|
|
31
46
|
end
|
|
32
47
|
|
|
33
48
|
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.
|
|
4
|
+
version: 0.3.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pivotal Labs, Inc
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-08-
|
|
12
|
+
date: 2009-08-19 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
@@ -36,6 +36,7 @@ files:
|
|
|
36
36
|
- README.markdown
|
|
37
37
|
- Rakefile
|
|
38
38
|
- VERSION
|
|
39
|
+
- VERSION.yml
|
|
39
40
|
- generators/jelly/USAGE
|
|
40
41
|
- generators/jelly/jelly_generator.rb
|
|
41
42
|
- generators/jelly/templates/javascripts/ajax_with_jelly.js
|