honkster-jelly 0.8.10 → 0.8.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/generators/jelly/templates/javascripts/jelly.js +7 -7
- data/jelly.gemspec +2 -2
- data/lib/jelly/common.rb +11 -2
- data/lib/jelly/jelly_controller.rb +1 -1
- data/spec/jelly/common_spec.rb +14 -4
- data/spec/jelly/jelly_controller_spec.rb +6 -6
- metadata +2 -2
data/VERSION.yml
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
* Jelly. a sweet unobtrusive javascript framework
|
3
3
|
* for jQuery and Rails
|
4
4
|
*
|
5
|
-
* version 0.8.
|
5
|
+
* version 0.8.11
|
6
6
|
*
|
7
7
|
* Copyright (c) 2009 Pivotal Labs
|
8
8
|
* Licensed under the MIT license.
|
@@ -53,7 +53,7 @@ $.extend(Jelly, {
|
|
53
53
|
},
|
54
54
|
|
55
55
|
evaluateComponent: function(component) {
|
56
|
-
return
|
56
|
+
return eval(component);
|
57
57
|
},
|
58
58
|
|
59
59
|
pushIfObserver: function(observer) {
|
@@ -70,16 +70,16 @@ $.extend(Jelly, {
|
|
70
70
|
callbacks = [callbacks];
|
71
71
|
}
|
72
72
|
|
73
|
-
var
|
73
|
+
var pristineObservers = this.slice(0);
|
74
|
+
var observers;
|
74
75
|
for (var i = 0; i < callbacks.length; i++) {
|
75
76
|
var callback = callbacks[i];
|
76
77
|
|
77
78
|
// Deprecate 'on' in favor of making each page action a Component.
|
78
79
|
if (callback.on) {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
}
|
80
|
+
observers = [eval(callback.on)];
|
81
|
+
} else {
|
82
|
+
observers = pristineObservers;
|
83
83
|
}
|
84
84
|
|
85
85
|
if (callback.method) {
|
data/jelly.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{jelly}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.11"
|
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"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-11}
|
13
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.}
|
14
14
|
s.email = %q{opensource@pivotallabs.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/jelly/common.rb
CHANGED
@@ -1,10 +1,19 @@
|
|
1
1
|
module Jelly
|
2
2
|
module Common
|
3
|
-
def
|
3
|
+
def jelly_notify_hash(method, *arguments)
|
4
4
|
{"method" => method, "arguments" => arguments}
|
5
5
|
end
|
6
6
|
|
7
|
-
def
|
7
|
+
def jelly_callback_hash(method, *arguments)
|
8
|
+
warn "jelly_callback_hash has been deprecated. Please use jelly_notify_hash instead"
|
9
|
+
jelly_notify_hash(method, *arguments)
|
10
|
+
end
|
11
|
+
|
12
|
+
def jelly_method_call_hash(object, method, *arguments)
|
13
|
+
{"on" => object, "method" => method, "arguments" => arguments}
|
14
|
+
end
|
15
|
+
|
16
|
+
def jelly_notify_attach_hash (components=jelly_attachments)
|
8
17
|
{"attach" => components}
|
9
18
|
end
|
10
19
|
|
@@ -6,7 +6,7 @@ module JellyController
|
|
6
6
|
raw_jelly_callback(options) do
|
7
7
|
arguments = block ? instance_eval(&block) : []
|
8
8
|
arguments = [arguments] unless arguments.is_a?(Array)
|
9
|
-
|
9
|
+
jelly_notify_hash("on_#{callback_base_name}", *arguments).merge(options)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
data/spec/jelly/common_spec.rb
CHANGED
@@ -8,9 +8,19 @@ describe Jelly::Common do
|
|
8
8
|
end.new
|
9
9
|
end
|
10
10
|
|
11
|
-
describe "#
|
11
|
+
describe "#jelly_notify_hash" do
|
12
12
|
it "creates a hash with a method and arguments" do
|
13
|
-
fixture.
|
13
|
+
fixture.jelly_notify_hash("my_method", 1, 2, 3).should == {
|
14
|
+
"method" => "my_method",
|
15
|
+
"arguments" => [1, 2, 3]
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#jelly_method_call_hash" do
|
21
|
+
it "creates a hash with a object, method, and arguments" do
|
22
|
+
fixture.jelly_method_call_hash("MyObject", "my_method", 1, 2, 3).should == {
|
23
|
+
"on" => "MyObject",
|
14
24
|
"method" => "my_method",
|
15
25
|
"arguments" => [1, 2, 3]
|
16
26
|
}
|
@@ -24,7 +34,7 @@ describe Jelly::Common do
|
|
24
34
|
fixture.jelly_attachment_hash("Foo", 1, 2),
|
25
35
|
fixture.jelly_attachment_hash("Bar", 3),
|
26
36
|
]
|
27
|
-
fixture.
|
37
|
+
fixture.jelly_notify_attach_hash(attachments).should == {
|
28
38
|
"attach" => attachments
|
29
39
|
}
|
30
40
|
end
|
@@ -37,7 +47,7 @@ describe Jelly::Common do
|
|
37
47
|
fixture.jelly_attachment_hash("Bar", 3),
|
38
48
|
]
|
39
49
|
stub(fixture).jelly_attachments {attachments}
|
40
|
-
fixture.
|
50
|
+
fixture.jelly_notify_attach_hash.should == {
|
41
51
|
"attach" => attachments
|
42
52
|
}
|
43
53
|
end
|
@@ -225,7 +225,7 @@ describe ApplicationController, :type => :controller do
|
|
225
225
|
stub(request).xhr? {false}
|
226
226
|
|
227
227
|
@controller.send(:raw_jelly_callback, :format => :json) do
|
228
|
-
|
228
|
+
jelly_notify_hash("foo", "grape").merge('bar' => 'baz')
|
229
229
|
end
|
230
230
|
callback = JSON.parse(response.body)
|
231
231
|
callback["method"].should == "foo"
|
@@ -239,7 +239,7 @@ describe ApplicationController, :type => :controller do
|
|
239
239
|
@controller.params[:callback] = "Jelly.notifyObservers"
|
240
240
|
|
241
241
|
@controller.send(:raw_jelly_callback, :format => :jsonp) do
|
242
|
-
|
242
|
+
jelly_notify_hash("foo", "grape").merge('bar' => 'baz')
|
243
243
|
end
|
244
244
|
json = Regexp.new('Jelly\.notifyObservers\((.*)\);').match(response.body)[1]
|
245
245
|
callback = JSON.parse(json)
|
@@ -252,7 +252,7 @@ describe ApplicationController, :type => :controller do
|
|
252
252
|
describe "iframe" do
|
253
253
|
it "responds with a the json in a textarea tag" do
|
254
254
|
@controller.send(:raw_jelly_callback, :format => :iframe) do
|
255
|
-
|
255
|
+
jelly_notify_hash("foo", "grape").merge('bar' => 'baz')
|
256
256
|
end
|
257
257
|
body = response.body
|
258
258
|
body.should =~ /^<textarea>/
|
@@ -274,7 +274,7 @@ describe ApplicationController, :type => :controller do
|
|
274
274
|
|
275
275
|
it "responds with a json hash" do
|
276
276
|
@controller.send(:raw_jelly_callback) do
|
277
|
-
|
277
|
+
jelly_notify_hash("foo", "grape").merge('bar' => 'baz')
|
278
278
|
end
|
279
279
|
callback = JSON.parse(response.body)
|
280
280
|
callback["method"].should == "foo"
|
@@ -296,7 +296,7 @@ describe ApplicationController, :type => :controller do
|
|
296
296
|
|
297
297
|
it "responds with a call to the given callback method with the json as an argument" do
|
298
298
|
@controller.send(:raw_jelly_callback) do
|
299
|
-
|
299
|
+
jelly_notify_hash("foo", "grape").merge('bar' => 'baz')
|
300
300
|
end
|
301
301
|
json = Regexp.new('Jelly\.notifyObservers\((.*)\);').match(response.body)[1]
|
302
302
|
callback = JSON.parse(json)
|
@@ -309,7 +309,7 @@ describe ApplicationController, :type => :controller do
|
|
309
309
|
context "when there is not a callback param" do
|
310
310
|
it "wraps the json response in a textarea tag to support File Uploads in an iframe target (see: http://malsup.com/jquery/form/#code-samples)" do
|
311
311
|
@controller.send(:raw_jelly_callback) do
|
312
|
-
|
312
|
+
jelly_notify_hash("foo", "grape").merge('bar' => 'baz')
|
313
313
|
end
|
314
314
|
body = response.body
|
315
315
|
body.should =~ /^<textarea>/
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: honkster-jelly
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.11
|
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: 2010-01-
|
12
|
+
date: 2010-01-11 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|