2011-12-21 45 views
0

後,我一直在使用爲Facebook inttegration以下的寶石在我的Rails應用程序 - https://github.com/dekart/facebooker2.gitfacebooker 2 - JavaScript回調提交

我已經與它的幾個問題,所以我決定嘗試升級到主要的facebooker gem的最新版本。 - https://github.com/mmangino/facebooker2.git

我的問題是,我似乎無法做回調與新寶石 以前我可以做這樣的事情 -

<%= fb_login(:text=>t('my_text')) do %> 
      $("#myForm").submit(); 
      top.location.href='<%= APP_CONFIG[:somewhere] %>'; 
    <% end %> 

這不是在新的創業板工作,我可以」看看如何在文檔中做到這一點。

是否有可能使用新的facebooker2 gem做javascript回調?


我設法讓做這個工作的JS -

<%- fb_login { concat " $('#myForm').submit();" }%> 

但是我似乎無法添加文字。這會引發錯誤 -

<%- fb_login :text=>t('my text'), { concat " $('#myForm').submit();" }%> 

我確定這只是一個語法問題。任何人看到我做錯了什麼?

+0

嘗試這種情況:<% - fb_login(:文本=> T( '我的文本')){CONCAT「$('# myForm的')提交();」。 }%> – gparis 2011-12-22 14:41:41

回答

0

嘗試使用scriplet代替在第一行的表達式:

<% fb_login(:text=>t('my_text')) do %> 
     $("#myForm").submit(); 
     top.location.href='<%= APP_CONFIG[:somewhere] %>'; 
<% end %> 
+0

這很完美。謝謝。 – Finnnn 2011-12-22 09:51:19

+0

我說得太快了,因爲某種原因,似乎所有東西都呈現兩次。我得到2個Facebook登錄按鈕呈現。 – Finnnn 2011-12-22 09:55:27