Search code examples
ruby-on-railstwitter-bootstrapomniauth-facebook

How to make a correct link to sign in via Facebook using a button from bootstrap-social


I'm using Omniauth on my Rails website to make possible sign in with Facebook.

I have the following button:

<a class="btn btn-block btn-social btn-facebook">
<i class="fa fa-facebook"></i> Sign in with Facebook

I followed installation instructions from here: Social Sign-In Buttons made in pure CSS based on Bootstrap and Font Awesome

I need to link the button to sign in using Facebook, making it look similar to:

<%= link_to "Login with Facebook", new_user_registration_path %>

I tried the following options but no one shows the button correctly:

<a class="btn btn-block btn-social btn-facebook">
<i class="fa fa-facebook"></i> <%= link_to "Login via Facebook", user_omniauth_authorize_path(:facebook) %>
</a>

or

<%= link_to user_omniauth_authorize_path(:facebook) do %>
<div class="btn btn-block btn-social btn-facebook"> 
        <i class="fa fa-facebook"></i> Sign in with Facebook
</div>
<% end %>

Solution

  • I found a solution - the following code is correct:

    <%= link_to user_omniauth_authorize_path(:facebook) do%>
    <div class="btn-lg btn-block btn-social btn-facebook"> 
            <i class="fa fa-facebook"></i> Sign in with Facebook
    </div>
    <% end %>
    

    It was placed inside <p></p> tag, that's why the height was cut