Jngai1297
Jngai1297

Reputation: 2495

How to Hide Text Link Generated By Link_To

I am working on a log in with facebook button

<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.

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.

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).

Upvotes: 0

Views: 824

Answers (2)

Rahul Singh
Rahul Singh

Reputation: 3427

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>

Upvotes: 0

nronas
nronas

Reputation: 181

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

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

Upvotes: 1

Related Questions