jquery_on_rails 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,8 +1,11 @@
1
1
  = jquery_on_rails
2
2
 
3
- A complete replacement for Rails 3 javascript helpers and unobstrusive javacript (ujs)
3
+ A drop-in replacement for Rails 3 javascript helpers and unobstrusive javacript (ujs)
4
4
  using JQuery instead of prototype/scriptaculous.
5
5
 
6
+ * JavaScriptGenerator and friends refactored from Rails' PrototypeHelper implementation
7
+ http://github.com/rails/rails
8
+
6
9
  * Rails 3 unobtrusive JavaScript helpers "borrowed" from Russell Jones
7
10
  http://github.com/CodeOfficer/jquery-helpers-for-rails3
8
11
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{jquery_on_rails}
8
- s.version = "0.1.1"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joe Khoobyar"]
@@ -308,5 +308,40 @@ module JQueryOnRails
308
308
  end
309
309
 
310
310
  end
311
+
312
+ class JavaScriptProxy < ActionView::Helpers::JavaScriptProxy
313
+ end
314
+ class JavaScriptVariableProxy < ActionView::Helpers::JavaScriptVariableProxy
315
+ end
316
+
317
+ # Adapted from Rails 3
318
+ class JavaScriptElementProxy < JavaScriptProxy
319
+ def initialize(generator, id)
320
+ @id = id
321
+ super(generator, "$(#{::ActiveSupport::JSON.encode('#'+id)})")
322
+ end
323
+
324
+ def [](attribute)
325
+ append_to_function_chain!(attribute)
326
+ self
327
+ end
328
+
329
+ def []=(variable, value)
330
+ assign(variable, value)
331
+ end
332
+
333
+ def replace_html(*options_for_render)
334
+ call 'html', @generator.send(:render, *options_for_render)
335
+ end
336
+
337
+ def replace(*options_for_render)
338
+ call 'replaceWith', @generator.send(:render, *options_for_render)
339
+ end
340
+
341
+ def reload(options_for_replace = {})
342
+ replace(options_for_replace.merge({ :partial => @id.to_s }))
343
+ end
344
+ end
345
+
311
346
  end
312
347
  end
data/spec/spec_helper.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  ENV["RAILS_ENV"] = "test"
2
2
 
3
+ require 'rubygems'
3
4
  require 'pp'
4
5
  begin require 'win32console' and include Win32::Console::ANSI
5
6
  rescue LoadError
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 1
9
- version: 0.1.1
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joe Khoobyar