Skip to content

Commit

Permalink
deploying version 0.0.3 to heroku
Browse files Browse the repository at this point in the history
  • Loading branch information
lancejpollard committed May 12, 2010
1 parent 29201c5 commit 1aac543
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 18 deletions.
4 changes: 2 additions & 2 deletions app/controllers/user_sessions_controller.rb
Expand Up @@ -13,7 +13,7 @@ def create
@user_session.save do |result|
if result
flash[:notice] = "Login successful!"
redirect_back_or_default current_user ? profile_url(current_user) : signup_path
redirect_to current_user ? profile_url(current_user) : login_url
else
render :action => :new
end
Expand All @@ -23,6 +23,6 @@ def create
def destroy
current_user_session.destroy
flash[:notice] = "Logout successful!"
redirect_back_or_default login_url
redirect_to login_url
end
end
18 changes: 9 additions & 9 deletions app/models/profile.rb
Expand Up @@ -8,42 +8,42 @@ def self.included(base)
module InstanceMethods

def facebook
if self.active_token.service_name == :facebook
@facebook ||= JSON.parse(self.active_token.get("/me"))
if token = authenticated_with?(:facebook)
@facebook ||= JSON.parse(token.get("/me"))
end
end

def twitter
if self.active_token.service_name == :twitter
@twitter ||= JSON.parse(self.active_token.get("/account/verify_credentials.json").body)
if token = authenticated_with?(:twitter)
@twitter ||= JSON.parse(token.get("/account/verify_credentials.json").body)
end
end

def google
@google ||= "" # todo
end

# primitive profile to show what's possible
def profile
unless @profile
if facebook
@profile = {
@profile = if facebook
{
:id => facebook["id"],
:name => facebook["name"],
:photo => "https://graph.facebook.com/#{facebook["id"]}/picture",
:link => facebook["link"],
:title => "Facebook"
}
elsif twitter
@profile = {
{
:id => twitter["id"],
:name => twitter["name"],
:photo => twitter["profile_image_url"],
:link => "http://twitter.com/#{twitter["screen_name"]}",
:title => "Twitter"
}
else
@profile = {
{
:id => "unknown",
:name => "User",
:photo => "/images/icons/google.png",
Expand Down
6 changes: 5 additions & 1 deletion app/views/layouts/application.html.haml
Expand Up @@ -11,4 +11,8 @@
%li
.content
= yield
.shadow
.shadow
- if current_user
.actions
%a.nice{:href => edit_user_path(@user)} Edit
%a.nice{:href => logout_path} Logout
11 changes: 5 additions & 6 deletions app/views/users/show.html.haml
@@ -1,9 +1,8 @@
%h2= "Hi #{@profile[:name]}!"
%p= "You have connected to your #{current_user.connected_services.join(" and ")} #{'account'.send(current_user.connected_services.length > 1 ? 'pluralize' : 'singularize')}."
- message = "You have connected to your"
- message << " #{current_user.authenticated_with.collect(&:titleize).join(" and ")}"
- message << " #{'account'.send(current_user.authenticated_with.length > 1 ? 'pluralize' : 'singularize')}."
%p= message
%img.profile{:src => @profile[:photo]}
%p
%a{:href => @profile[:link]}= "Your on #{@profile[:title]}!"

%p
= link_to "Edit", edit_user_path(@user)
= link_to "Logout", logout_path
%a{:href => @profile[:link]}= "Your on #{@profile[:title]}!"
34 changes: 34 additions & 0 deletions public/stylesheets/application.css
Expand Up @@ -328,4 +328,38 @@ img.profile {
text-align:center;
margin:auto;
padding:30px;
}
a.nice {
position:relative;
border: 1px solid #ccc;
padding: 10px 20px;
color: #999;
text-decoration: none;
font-size: 28px;
line-height: 30px;
background: #ddd;
border-radius: 12px;
-webkit-border-radius: 12px;
-moz-border-radius: 12px;
box-shadow: 1px 1px 2px rgba(0,0,0,.5);
-webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.5);
-moz-box-shadow: 1px 1px 2px rgba(0,0,0,.5);
text-shadow: #fff 0px 1px 1px;
background: -webkit-gradient(linear, left top, left bottom, from(#eee), to(#ccc));
background: -moz-linear-gradient(top, #eee, #ccc);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eee', endColorstr='#ccc');
}
a:active.nice {
box-shadow: 0px 0px 0px rgba(0,0,0,.5);
-webkit-box-shadow: 0px 0px 0px rgba(0,0,0,.5);
-moz-box-shadow: 0px 0px 0px rgba(0,0,0,.5);
position: relative;
top: 1px;
left: 1px;
}
.actions {
position:relative;
margin:auto;
text-align:center;
top:30px;
}

0 comments on commit 1aac543

Please sign in to comment.