3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/authlogic_facebook_connect/helper.rb', line 3
def authlogic_facebook_login_button(options = {})
options[:controller] ||= "user_session"
options[:js] ||= :prototype
case options[:js]
when :prototype
js_selector = "$('connect_to_facebook_form')"
when :jquery
js_selector = "jQuery('#connect_to_facebook_form')"
end
output = "<form id='connect_to_facebook_form' method='post' action='/#{options[:controller]}'>\n"
output << "<input type='hidden' name='authenticity_token' value='#{form_authenticity_token}'/>\n"
output << "</form>\n"
output << "<script type='text/javascript' charset='utf-8'>\n"
output << " function connect_to_facebook() {\n"
output << " #{js_selector}.submit();\n"
output << " }\n"
output << "</script>\n"
options.delete(:controller)
output << fb_login_button("connect_to_facebook()", options)
output
end
|