Skip to content
Extraits de code Groupes Projets
Valider 9571ade8 rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

basic setup

parent 08df7e12
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -21,6 +21,7 @@ gem 'will_paginate', '3.0.pre2' ...@@ -21,6 +21,7 @@ gem 'will_paginate', '3.0.pre2'
gem 'roxml', :git => 'git://github.com/Empact/roxml.git' gem 'roxml', :git => 'git://github.com/Empact/roxml.git'
gem 'addressable', :require => 'addressable/uri' gem 'addressable', :require => 'addressable/uri'
gem 'json' gem 'json'
gem 'mini_fb'
#Standards #Standards
gem 'pubsubhubbub' gem 'pubsubhubbub'
......
...@@ -142,6 +142,9 @@ GEM ...@@ -142,6 +142,9 @@ GEM
mime-types mime-types
treetop (>= 1.4.5) treetop (>= 1.4.5)
mime-types (1.16) mime-types (1.16)
mini_fb (1.1.3)
hashie
rest-client
mini_magick (2.1) mini_magick (2.1)
subexec (~> 0.0.4) subexec (~> 0.0.4)
mocha (0.9.8) mocha (0.9.8)
...@@ -252,6 +255,7 @@ DEPENDENCIES ...@@ -252,6 +255,7 @@ DEPENDENCIES
jnunemaker-validatable (= 1.8.4)! jnunemaker-validatable (= 1.8.4)!
json json
magent! magent!
mini_fb
mini_magick mini_magick
mocha mocha
mongo_mapper (= 0.8.4)! mongo_mapper (= 0.8.4)!
......
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
class ServicesController < ApplicationController
def create
puts 'services/create'
p params
code = params['code'] # Facebooks verification string
if code
access_token_hash = MiniFB.oauth_access_token(FB_APP_ID, HOST + "services/create", FB_SECRET, code)
p access_token_hash
@access_token = access_token_hash["access_token"]
# TODO: This is where you'd want to store the token in your database
# but for now, we'll just keep it in the cookie so we don't need a database
cookies[:access_token] = @access_token
flash[:success] = "Authentication successful."
end
redirect_to edit_user_url current_user
end
end
...@@ -13,6 +13,9 @@ class UsersController < ApplicationController ...@@ -13,6 +13,9 @@ class UsersController < ApplicationController
@person = @user.person @person = @user.person
@profile = @user.profile @profile = @user.profile
@photos = Photo.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC' @photos = Photo.find_all_by_person_id(@person.id).paginate :page => params[:page], :order => 'created_at DESC'
@fb_access_url = MiniFB.oauth_url(FB_APP_ID, HOST + "services/create",
:scope=>MiniFB.scopes.join(","))
end end
def update def update
......
...@@ -53,6 +53,14 @@ ...@@ -53,6 +53,14 @@
= p.label :last_name = p.label :last_name
= p.text_field :last_name, :value => @profile.last_name = p.text_field :last_name, :value => @profile.last_name
%br
%br
%h3 Connect with Facebook
%p
= link_to "Login to Facebook", @fb_access_url
#submit_block #submit_block
= link_to "Cancel", root_path = link_to "Cancel", root_path
or or
......
...@@ -8,7 +8,14 @@ ...@@ -8,7 +8,14 @@
require File.expand_path('../application', __FILE__) require File.expand_path('../application', __FILE__)
Haml::Template.options[:format] = :html5 Haml::Template.options[:format] = :html5
Haml::Template.options[:escape_html] = true Haml::Template.options[:escape_html] = true
# Load facebook connection application credentials
fb_config = YAML::load(File.open(File.expand_path("./config/fb_config.yml")))
FB_API_KEY = fb_config['fb_api_key']
FB_SECRET = fb_config['fb_secret']
FB_APP_ID = fb_config['fb_app_id']
HOST = fb_config['host']
# Initialize the rails application # Initialize the rails application
Diaspora::Application.initialize! Diaspora::Application.initialize!
fb_api_key: {dcf4e90df086cf6d3e531b31e043ff32}
fb_secret: {36917c2878d658b8c575952b6a78e3c3}
fb_app_id: {120373411325347}
host: http://localhost:3000/
...@@ -5,32 +5,33 @@ ...@@ -5,32 +5,33 @@
Diaspora::Application.routes.draw do Diaspora::Application.routes.draw do
resources :people, :only => [:index, :show, :destroy] resources :people, :only => [:index, :show, :destroy]
resources :users, :except => [:create, :new, :show] resources :users, :except => [:create, :new, :show]
resources :status_messages, :only => [:create, :destroy, :show] resources :status_messages, :only => [:create, :destroy, :show]
resources :comments, :except => [:index] resources :comments, :except => [:index]
resources :requests, :except => [:edit, :update] resources :requests, :except => [:edit, :update]
resources :photos, :except => [:index] resources :photos, :except => [:index]
resources :albums resources :albums
match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends' match 'aspects/move_friends', :to => 'aspects#move_friends', :as => 'move_friends'
match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend' match 'aspects/move_friend', :to => 'aspects#move_friend', :as => 'move_friend'
match 'aspects/manage', :to => 'aspects#manage' match 'aspects/manage', :to => 'aspects#manage'
resources :aspects, :except => [:edit] resources :aspects, :except => [:edit]
match 'services/create', :to => "services#create"
match 'warzombie', :to => "dev_utilities#warzombie" match 'warzombie', :to => "dev_utilities#warzombie"
match 'zombiefriends', :to => "dev_utilities#zombiefriends" match 'zombiefriends', :to => "dev_utilities#zombiefriends"
match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept" match 'zombiefriendaccept', :to => "dev_utilities#zombiefriendaccept"
match 'set_backer_number', :to => "dev_utilities#set_backer_number" match 'set_backer_number', :to => "dev_utilities#set_backer_number"
match 'set_profile_photo', :to => "dev_utilities#set_profile_photo" match 'set_profile_photo', :to => "dev_utilities#set_profile_photo"
#routes for devise, not really sure you will need to mess with this in the future, lets put default, #routes for devise, not really sure you will need to mess with this in the future, lets put default,
#non mutable stuff in anohter file #non mutable stuff in anohter file
devise_for :users, :controllers => {:registrations => "registrations"} devise_for :users, :controllers => {:registrations => "registrations"}
match 'login', :to => 'devise/sessions#new', :as => "new_user_session" match 'login', :to => 'devise/sessions#new', :as => "new_user_session"
match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session" match 'logout', :to => 'devise/sessions#destroy', :as => "destroy_user_session"
match 'signup', :to => 'registrations#new', :as => "new_user_registration" match 'signup', :to => 'registrations#new', :as => "new_user_registration"
match 'get_to_the_choppa', :to => redirect("/signup") match 'get_to_the_choppa', :to => redirect("/signup")
#public routes #public routes
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter