plataforma_social 0.0.26 → 0.0.27

Sign up to get free protection for your applications and to get access to all the features.
@@ -53,5 +53,9 @@ module PlataformaSocial
53
53
  configuration.admin_controller_name || 'admin'
54
54
  end
55
55
 
56
+ def environment
57
+ configuration.environment || Rails.env.to_s
58
+ end
59
+
56
60
  end
57
61
  end
@@ -1,5 +1,5 @@
1
1
  module PlataformaSocial
2
2
  class Configuration
3
- attr_accessor :api_key, :secret, :facebook_app_secret, :facebook_app_id, :facebook_app_namespace, :facebook_scope, :facebook_callback_url, :admin_controller_name
3
+ attr_accessor :api_key, :secret, :facebook_app_secret, :facebook_app_id, :facebook_app_namespace, :facebook_scope, :facebook_callback_url, :admin_controller_name, :environment
4
4
  end
5
5
  end
@@ -15,7 +15,7 @@ module PlataformaSocial
15
15
  if domains[module_name.to_sym].present?
16
16
  name = domains[module_name.to_sym]
17
17
 
18
- url = case Rails.env
18
+ url = case environment
19
19
  when "production"
20
20
  "https://#{name}.plataformasocial.com.br"
21
21
  when "development"
@@ -29,7 +29,7 @@ module PlataformaSocial
29
29
  end
30
30
  end
31
31
  end
32
-
32
+
33
33
  render :text => %|<script type="text/javascript">window.top.location.href="#{@oauth.url_for_oauth_code(:permissions => PlataformaSocial.configuration.facebook_scope)}";</script>| if redirect
34
34
  end
35
35
 
@@ -94,30 +94,28 @@ module PlataformaSocial
94
94
  params.present? && params[:controller].present? && params[:controller].index(PlataformaSocial.admin_controller_name) == 0
95
95
  end
96
96
 
97
- def link_to *args, &block
98
- args[2] ||= {}
99
-
100
- if args[2][:normal] === true
101
- super
97
+ def link_to_facebook *args, &block
98
+ if block_given?
99
+ href = capture(&block)
100
+
101
+ args.unshift(href)
102
+
103
+ link_to_facebook *args
102
104
  else
103
- unless block_given?
104
- if from_facebook? && !from_admin?
105
- server_domain = request.env['HTTP_HOST']
106
- url = 'apps.facebook.com/' + PlataformaSocial.facebook_app_namespace
107
-
108
- if args[1].include? server_domain
109
- args[1].gsub! server_domain, url
110
- else
111
- args[1] = request.protocol + url + args[1]
112
- end
113
-
114
- args[2][:target] = '_top'
115
- else
116
- super
117
- end
105
+ args[2] ||= {}
106
+
107
+ server_domain = request.env['HTTP_HOST']
108
+ url = 'apps.facebook.com/' + PlataformaSocial.facebook_app_namespace
109
+
110
+ if args[1].include? server_domain
111
+ args[1].gsub! server_domain, url
112
+ else
113
+ args[1] = request.protocol + url + args[1]
118
114
  end
115
+
116
+ args[2][:target] = '_top'
119
117
 
120
- super
118
+ return link_to *args
121
119
  end
122
120
  end
123
121
  end
@@ -1,3 +1,3 @@
1
1
  module PlataformaSocial
2
- VERSION = "0.0.26"
2
+ VERSION = "0.0.27"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plataforma_social
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.26
4
+ version: 0.0.27
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-11 00:00:00.000000000 Z
12
+ date: 2013-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano