如何隐藏Link_To生成的文本链接

时间:2021-01-26 06:25:05

I am working on a log in with facebook button

我正在使用facebook按钮登录

<p><%= link_to "Sign in with facebook", user_omniauth_authorize_path(:facebook), :class=>"btn fbSignin", :role => "button", :title => "Sign-in with Facebook"%></p>

so far this gets generated

到目前为止,这产生了

<a class="btn fbSignin" href="/users/auth/facebook" role="button" title="Sign-in with Facebook">Sign in with facebook</a>

I am mounting a design onto a rails app.

我正在将设计安装到rails应用程序上。

The problem is a link that says "Sign in with facebook" gets generated but a box already got generated and it also says sign in with facebook. I tried using button_to instead but the result is the same.

问题是一个链接,上面写着“用facebook登录”,但是已经生成了一个盒子,它还说用facebook登录。我尝试使用button_to,但结果是一样的。

If i do this instead

如果我这样做

<p><%= link_to user_omniauth_authorize_path(:facebook), :class=>"btn fbSignin", :role => "button", :title => "Sign-in with Facebook"%></p>

then /users/auth/facebook gets outputted. I want to hide the outputted link but make the box work properly (going to the right path).

然后/ users / auth / facebook输出。我想隐藏输出的链接,但让盒子正常工作(走向正确的路径)。

2 个解决方案

#1


1  

What about use your text as first arg of the link_to? It outputs the path because you haven't specify the link body(as first argument) #see_here

如何使用您的文本作为link_to的第一个参数?它输出路径,因为您没有指定链接主体(作为第一个参数)#see_here

Try this:

<p><%= link_to '', user_omniauth_authorize_path(:facebook), :class=>"btn fbSignin", :role => "button", :title => "Sign-in with Facebook"%></p>

I hope that helps

我希望有所帮助

#2


0  

You can have it like this

你可以这样做

<%= link_to some_path do %>
  <strong>Awesome link</strong> -- it's pretty awesome
<% end %>

or

<%= link_to "", some_path  %>

or simply use anchor tag

或者只是使用锚标签

<a class="btn fbSignin" href="<%= user_omniauth_authorize_path(:facebook) %>" role="button" title="Sign-in with Facebook"></a>

#1


1  

What about use your text as first arg of the link_to? It outputs the path because you haven't specify the link body(as first argument) #see_here

如何使用您的文本作为link_to的第一个参数?它输出路径,因为您没有指定链接主体(作为第一个参数)#see_here

Try this:

<p><%= link_to '', user_omniauth_authorize_path(:facebook), :class=>"btn fbSignin", :role => "button", :title => "Sign-in with Facebook"%></p>

I hope that helps

我希望有所帮助

#2


0  

You can have it like this

你可以这样做

<%= link_to some_path do %>
  <strong>Awesome link</strong> -- it's pretty awesome
<% end %>

or

<%= link_to "", some_path  %>

or simply use anchor tag

或者只是使用锚标签

<a class="btn fbSignin" href="<%= user_omniauth_authorize_path(:facebook) %>" role="button" title="Sign-in with Facebook"></a>