few updates with fb integration and some other changes in user and supports data to android
Conflicts: vendor/built_in_modules/gallery/app/controllers/panel/gallery/back_end/albums_controller.rb
This commit is contained in:
1 parent
ac58b993c2
commit
5f9190db39
14 files changed
+258
-278
No files matched your search
@@ -42,6 +42,7 @@ class DesktopController< ApplicationController
|
||||
end
|
||||
|
||||
def connections
|
||||
@url = "http://fb.tp.rulingcom.com/login?callback=http://harry.tp.rulingcom.com/facebook/register_fb?user="+current_user.id.to_s
|
||||
render "desktop/settings/connections", :layout => false
|
||||
end
|
||||
|
||||
@@ -149,9 +150,11 @@ class DesktopController< ApplicationController
|
||||
|
||||
def widget_layout
|
||||
widget = DesktopWidget.find(params[:id])
|
||||
# link = '<link href="'+widget.css_default.file.to_s+'" media="screen" rel="stylesheet" type="text/css" />'
|
||||
# link = '<link href="'+widget.css_default.file.to_s+'" media="screen" rel="stylesheet" type="text/css" />'
|
||||
css = widget.css_default.content;
|
||||
css = "<style>" + css + "</style>"
|
||||
content = widget.widget_layout.body
|
||||
dhtml = content
|
||||
dhtml = css + content
|
||||
render :text => dhtml.html_safe
|
||||
end
|
||||
|
||||
@@ -314,5 +317,7 @@ class DesktopController< ApplicationController
|
||||
b = {"success"=>"true"}
|
||||
render :json=>b.to_json
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
@@ -0,0 +1,31 @@
|
||||
require "net/http"
|
||||
require "uri"
|
||||
require 'json'
|
||||
|
||||
class FacebookController< ApplicationController
|
||||
|
||||
def register_fb
|
||||
user = User.find(params[:user])
|
||||
if !user.facebook
|
||||
user.build_facebook(fb_identifier: params[:identifier],connected: true)
|
||||
user.save!
|
||||
end
|
||||
render :json=>{"success"=>true,"user"=>user.facebook.fb_identifier}.to_json
|
||||
end
|
||||
|
||||
def get_friends
|
||||
@url = "http://fb.tp.rulingcom.com/get_friends?identifier=" + current_user.facebook.fb_identifier
|
||||
uri = URI.parse(@url)
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
request = Net::HTTP::Get.new(uri.request_uri)
|
||||
response = http.request(request)
|
||||
friends = response.body
|
||||
friends = JSON.parse(friends)
|
||||
output = Array.new
|
||||
friends.each do |friend|
|
||||
output << friend['name']
|
||||
end
|
||||
render :json=>{"count"=>friends.count,"friends"=>output}.to_json
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user