link_to_function_helper 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/link_to_function_helper.rb +16 -0
  2. metadata +55 -0
@@ -0,0 +1,16 @@
1
+ module LinkToFunctionHelper
2
+ # Puts the link_to_function back in a non-UJS way. Handy if you're trying to save time doing a Rails 3 upgrade.
3
+ def link_to_function(name, *args, &block)
4
+ html_options = args.extract_options!.symbolize_keys
5
+
6
+ function = block_given? ? update_page(&block) : args[0] || ''
7
+ onclick = "#{"#{html_options[:onclick]}; " if html_options[:onclick]}#{function}; return false;"
8
+ href = html_options[:href] || '#'
9
+
10
+ content_tag(:a, name, html_options.merge(:href => href, :onclick => onclick))
11
+ end
12
+ end
13
+
14
+ if defined?(ActionController)
15
+ ActionController::Base.helper :link_to_function
16
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: link_to_function_helper
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.1.0
6
+ platform: ruby
7
+ authors:
8
+ - Henry Turner
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2012-07-18 00:00:00 Z
14
+ dependencies: []
15
+
16
+ description: Puts the link_to_function back in a non-UJS way. Handy if you're trying to save time doing a Rails 3 upgrade.
17
+ email:
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - lib/link_to_function_helper.rb
26
+ homepage:
27
+ licenses: []
28
+
29
+ post_install_message:
30
+ rdoc_options: []
31
+
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: "0"
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ requirements: []
47
+
48
+ rubyforge_project:
49
+ rubygems_version: 1.8.24
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: Puts the link_to_function back in a non-UJS way. Handy if you're trying to save time doing a Rails 3 upgrade.
53
+ test_files: []
54
+
55
+ has_rdoc: