de_rjs 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da7377a69fb9bcc6c69b25e0972f8fdfa51af1d9
4
- data.tar.gz: 6ea98789b3bb597dbdf98c457975f2002f77cdac
3
+ metadata.gz: ef7b1985606279e19f688ce19a2bf653ec16b9f2
4
+ data.tar.gz: 1d4b2e9945ef5faf9364b45da0d5c9a162d98e2d
5
5
  SHA512:
6
- metadata.gz: 15564eabf6d2a638cfadab4da2671d9f6a5d915c02d0aee68f6dcf0959c0d782829b7cf1516631228bcf41dc8c42cfcb032d77d810bf114ec035832bd3e51fe0
7
- data.tar.gz: 64264098fb4c161a45aaea42faa042ec8681f8085b039eaf4862d31c7f96f6afacacb960cf10e6dc460d349b6009930e0d11f99e2da5ffd87c4883d35498d4e2
6
+ metadata.gz: '048cff985a57484e5a978347761e9a72fd80a7f7ba6cbf3250099ae5b6163faf339eb80bf55927c6e85ec9141603d092d2f09abf4e9eae77ae0b1e3fc57f10a7'
7
+ data.tar.gz: 749b55aa71df3705d28470be60aad909828483107d3636239110246fc8373ddffa0aa6cd9a9c5e8abf2d252472f0054a93cd6fda5fa91b46bfb723d44bbc7f9e
@@ -472,6 +472,14 @@ module DeRjs
472
472
  element = "this"
473
473
  end
474
474
 
475
+ #if ['fadeIn','fadeOut','fadeToggle'].include?(name)
476
+ # "$(\"#{jquery_id(element_id)}\").#{name}();"
477
+ #else
478
+ "#{JQUERY_VAR}(#{element}).#{jquery_ui_effect(name, js_options)}"
479
+ #end
480
+ end
481
+
482
+ def jquery_ui_effect(name, js_options)
475
483
  if SCRIPTACULOUS_EFFECTS.has_key? name.to_sym
476
484
  effect = SCRIPTACULOUS_EFFECTS[name.to_sym]
477
485
  name = effect[:method]
@@ -490,13 +498,7 @@ module DeRjs
490
498
  end
491
499
 
492
500
  js_options[:duration] = (js_options[:duration] * 1000).to_i if js_options.has_key? :duration
493
-
494
- #if ['fadeIn','fadeOut','fadeToggle'].include?(name)
495
- # "$(\"#{jquery_id(element_id)}\").#{name}();"
496
- #else
497
- "#{JQUERY_VAR}(#{element}).#{mode || "effect"}(\"#{name}\",#{options_for_javascript(js_options)});"
498
- #end
499
-
501
+ "#{mode || "effect"}(\"#{name}\",#{options_for_javascript(js_options)})"
500
502
  end
501
503
 
502
504
  def arguments_for_call(arguments, block = nil)
@@ -645,6 +647,10 @@ module DeRjs
645
647
  call 'replaceWith', @generator.send(:render, *options_for_render)
646
648
  end
647
649
 
650
+ def visual_effect(name, options = {})
651
+ append_to_function_chain!(@generator.send(:jquery_ui_effect, name, options))
652
+ end
653
+
648
654
  def reload(options_for_replace = {})
649
655
  replace(options_for_replace.merge({ :partial => @id.to_s.sub(/^#/,'') }))
650
656
  end
data/test/de_rjs_test.rb CHANGED
@@ -204,6 +204,9 @@ jQuery("#baz").html("\\u003cp\\u003eThis is a test\\u003c/p\\u003e");
204
204
  def test_visual_effect
205
205
  assert_equal %(jQuery(\"#blah\").effect(\"puff\",{});),
206
206
  generate_js(%Q{ page.visual_effect(:puff,'blah') })
207
+
208
+ assert_equal %(jQuery(\"#blah\").effect(\"puff\",{});),
209
+ generate_js(%Q{ page['blah'].visual_effect(:puff) })
207
210
  end
208
211
 
209
212
  def test_visual_effect_toggle
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: de_rjs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thong Kuah