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 +4 -4
- data/lib/de_rjs/jquery_generator.rb +13 -7
- data/test/de_rjs_test.rb +3 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef7b1985606279e19f688ce19a2bf653ec16b9f2
|
4
|
+
data.tar.gz: 1d4b2e9945ef5faf9364b45da0d5c9a162d98e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|