honkster-jelly 0.9.3 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,3 +2,5 @@
2
2
  *.svn
3
3
  pkg
4
4
  b
5
+ *.gem
6
+ *.gemspec
@@ -1,4 +1,4 @@
1
- if(!window.Jelly) window.Jelly = new Object();
1
+ if(!window.Jelly) window.Jelly = {};
2
2
 
3
3
  (Jelly.defineAjaxWithJellyFunctions = function($) {
4
4
  $.ajaxWithJelly = function(params) {
@@ -14,11 +14,6 @@ if(!window.Jelly) window.Jelly = new Object();
14
14
  $.ajaxWithJelly.params = function(otherParams) {
15
15
  otherParams = otherParams || {};
16
16
 
17
- if (otherParams.type && otherParams.type != "GET") {
18
- otherParams['data'] = $.extend(otherParams['data'], {
19
- authenticity_token: window._token
20
- });
21
- }
22
17
  return $.extend({
23
18
  dataType: 'json',
24
19
  cache: false,
@@ -1,8 +1,7 @@
1
1
  /**
2
- * Jelly. a sweet unobtrusive javascript framework
3
- * for jQuery and Rails
2
+ * Jelly. a sweet unobtrusive javascript framework for Rails
4
3
  *
5
- * version 0.8.13
4
+ * version 0.10.0
6
5
  *
7
6
  * Copyright (c) 2009 Pivotal Labs
8
7
  * Licensed under the MIT license.
@@ -11,28 +10,36 @@
11
10
  *
12
11
  */
13
12
 
14
- (function($) {
15
- if (!window.Jelly) window.Jelly = new Object();
13
+ (function () {
14
+ if (!window.Jelly) window.Jelly = {};
16
15
  var Jelly = window.Jelly;
17
16
  if (!Function.prototype.bind) {
18
- Function.prototype.bind = function(object) {
17
+ Function.prototype.bind = function (object) {
19
18
  var self = this;
20
- return function() {
19
+ return function () {
21
20
  return self.apply(object, arguments);
22
21
  }
23
22
  }
24
23
  }
25
- $.extend(Jelly, {
26
- init: function() {
24
+ var extend = function (destination, source) {
25
+ for (var m in source) {
26
+ if (source.hasOwnProperty(m)) {
27
+ destination[m] = source[m];
28
+ }
29
+ }
30
+ return destination;
31
+ };
32
+ extend(Jelly, {
33
+ init:function () {
27
34
  this.observers = [];
28
35
  this.attach = this.Observers.attach;
29
36
  this.notifyObservers = this.Observers.notify;
30
37
  this.Pages.init();
31
38
  },
32
39
 
33
- Observers: {
34
- attach: function() {
35
- if (this == Jelly) {
40
+ Observers:{
41
+ attach:function () {
42
+ if (this === Jelly) {
36
43
  return Jelly.Observers.attach.apply(this.observers, arguments);
37
44
  }
38
45
  for (var i = 0; i < arguments.length; i++) {
@@ -54,23 +61,23 @@
54
61
  }
55
62
  },
56
63
 
57
- evaluateComponent: function(component) {
64
+ evaluateComponent:function (component) {
58
65
  return eval(component);
59
66
  },
60
67
 
61
- pushIfObserver: function(observer) {
68
+ pushIfObserver:function (observer) {
62
69
  if (observer) {
63
70
  this.push(observer);
64
71
  }
65
72
  },
66
73
 
67
- notify: function(instructions) {
68
- if (this == Jelly) {
74
+ notify:function (instructions) {
75
+ if (this === Jelly) {
69
76
  return Jelly.Observers.notify.apply(this.observers, arguments);
70
77
  }
71
78
  var previousNotifying = Jelly.Observers.notifying;
72
79
  Jelly.Observers.notifying = true;
73
- if (!$.isArray(instructions)) {
80
+ if (Object.prototype.toString.call(instructions) !== "[object Array]") {
74
81
  instructions = [instructions];
75
82
  }
76
83
 
@@ -102,7 +109,7 @@
102
109
  Jelly.Observers.notifying = previousNotifying;
103
110
  },
104
111
 
105
- notifyObserver: function(observer, method, arguments) {
112
+ notifyObserver:function (observer, method, arguments) {
106
113
  if (observer[method]) {
107
114
  if (observer.detach && observer.detach()) {
108
115
  Jelly.Observers.garbageCollectObserver.call(this, observer);
@@ -112,39 +119,39 @@
112
119
  }
113
120
  },
114
121
 
115
- notifying: false,
122
+ notifying:false,
116
123
 
117
- garbageCollectObserver: function(observer) {
124
+ garbageCollectObserver:function (observer) {
118
125
  var index = this.indexOf(observer);
119
126
  if (index > -1) {
120
127
  Jelly.Observers.remove.call(this, index, index + 1);
121
128
  }
122
129
  },
123
130
 
124
- remove: function(from, to) {
131
+ remove:function (from, to) {
125
132
  var rest = this.slice((to || from) + 1 || this.length);
126
133
  this.length = from < 0 ? this.length + from : from;
127
134
  return this.push.apply(this, rest);
128
135
  }
129
136
  },
130
137
 
131
- Pages: {
132
- init: function() {
138
+ Pages:{
139
+ init:function () {
133
140
  this.all = {};
134
141
  Jelly.all = this.all; // Deprecated
135
142
  },
136
143
 
137
- add: function(name) {
144
+ add:function (name) {
138
145
  var page = new Jelly.Page.Constructor(name);
139
146
  for (var i = 1; i < arguments.length; i++) {
140
- $.extend(page, arguments[i]);
147
+ extend(page, arguments[i]);
141
148
  }
142
149
  return page;
143
150
  }
144
151
  },
145
152
 
146
- Page: {
147
- init: function(controllerName, actionName) {
153
+ Page:{
154
+ init:function (controllerName, actionName) {
148
155
  var page = Jelly.Pages.all[controllerName] || new Jelly.Page.Constructor(controllerName);
149
156
  window.page = page;
150
157
  if (page.all) page.all();
@@ -152,7 +159,7 @@
152
159
  page.loaded = true;
153
160
  return page;
154
161
  },
155
- Constructor: function(name) {
162
+ Constructor:function (name) {
156
163
  this.loaded = false;
157
164
  this.documentHref = Jelly.Location.documentHref;
158
165
 
@@ -161,13 +168,16 @@
161
168
  }
162
169
  },
163
170
 
164
- Location: {
165
- on_redirect: function(location) {
166
- top.location.href = location;
171
+ Location:{
172
+ on_redirect:function (location) {
173
+ this.window().top.location.href = location;
174
+ },
175
+ window:function () {
176
+ return window;
167
177
  }
168
178
  }
169
179
  });
170
180
  Jelly.add = Jelly.Pages.add; // Deprecated
171
181
 
172
182
  Jelly.init();
173
- })(jQuery)
183
+ })();
data/jelly.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{honkster-jelly}
8
- s.version = "0.9.3"
8
+ s.version = "0.10.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"]
@@ -48,23 +48,6 @@ describe("Jelly", function() {
48
48
  expect(ajaxParams['type']).toEqual('DELETE');
49
49
  });
50
50
 
51
- describe("whether to set authenticity token", function() {
52
- it("should set an auth token when type is not a GET", function() {
53
- var ajaxParams = $.ajaxWithJelly.params({type: "NON-GET"});
54
- expect(ajaxParams['data']['authenticity_token']).toEqual(our_token);
55
- });
56
-
57
- it("should not set an auth token when type is not passed in", function() {
58
- var ajaxParams = $.ajaxWithJelly.params();
59
- expect(ajaxParams['data']).toEqual(undefined);
60
- });
61
-
62
- it("should not set an auth token when type is GET", function() {
63
- var ajaxParams = $.ajaxWithJelly.params({type: "GET"});
64
- expect(ajaxParams['data']).toEqual(undefined);
65
- });
66
- });
67
-
68
51
  describe(".ajaxWithJelly.params.success", function() {
69
52
  describe("when no observers are passed into params", function() {
70
53
  it("calls Jelly.notifyObservers on Jelly.observers", function() {
@@ -641,7 +641,8 @@ describe("Jelly.Location", function() {
641
641
 
642
642
  describe(".on_redirect", function() {
643
643
  it("sets top.location.href to the given location", function() {
644
- window.top = {location: {}};
644
+ var window = {top: {location: {}}};
645
+ spyOn(Jelly.Location, "window").andReturn(window);
645
646
  Jelly.Location.on_redirect("http://mars.com");
646
647
  expect(window.top.location.href).toEqual("http://mars.com");
647
648
  });
metadata CHANGED
@@ -1,24 +1,28 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: honkster-jelly
3
- version: !ruby/object:Gem::Version
4
- version: 0.9.3
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.10.0
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Pivotal Labs, Inc
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-06-14 00:00:00.000000000Z
12
+
13
+ date: 2011-06-14 00:00:00 -07:00
14
+ default_executable:
13
15
  dependencies: []
14
- description: Jelly provides a set of tools and conventions for creating rich ajax/javascript
15
- web applications with jQuery and Ruby on Rails.
16
+
17
+ description: Jelly provides a set of tools and conventions for creating rich ajax/javascript web applications with jQuery and Ruby on Rails.
16
18
  email: opensource@pivotallabs.com
17
19
  executables: []
20
+
18
21
  extensions: []
19
- extra_rdoc_files:
22
+
23
+ extra_rdoc_files:
20
24
  - README.markdown
21
- files:
25
+ files:
22
26
  - .bundle/config
23
27
  - .gitignore
24
28
  - .rvmrc
@@ -120,108 +124,33 @@ files:
120
124
  - spec/spec_suite.rb
121
125
  - tasks/jelly_tasks.rake
122
126
  - uninstall.rb
127
+ has_rdoc: true
123
128
  homepage: http://github.com/pivotal/jelly
124
129
  licenses: []
130
+
125
131
  post_install_message:
126
132
  rdoc_options: []
127
- require_paths:
133
+
134
+ require_paths:
128
135
  - lib
129
- required_ruby_version: !ruby/object:Gem::Requirement
136
+ required_ruby_version: !ruby/object:Gem::Requirement
130
137
  none: false
131
- requirements:
132
- - - ! '>='
133
- - !ruby/object:Gem::Version
134
- version: '0'
135
- required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: "0"
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
143
  none: false
137
- requirements:
138
- - - ! '>='
139
- - !ruby/object:Gem::Version
140
- version: '0'
144
+ requirements:
145
+ - - ">="
146
+ - !ruby/object:Gem::Version
147
+ version: "0"
141
148
  requirements: []
149
+
142
150
  rubyforge_project:
143
- rubygems_version: 1.8.6
151
+ rubygems_version: 1.3.9.2
144
152
  signing_key:
145
153
  specification_version: 3
146
154
  summary: a sweet unobtrusive javascript framework for jQuery and Rails
147
- test_files:
148
- - spec/fixtures/public/javascripts/components/component1.js
149
- - spec/fixtures/public/javascripts/foo/components/paw.js
150
- - spec/fixtures/public/javascripts/foo/components/teeth.js
151
- - spec/fixtures/public/javascripts/foo/pages/bears.js
152
- - spec/fixtures/public/javascripts/foo/pages/lions.js
153
- - spec/fixtures/public/javascripts/foo/pages/tigers.js
154
- - spec/fixtures/public/javascripts/pages/page1.js
155
- - spec/jasmine/TrivialReporter.js
156
- - spec/jasmine/jasmine-0.10.0.js
157
- - spec/jasmine/jasmine.css
158
- - spec/jasmine/json2.js
159
- - spec/jasmine_runner.html
160
- - spec/javascript/ajax_with_jelly_spec.js
161
- - spec/javascript/jelly_spec.js
162
- - spec/javascript/spec_helper.js
163
- - spec/jelly/common_spec.rb
164
- - spec/jelly/jelly_controller_spec.rb
165
- - spec/jelly/jelly_helper_spec.rb
166
- - spec/rails_root/.gitignore
167
- - spec/rails_root/Gemfile
168
- - spec/rails_root/Gemfile.lock
169
- - spec/rails_root/README
170
- - spec/rails_root/Rakefile
171
- - spec/rails_root/app/controllers/application_controller.rb
172
- - spec/rails_root/app/helpers/application_helper.rb
173
- - spec/rails_root/app/views/layouts/application.html.erb
174
- - spec/rails_root/config.ru
175
- - spec/rails_root/config/application.rb
176
- - spec/rails_root/config/boot.rb
177
- - spec/rails_root/config/database.yml
178
- - spec/rails_root/config/environment.rb
179
- - spec/rails_root/config/environments/development.rb
180
- - spec/rails_root/config/environments/production.rb
181
- - spec/rails_root/config/environments/test.rb
182
- - spec/rails_root/config/initializers/backtrace_silencers.rb
183
- - spec/rails_root/config/initializers/inflections.rb
184
- - spec/rails_root/config/initializers/mime_types.rb
185
- - spec/rails_root/config/initializers/new_rails_defaults.rb
186
- - spec/rails_root/config/initializers/secret_token.rb
187
- - spec/rails_root/config/initializers/session_store.rb
188
- - spec/rails_root/config/locales/en.yml
189
- - spec/rails_root/config/routes.rb
190
- - spec/rails_root/db/seeds.rb
191
- - spec/rails_root/db/test.sqlite3
192
- - spec/rails_root/doc/README_FOR_APP
193
- - spec/rails_root/lib/tasks/.gitkeep
194
- - spec/rails_root/log/development.log
195
- - spec/rails_root/log/production.log
196
- - spec/rails_root/log/server.log
197
- - spec/rails_root/log/test.log
198
- - spec/rails_root/public/404.html
199
- - spec/rails_root/public/422.html
200
- - spec/rails_root/public/500.html
201
- - spec/rails_root/public/favicon.ico
202
- - spec/rails_root/public/images/rails.png
203
- - spec/rails_root/public/index.html
204
- - spec/rails_root/public/javascripts/application.js
205
- - spec/rails_root/public/javascripts/controls.js
206
- - spec/rails_root/public/javascripts/dragdrop.js
207
- - spec/rails_root/public/javascripts/effects.js
208
- - spec/rails_root/public/javascripts/prototype.js
209
- - spec/rails_root/public/javascripts/rails.js
210
- - spec/rails_root/public/robots.txt
211
- - spec/rails_root/public/stylesheets/.gitkeep
212
- - spec/rails_root/script/about
213
- - spec/rails_root/script/console
214
- - spec/rails_root/script/dbconsole
215
- - spec/rails_root/script/destroy
216
- - spec/rails_root/script/generate
217
- - spec/rails_root/script/performance/benchmarker
218
- - spec/rails_root/script/performance/profiler
219
- - spec/rails_root/script/plugin
220
- - spec/rails_root/script/rails
221
- - spec/rails_root/script/runner
222
- - spec/rails_root/script/server
223
- - spec/rails_root/test/performance/browsing_test.rb
224
- - spec/rails_root/test/test_helper.rb
225
- - spec/rails_root/vendor/plugins/.gitkeep
226
- - spec/spec_helper.rb
227
- - spec/spec_suite.rb
155
+ test_files: []
156
+