Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
Add the more standard "Sign in with Twitter/Facebook" buttons, includ…
Browse files Browse the repository at this point in the history
…ing helpers to insert them. Encapsulate the twitter and facebook auth URLs in an auth_request_path helper.
  • Loading branch information
timriley committed Oct 10, 2010
1 parent 6705dfa commit 62004ad
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 9 deletions.
18 changes: 15 additions & 3 deletions app/helpers/omnisocial/auth_helper.rb
@@ -1,11 +1,23 @@
module Omnisocial
module AuthHelper
def twitter_login_button
content_tag(:a, content_tag(:span, 'Sign in with Twitter'), :class => 'twitter', :href => '/auth/twitter')
def auth_request_path(options = {})
"/auth/#{options[:service]}"
end

def big_twitter_login_button
content_tag(:a, content_tag(:span, 'Sign in with Twitter'), :class => 'twitter', :href => auth_request_path(:service => 'twitter'))
end

def big_facebook_login_button
content_tag(:a, content_tag(:span, 'Sign in with Facebook'), :class => 'facebook', :href => auth_request_path(:service => 'facebook'))
end

def twitter_login_button
content_tag(:a, content_tag(:img, :src => '/images/omnisocial/signin_twitter.png', :alt => 'Sign in with Twitter'), :href => auth_request_path(:service => 'twitter'))
end

def facebook_login_button
content_tag(:a, content_tag(:span, 'Sign in with Facebook'), :class => 'facebook', :href => '/auth/facebook')
content_tag(:a, content_tag(:img, :src => '/images/omnisocial/signin_facebook.png', :alt => 'Sign in with Facebook'), :href => auth_request_path(:service => 'facebook'))
end
end
end
4 changes: 2 additions & 2 deletions app/views/omnisocial/auth/new.html.erb
Expand Up @@ -18,6 +18,6 @@
It&#8217;ll only take a second and your information will be perfectly safe. We don't get access to your password and <em>we won't post or tweet anything from your account</em> without your explicit permission.
</p>
</div>
<%= twitter_login_button %>
<%= facebook_login_button %>
<%= big_twitter_login_button %>
<%= big_facebook_login_button %>
</div>
6 changes: 4 additions & 2 deletions lib/generators/omnisocial/omnisocial_generator.rb
Expand Up @@ -32,8 +32,10 @@ def copy_initializer

def copy_assets
copy_file 'assets/stylesheets/omnisocial.css', 'public/stylesheets/omnisocial.css'
copy_file 'assets/images/twitter.gif', 'public/images/twitter.gif'
copy_file 'assets/images/facebook.png', 'public/images/facebook.png'
copy_file 'assets/images/twitter.gif', 'public/images/omnisocial/twitter.gif'
copy_file 'assets/images/facebook.png', 'public/images/omnisocial/facebook.png'
copy_file 'assets/images/signin_twitter.png', 'public/images/omnisocial/signin_twitter.png'
copy_file 'assets/images/signin_facebook.png', 'public/images/omnisocial/signin_facebook.png'
end

def show_readme
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -41,14 +41,14 @@
margin-right: 40px;
width: 450px; }
#oauth .twitter {
background: url(/images/twitter.gif) center center no-repeat;
background: url(/images/omnisocial/twitter.gif) center center no-repeat;
float: left;
height: 255px;
width: 200px; }
#oauth .twitter span {
margin: 240px 0 0 25px; }
#oauth .facebook {
background: url(/images/facebook.png) center center no-repeat;
background: url(/images/omnisocial/facebook.png) center center no-repeat;
float: left;
margin-left: 40px;
height: 255px;
Expand Down

0 comments on commit 62004ad

Please sign in to comment.