adminpanel 3.3.0 → 3.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/README.md +2 -3
- data/adminpanel.gemspec +1 -3
- data/app/controllers/adminpanel/analytics_controller.rb +0 -22
- data/app/controllers/adminpanel/application_controller.rb +0 -1
- data/app/controllers/adminpanel/sessions_controller.rb +0 -18
- data/app/controllers/concerns/adminpanel/rest_actions.rb +1 -2
- data/app/helpers/adminpanel/adminpanel_form_builder.rb +1 -1
- data/app/helpers/adminpanel/analytics_helper.rb +0 -12
- data/app/helpers/adminpanel/router_helper.rb +0 -4
- data/app/models/concerns/adminpanel/base.rb +0 -4
- data/app/views/adminpanel/analytics/_header.html.erb +0 -3
- data/app/views/adminpanel/templates/index.html.erb +0 -2
- data/app/views/adminpanel/templates/show.html.erb +0 -2
- data/config/locales/es.yml +0 -7
- data/config/routes.rb +0 -15
- data/lib/adminpanel.rb +0 -2
- data/lib/adminpanel/engine.rb +0 -8
- data/lib/adminpanel/version.rb +1 -1
- data/lib/generators/adminpanel/initialize/templates/adminpanel_setup.rb +0 -7
- data/test/dummy/app/models/adminpanel/product.rb +0 -1
- data/test/dummy/app/models/adminpanel/salesman.rb +0 -1
- data/test/features/shared/resource/index_test.rb +0 -1
- data/test/features/shared/ui/action_exclution_test.rb +0 -1
- metadata +27 -42
- data/app/controllers/concerns/adminpanel/analytics/twitter_analytics.rb +0 -25
- data/app/controllers/concerns/adminpanel/twitter_actions.rb +0 -40
- data/app/models/concerns/adminpanel/twitter.rb +0 -27
- data/app/views/adminpanel/analytics/_tweet.html.erb +0 -32
- data/app/views/adminpanel/analytics/_twitter_reply_modal.html.erb +0 -41
- data/app/views/adminpanel/analytics/twitter.html.erb +0 -90
- data/app/views/adminpanel/icons/_twitter.html.erb +0 -29
- data/app/views/adminpanel/shared/_twitter_publish_modal.html.erb +0 -40
- data/config/initializers/adminpanel/twitter_oauth.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45bf3b8b103e42f89ac20af106e0a38595991ff7
|
4
|
+
data.tar.gz: a3a3a0dbc8a9106b3360c0003f73689b3d4addc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 531bfe255ea6323c334cdf79c4378d707e8b973318a7c78e0fd8652cba8e5531e3409ceb5f9028eac07e5c8a5252a8d582bd897e9e321b106f041e53853d726d
|
7
|
+
data.tar.gz: 644bef1f2a45a62d00dc453884cde03b8e79d3415fb4a6d034ed4bb9aa863a2ef96934b17ebc66d13199aaeff80263d7a8beaa402fb2662eb25f162149cae419
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Run:
|
|
21
21
|
rails g adminpanel:initialize
|
22
22
|
rake db:migrate
|
23
23
|
This create and seeds a user to the database (email: 'admin@admin.com', password: 'password').
|
24
|
-
|
24
|
+
|
25
25
|
#### Optional
|
26
26
|
|
27
27
|
Change the path where adminpanel is mounted
|
@@ -37,7 +37,7 @@ Change the panel locale
|
|
37
37
|
|
38
38
|
## Usage
|
39
39
|
|
40
|
-
To create a new resource:
|
40
|
+
To create a new resource:
|
41
41
|
```
|
42
42
|
rails g adminpanel:resource product name price:float description:wysiwyg
|
43
43
|
```
|
@@ -57,7 +57,6 @@ Currently the integrations working are:
|
|
57
57
|
|
58
58
|
* [Google Analytics Service](http://codn.github.io/adminpanel/module/google-analytics.html)
|
59
59
|
* [Facebook Share Link to Wall](http://codn.github.io/adminpanel/module/facebook)
|
60
|
-
* [Twitter API](http://codn.github.io/adminpanel/module/twitter)
|
61
60
|
* [Instagram API](http://codn.github.io/adminpanel/module/instagram)
|
62
61
|
|
63
62
|
Any questions, errors or feature suggestions [are welcome in the issues](https://github.com/codn/adminpanel/issues/new)
|
data/adminpanel.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ['Jose Ramon Camacho', 'Victor Camacho', 'Eduardo Albertos']
|
10
10
|
spec.email = ['info@codn.mx']
|
11
11
|
spec.description = %q{Gem that focus on making a public site's resources very quickly while being very configurable!,
|
12
|
-
supports facebook sharing,
|
12
|
+
supports facebook sharing, instagram and google analytics integration}
|
13
13
|
spec.summary = %q{Made with <3 by CoDN}
|
14
14
|
spec.homepage = 'https://github.com/codn/adminpanel'
|
15
15
|
spec.license = 'MIT'
|
@@ -34,8 +34,6 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_runtime_dependency 'google-api-client', '~> 0.8.6' # Google analytics
|
35
35
|
spec.add_runtime_dependency 'instagram', '~> 1.1', '>= 1.1.3'
|
36
36
|
spec.add_runtime_dependency 'koala', '2.2.0' # Facebook
|
37
|
-
spec.add_runtime_dependency 'omniauth-twitter', '1.1.0' # login Twitter
|
38
|
-
spec.add_runtime_dependency 'twitter', '5.14.0' # Twitter
|
39
37
|
|
40
38
|
# Asset dependencies
|
41
39
|
spec.add_runtime_dependency 'coffee-rails', '~> 4.2', '>= 4.2.0'
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Adminpanel
|
2
2
|
class AnalyticsController < Adminpanel::ApplicationController
|
3
|
-
include Adminpanel::Analytics::TwitterAnalytics
|
4
3
|
include Adminpanel::Analytics::InstagramAnalytics
|
5
4
|
|
6
5
|
skip_before_action :set_resource_collection
|
@@ -82,27 +81,6 @@ module Adminpanel
|
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
85
|
-
# uses @client to fetch replies and tweets, for some statics
|
86
|
-
def twitter
|
87
|
-
authorize! :read, Adminpanel::Analytic
|
88
|
-
if !@twitter_token.nil? && !@twitter_secret.nil?
|
89
|
-
@favorites = 0.0
|
90
|
-
@retweets = 0.0
|
91
|
-
@twitter_user = @twitter_client.user
|
92
|
-
|
93
|
-
# 20 is the number that we're using to measure statics.
|
94
|
-
@twitter_client.user_timeline(@twitter_user.username).take(20).collect do |tweet|
|
95
|
-
@favorites = @favorites + tweet.favorite_count.to_f
|
96
|
-
@retweets = @retweets + tweet.retweet_count.to_f
|
97
|
-
end
|
98
|
-
|
99
|
-
@tweets = @twitter_client.mentions_timeline.take(5)
|
100
|
-
|
101
|
-
@favorites = @favorites / 20.0
|
102
|
-
@retweets = @retweets / 20.0
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
84
|
def instagram
|
107
85
|
authorize! :read, Adminpanel::Analytic
|
108
86
|
if !@instagram_token.nil?
|
@@ -34,13 +34,6 @@ module Adminpanel
|
|
34
34
|
redirect_to signin_path
|
35
35
|
end
|
36
36
|
|
37
|
-
def twitter_callback
|
38
|
-
save_twitter_tokens
|
39
|
-
Rails.cache.clear
|
40
|
-
flash[:success] = I18n.t('twitter.saved_token')
|
41
|
-
redirect_to twitter_analytics_path
|
42
|
-
end
|
43
|
-
|
44
37
|
def instagram_login
|
45
38
|
redirect_to Instagram.authorize_url(redirect_uri: instagram_callback_sessions_url, scope: 'comments')
|
46
39
|
end
|
@@ -60,16 +53,5 @@ module Adminpanel
|
|
60
53
|
config.client_secret = Adminpanel.instagram_client_secret
|
61
54
|
end
|
62
55
|
end
|
63
|
-
|
64
|
-
def save_twitter_tokens
|
65
|
-
twitter_user = "@#{request.env['omniauth.auth']['info']['nickname']}"
|
66
|
-
['token', 'secret'].each do |key|
|
67
|
-
Auth.create(
|
68
|
-
key: "twitter-#{key}",
|
69
|
-
name: twitter_user,
|
70
|
-
value: request.env['omniauth.auth']['credentials'][key]
|
71
|
-
)
|
72
|
-
end
|
73
|
-
end
|
74
56
|
end
|
75
57
|
end
|
@@ -300,7 +300,7 @@ module Adminpanel
|
|
300
300
|
def thumbnail_layout(attribute)
|
301
301
|
@template.content_tag :div, class: 'control-group' do
|
302
302
|
@template.content_tag :div, class: 'controls' do
|
303
|
-
@template.image_tag self.object.send("#{attribute}_url", :thumb)
|
303
|
+
@template.image_tag(self.object.send("#{attribute}_url", :thumb)) unless self.object.send("#{attribute}_url", :thumb).nil?
|
304
304
|
end
|
305
305
|
end
|
306
306
|
end
|
@@ -24,10 +24,6 @@ module Adminpanel
|
|
24
24
|
metric.first['name']
|
25
25
|
end
|
26
26
|
|
27
|
-
def tweet_link(tweet)
|
28
|
-
"http://www.twitter.com/#{tweet.user.screen_name}/status/#{tweet.id}"
|
29
|
-
end
|
30
|
-
|
31
27
|
def fb_insights(fb_auth)
|
32
28
|
if fb_auth
|
33
29
|
"#{Koala::Facebook::API.new(fb_auth.value).get_object('me')['link']}insights"
|
@@ -43,13 +39,5 @@ module Adminpanel
|
|
43
39
|
true
|
44
40
|
end
|
45
41
|
end
|
46
|
-
|
47
|
-
def exist_twitter_account?
|
48
|
-
if @twitter_token.nil? || @twitter_secret.nil?
|
49
|
-
false
|
50
|
-
else
|
51
|
-
true
|
52
|
-
end
|
53
|
-
end
|
54
42
|
end
|
55
43
|
end
|
@@ -16,10 +16,6 @@ module Adminpanel
|
|
16
16
|
resource_class(resource).fb_share?
|
17
17
|
end
|
18
18
|
|
19
|
-
def has_twitter_share?(resource)
|
20
|
-
resource_class(resource).twitter_share?
|
21
|
-
end
|
22
|
-
|
23
19
|
def has_gallery?(resource)
|
24
20
|
resource_class(resource).has_gallery? || resource_class(resource).has_trix_gallery?
|
25
21
|
end
|
@@ -7,9 +7,6 @@
|
|
7
7
|
<%= link_to fb_insights(@fb_auth), target: '_blank' do %>
|
8
8
|
<i class="fa fa-facebook"></i>
|
9
9
|
<% end %>
|
10
|
-
<%= link_to twitter_analytics_path, class: 'spinner-link' do %>
|
11
|
-
<i class="fa fa-twitter"></i>
|
12
|
-
<% end %>
|
13
10
|
<%= link_to instagram_analytics_path, class: 'spinner-link' do %>
|
14
11
|
<i class="fa fa-instagram"></i>
|
15
12
|
<% end %>
|
@@ -20,8 +20,6 @@
|
|
20
20
|
<%= render 'adminpanel/icons/edit', resource: @resource_instance %>
|
21
21
|
|
22
22
|
<%= render 'adminpanel/icons/facebook', resource: @resource_instance %>
|
23
|
-
|
24
|
-
<%= render 'adminpanel/icons/twitter', resource: @resource_instance %>
|
25
23
|
</div>
|
26
24
|
</div>
|
27
25
|
<div class="widget-body">
|
data/config/locales/es.yml
CHANGED
@@ -138,7 +138,6 @@ es:
|
|
138
138
|
for: 'Estadísticas para '
|
139
139
|
facebook: 'Facebook Insights'
|
140
140
|
instagram: 'Noticias de Instagram'
|
141
|
-
twitter: 'Estadísticas de Twitter'
|
142
141
|
said: 'dijo'
|
143
142
|
explanation: 'Explicación de las métricas'
|
144
143
|
fb:
|
@@ -149,12 +148,6 @@ es:
|
|
149
148
|
page_select: 'Selecciona una cuenta para la publicación'
|
150
149
|
message: 'Mensaje de la publicación'
|
151
150
|
saved_token: 'Log in con Facebook exitoso, ya puedes publicar con la cuenta de Facebook'
|
152
|
-
twitter:
|
153
|
-
posted: 'Publicado en el twitter de %{user}'
|
154
|
-
not-posted: 'Hubo un error, no fue publicado, Por favor verifica tus credenciales o vuelve a iniciar sesión en la aplicación'
|
155
|
-
page_select: 'Selecciona una cuenta para la publicación'
|
156
|
-
message: 'Mensaje de la publicación'
|
157
|
-
saved_token: 'Log in con Twitter exitoso, ya puedes publicar con la cuenta de Twitter'
|
158
151
|
breadcrumb:
|
159
152
|
index: 'Inicio'
|
160
153
|
dropzone:
|
data/config/routes.rb
CHANGED
@@ -9,11 +9,6 @@ Adminpanel::Engine.routes.draw do
|
|
9
9
|
collection do
|
10
10
|
get :google, to: 'analytics#google'
|
11
11
|
|
12
|
-
get :twitter, to:'analytics#twitter'
|
13
|
-
post "twitter/#{I18n.t('routes.reply')}/:id", action: 'reply_to_tweet/:id', to: 'analytics#reply_to_tweet', as: 'reply_to'
|
14
|
-
post "twitter/#{I18n.t('routes.favorite')}/:id", action: 'favorite_tweet/:id', to: 'analytics#favorite_tweet', as: 'favorite'
|
15
|
-
post "twitter/#{I18n.t('routes.retweet')}/:id", action: 'retweet_tweet/:id', to: 'analytics#retweet_tweet', as: 'retweet'
|
16
|
-
|
17
12
|
get :instagram, to:'analytics#instagram'
|
18
13
|
post "instagram/#{I18n.t('routes.comment')}/:id", action: 'comment_to_instagram/:id', to: 'analytics#instagram_comment', as: 'comment_instagram'
|
19
14
|
end
|
@@ -50,11 +45,6 @@ Adminpanel::Engine.routes.draw do
|
|
50
45
|
post :fb_save_token, as: 'fb_save_token', path: 'guardar-token-fb'
|
51
46
|
post :fb_publish, to: "#{resource}#fb_publish", as: 'fb_publish', path: I18n.t('routes.publish', location: 'facebook')
|
52
47
|
end
|
53
|
-
|
54
|
-
if has_twitter_share?(resource)
|
55
|
-
# include twitter concern
|
56
|
-
post :twitter_publish, to: "#{resource}#twitter_publish", as: 'twitter_publish', path: I18n.t('routes.publish', location: 'twitter')
|
57
|
-
end
|
58
48
|
end
|
59
49
|
|
60
50
|
collection do
|
@@ -85,8 +75,3 @@ Adminpanel::Engine.routes.draw do
|
|
85
75
|
get I18n.t('routes.signin'), to: 'sessions#new', as: 'signin'
|
86
76
|
|
87
77
|
end
|
88
|
-
|
89
|
-
Rails.application.routes.draw do
|
90
|
-
#route for oauth2 twitter callback
|
91
|
-
get 'auth/twitter/callback', to: 'adminpanel/sessions#twitter_callback'
|
92
|
-
end
|
data/lib/adminpanel.rb
CHANGED
data/lib/adminpanel/engine.rb
CHANGED
@@ -13,8 +13,6 @@ module Adminpanel
|
|
13
13
|
:displayable_resources,
|
14
14
|
:fb_app_id,
|
15
15
|
:fb_app_secret,
|
16
|
-
:twitter_api_key,
|
17
|
-
:twitter_api_secret,
|
18
16
|
:instagram_client_id,
|
19
17
|
:instagram_client_secret
|
20
18
|
|
@@ -25,9 +23,6 @@ module Adminpanel
|
|
25
23
|
self.analytics_application_name = 'AdminPanel'
|
26
24
|
self.analytics_application_version = '1.0.0'
|
27
25
|
|
28
|
-
self.twitter_api_key = nil
|
29
|
-
self.twitter_api_secret = nil
|
30
|
-
|
31
26
|
self.displayable_resources = [
|
32
27
|
:users
|
33
28
|
]
|
@@ -35,9 +30,6 @@ module Adminpanel
|
|
35
30
|
self.fb_app_id = nil
|
36
31
|
self.fb_app_secret = nil
|
37
32
|
|
38
|
-
self.twitter_api_key = nil
|
39
|
-
self.twitter_api_secret = nil
|
40
|
-
|
41
33
|
self.instagram_client_id = nil
|
42
34
|
self.instagram_client_secret = nil
|
43
35
|
end
|
data/lib/adminpanel/version.rb
CHANGED
@@ -28,13 +28,6 @@ Adminpanel.setup do |config|
|
|
28
28
|
# # Facebook app secret *MAKE SURE TO DON'T SHARE THIS SECRET*
|
29
29
|
# config.fb_app_secret = 'fbs3cr3t'
|
30
30
|
|
31
|
-
### TWITTER CONFIGURATIONS ###
|
32
|
-
# # Twitter consumer key
|
33
|
-
# config.twitter_api_key = 'tw1tt3r'
|
34
|
-
|
35
|
-
# # Twitter consumer secret *DON'T SHARE THIS SECRET EITHER*
|
36
|
-
# config.twitter_api_secret = 'tws3cr3t'
|
37
|
-
|
38
31
|
### INSTAGRAM CONFIGURATIONS ###
|
39
32
|
# # Instagram consumer key
|
40
33
|
# config.instagram_client_id = '1nst4gr4m'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: adminpanel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.3.
|
4
|
+
version: 3.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Ramon Camacho
|
@@ -9,8 +9,30 @@ authors:
|
|
9
9
|
- Eduardo Albertos
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
|
-
cert_chain:
|
13
|
-
|
12
|
+
cert_chain:
|
13
|
+
- |
|
14
|
+
-----BEGIN CERTIFICATE-----
|
15
|
+
MIIDYDCCAkigAwIBAgIBATANBgkqhkiG9w0BAQUFADA7MQ8wDQYDVQQDDAZ2aWN0
|
16
|
+
b3IxFDASBgoJkiaJk/IsZAEZFgRjb2RuMRIwEAYKCZImiZPyLGQBGRYCbXgwHhcN
|
17
|
+
MTUwMzIwMTkwMTA4WhcNMTYwMzE5MTkwMTA4WjA7MQ8wDQYDVQQDDAZ2aWN0b3Ix
|
18
|
+
FDASBgoJkiaJk/IsZAEZFgRjb2RuMRIwEAYKCZImiZPyLGQBGRYCbXgwggEiMA0G
|
19
|
+
CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDmdMzllrIGptczoKmPRuYk4C++SE0S
|
20
|
+
6HI44pD7EBkto4NkpECUJZnaUYf7xTpm7t68O7GwGT+0Vrljpx2W1To42/MonU60
|
21
|
+
fbFbOR8HmOvbb2WQY55axC+utQ6oqITPaBLg6thFYbRPAQwsUBN0F0NqExlPpRL5
|
22
|
+
oSih3LUKzp4qVcimzWMzCXAu127mkPmG+M+Xo4pUUtG4uz9d67ujSG2LX9oxIteQ
|
23
|
+
Ibs2TMh1WXAKttwi1wVBGgQujoHgGrOTq1bX72/a2tfFeIXrAt5H3hYhF7pToWhN
|
24
|
+
OHJRalpyDui37p0EksEz+bFJ8KsUWjlxlOjioemsxxp0YIEjEHZR6/ZNAgMBAAGj
|
25
|
+
bzBtMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBTUBDel181sCLrY
|
26
|
+
1ipjHl7bJ7vCijAZBgNVHREEEjAQgQ52aWN0b3JAY29kbi5teDAZBgNVHRIEEjAQ
|
27
|
+
gQ52aWN0b3JAY29kbi5teDANBgkqhkiG9w0BAQUFAAOCAQEABLmaFKUFaGnCO+uq
|
28
|
+
GMCQQRFBh7uJgJUndaAr8CheqaF0U+nJX2Xsggb1VCQDK6TNFVBdvIH+KSYJtu90
|
29
|
+
e6AKGdJKAqNetWKG4Wo9gycWcJdT5CzOWhXgwOi+O+8Z9p3j0pLkDMJTn0Li2+79
|
30
|
+
jb0AfMmll67rqqCq6Mmxx6rQQulE8CB1siuLzf6DfbrfrlGCe2Qy77pwFwqNoEPP
|
31
|
+
P/U4QAtdpmTbKreZ5f2TEXlF/kqXL79j2/ov8sd7B+aWNI3vEXKXiPALa+hupDWs
|
32
|
+
XdmvXYY6Fr9AHqSdbvphaVu+RqBpkBdGUQCcCZ73NjXSUwgJumx1p1A8e4NXrh1e
|
33
|
+
pYh0/Q==
|
34
|
+
-----END CERTIFICATE-----
|
35
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
14
36
|
dependencies:
|
15
37
|
- !ruby/object:Gem::Dependency
|
16
38
|
name: rails
|
@@ -174,34 +196,6 @@ dependencies:
|
|
174
196
|
- - '='
|
175
197
|
- !ruby/object:Gem::Version
|
176
198
|
version: 2.2.0
|
177
|
-
- !ruby/object:Gem::Dependency
|
178
|
-
name: omniauth-twitter
|
179
|
-
requirement: !ruby/object:Gem::Requirement
|
180
|
-
requirements:
|
181
|
-
- - '='
|
182
|
-
- !ruby/object:Gem::Version
|
183
|
-
version: 1.1.0
|
184
|
-
type: :runtime
|
185
|
-
prerelease: false
|
186
|
-
version_requirements: !ruby/object:Gem::Requirement
|
187
|
-
requirements:
|
188
|
-
- - '='
|
189
|
-
- !ruby/object:Gem::Version
|
190
|
-
version: 1.1.0
|
191
|
-
- !ruby/object:Gem::Dependency
|
192
|
-
name: twitter
|
193
|
-
requirement: !ruby/object:Gem::Requirement
|
194
|
-
requirements:
|
195
|
-
- - '='
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: 5.14.0
|
198
|
-
type: :runtime
|
199
|
-
prerelease: false
|
200
|
-
version_requirements: !ruby/object:Gem::Requirement
|
201
|
-
requirements:
|
202
|
-
- - '='
|
203
|
-
- !ruby/object:Gem::Version
|
204
|
-
version: 5.14.0
|
205
199
|
- !ruby/object:Gem::Dependency
|
206
200
|
name: coffee-rails
|
207
201
|
requirement: !ruby/object:Gem::Requirement
|
@@ -454,7 +448,7 @@ dependencies:
|
|
454
448
|
version: '0'
|
455
449
|
description: |-
|
456
450
|
Gem that focus on making a public site's resources very quickly while being very configurable!,
|
457
|
-
supports facebook sharing,
|
451
|
+
supports facebook sharing, instagram and google analytics integration
|
458
452
|
email:
|
459
453
|
- info@codn.mx
|
460
454
|
executables: []
|
@@ -546,13 +540,11 @@ files:
|
|
546
540
|
- app/controllers/adminpanel/sessions_controller.rb
|
547
541
|
- app/controllers/adminpanel/users_controller.rb
|
548
542
|
- app/controllers/concerns/adminpanel/analytics/instagram_analytics.rb
|
549
|
-
- app/controllers/concerns/adminpanel/analytics/twitter_analytics.rb
|
550
543
|
- app/controllers/concerns/adminpanel/facebook_actions.rb
|
551
544
|
- app/controllers/concerns/adminpanel/gallery_actions.rb
|
552
545
|
- app/controllers/concerns/adminpanel/rest_actions.rb
|
553
546
|
- app/controllers/concerns/adminpanel/sitemap_actions.rb
|
554
547
|
- app/controllers/concerns/adminpanel/sortable_actions.rb
|
555
|
-
- app/controllers/concerns/adminpanel/twitter_actions.rb
|
556
548
|
- app/helpers/adminpanel/adminpanel_form_builder.rb
|
557
549
|
- app/helpers/adminpanel/analytics_helper.rb
|
558
550
|
- app/helpers/adminpanel/application_helper.rb
|
@@ -575,17 +567,13 @@ files:
|
|
575
567
|
- app/models/concerns/adminpanel/sitemap.rb
|
576
568
|
- app/models/concerns/adminpanel/sortable.rb
|
577
569
|
- app/models/concerns/adminpanel/sortable_gallery.rb
|
578
|
-
- app/models/concerns/adminpanel/twitter.rb
|
579
570
|
- app/uploaders/adminpanel/.keep
|
580
571
|
- app/views/adminpanel/analytics/_header.html.erb
|
581
572
|
- app/views/adminpanel/analytics/_instagram_details_modal.html.erb
|
582
573
|
- app/views/adminpanel/analytics/_instagram_media.html.erb
|
583
|
-
- app/views/adminpanel/analytics/_tweet.html.erb
|
584
|
-
- app/views/adminpanel/analytics/_twitter_reply_modal.html.erb
|
585
574
|
- app/views/adminpanel/analytics/google.html.erb
|
586
575
|
- app/views/adminpanel/analytics/index.html.erb
|
587
576
|
- app/views/adminpanel/analytics/instagram.html.erb
|
588
|
-
- app/views/adminpanel/analytics/twitter.html.erb
|
589
577
|
- app/views/adminpanel/form/_adminpanel_file_field.html.erb
|
590
578
|
- app/views/adminpanel/form/_checkbox.html.erb
|
591
579
|
- app/views/adminpanel/form/_file_field.html.erb
|
@@ -596,7 +584,6 @@ files:
|
|
596
584
|
- app/views/adminpanel/icons/_facebook.html.erb
|
597
585
|
- app/views/adminpanel/icons/_new.html.erb
|
598
586
|
- app/views/adminpanel/icons/_show.html.erb
|
599
|
-
- app/views/adminpanel/icons/_twitter.html.erb
|
600
587
|
- app/views/adminpanel/sections/_sections_table.html.erb
|
601
588
|
- app/views/adminpanel/sections/edit.html.erb
|
602
589
|
- app/views/adminpanel/sections/index.html.erb
|
@@ -610,7 +597,6 @@ files:
|
|
610
597
|
- app/views/adminpanel/shared/_modal.html.erb
|
611
598
|
- app/views/adminpanel/shared/_new_resource_button.html.erb
|
612
599
|
- app/views/adminpanel/shared/_remote_form_fields.html.erb
|
613
|
-
- app/views/adminpanel/shared/_twitter_publish_modal.html.erb
|
614
600
|
- app/views/adminpanel/templates/checkbox.js.erb
|
615
601
|
- app/views/adminpanel/templates/destroy.js.erb
|
616
602
|
- app/views/adminpanel/templates/edit.html.erb
|
@@ -629,7 +615,6 @@ files:
|
|
629
615
|
- config/initializers/adminpanel/carrierwave_mini_magick_quality.rb
|
630
616
|
- config/initializers/adminpanel/clear_cache.rb
|
631
617
|
- config/initializers/adminpanel/pluralization_es.rb
|
632
|
-
- config/initializers/adminpanel/twitter_oauth.rb
|
633
618
|
- config/locales/en.yml
|
634
619
|
- config/locales/es.yml
|
635
620
|
- config/routes.rb
|
@@ -785,7 +770,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
785
770
|
requirements:
|
786
771
|
- imagemagick installed
|
787
772
|
rubyforge_project:
|
788
|
-
rubygems_version: 2.
|
773
|
+
rubygems_version: 2.5.1
|
789
774
|
signing_key:
|
790
775
|
specification_version: 4
|
791
776
|
summary: Made with <3 by CoDN
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Adminpanel
|
2
|
-
module Analytics
|
3
|
-
module TwitterAnalytics
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
before_action :get_twitter_token, only:[:twitter, :reply_to_tweet, :favorite_tweet, :retweet_tweet]
|
8
|
-
end
|
9
|
-
|
10
|
-
def reply_to_tweet
|
11
|
-
@twitter_client.update params[:tweet], in_reply_to_status_id: params[:id]
|
12
|
-
redirect_to twitter_analytics_path
|
13
|
-
end
|
14
|
-
|
15
|
-
def favorite_tweet
|
16
|
-
@twitter_client.favorite(params[:id])
|
17
|
-
end
|
18
|
-
|
19
|
-
def retweet_tweet
|
20
|
-
@twitter_client.retweet(params[:id])
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module Adminpanel
|
2
|
-
module TwitterActions
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
|
5
|
-
included do
|
6
|
-
before_action :get_twitter_token, only:[:index, :create, :update, :destroy, :show, :twitter_publish]
|
7
|
-
end
|
8
|
-
|
9
|
-
def twitter_publish
|
10
|
-
@resource_instance.twitter_message = params[model_name][:twitter_message]
|
11
|
-
if !@twitter_token.nil? && !@twitter_secret.nil? && @resource_instance.has_valid_tweet?
|
12
|
-
client = get_twitter_token
|
13
|
-
client.update(@resource_instance.twitter_message)
|
14
|
-
flash[:success] = I18n.t('twitter.posted', user: @twitter_token.name)
|
15
|
-
else
|
16
|
-
flash[:error] = I18n.t('twitter.not-posted')
|
17
|
-
end
|
18
|
-
redirect_to @resource_instance
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
def get_twitter_token
|
23
|
-
@twitter_token = Auth.find_by_key 'twitter-token'
|
24
|
-
@twitter_secret = Auth.find_by_key 'twitter-secret'
|
25
|
-
|
26
|
-
if !@twitter_token.nil? && !@twitter_secret.nil?
|
27
|
-
@twitter_client ||= ::Twitter::REST::Client.new do |config|
|
28
|
-
config.consumer_key = Adminpanel.twitter_api_key
|
29
|
-
config.consumer_secret = Adminpanel.twitter_api_secret
|
30
|
-
config.access_token = @twitter_token.value
|
31
|
-
config.access_token_secret = @twitter_secret.value
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def model_name
|
37
|
-
@model.name.demodulize.downcase # ex: posts
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
module Adminpanel
|
2
|
-
module Twitter
|
3
|
-
extend ActiveSupport::Concern
|
4
|
-
included do
|
5
|
-
attr_accessor :twitter_message
|
6
|
-
end
|
7
|
-
|
8
|
-
def share_link
|
9
|
-
'http://www.google.com'
|
10
|
-
end
|
11
|
-
|
12
|
-
def has_valid_tweet?
|
13
|
-
if self.twitter_message.length <= 140
|
14
|
-
true
|
15
|
-
else
|
16
|
-
false
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# static(class) methods
|
21
|
-
module ClassMethods
|
22
|
-
def twitter_share?
|
23
|
-
true
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
<li class="priority-high">
|
2
|
-
<%= image_tag tweet.user.profile_image_url, class: 'avatar thumbnail' %>
|
3
|
-
<h5>
|
4
|
-
@<%= tweet.user.username %> <%= I18n.t('analytics.said') %>
|
5
|
-
</h5>
|
6
|
-
<i class="fa fa-quote-left"></i>
|
7
|
-
<%= tweet.text %>
|
8
|
-
<i class="fa fa-quote-right"></i>
|
9
|
-
|
10
|
-
<div class="date">
|
11
|
-
El <%= I18n.l(tweet.created_at) %>, a las
|
12
|
-
<%= I18n.l(tweet.created_at, format: :time) %>
|
13
|
-
</div>
|
14
|
-
<div class="settings">
|
15
|
-
<%= link_to '#', data: { target: "#reply-#{tweet.id}", toggle: 'modal' } do %>
|
16
|
-
<i class="fa fa-reply"></i>
|
17
|
-
<% end %>
|
18
|
-
|
19
|
-
<%= link_to favorite_analytics_path(tweet.id), method: :post, remote: true do %>
|
20
|
-
<i class="fa fa-star"></i> <%= tweet.favorite_count %>
|
21
|
-
<% end %>
|
22
|
-
|
23
|
-
<%= link_to retweet_analytics_path(tweet.id), method: :post, remote: true do %>
|
24
|
-
<i class="fa fa-retweet"></i> <%= tweet.retweet_count %>
|
25
|
-
<% end %>
|
26
|
-
|
27
|
-
<%= link_to tweet_link(tweet), target: '_blank' do %>
|
28
|
-
<i class="fa fa-external-link"></i>
|
29
|
-
<% end %>
|
30
|
-
</div>
|
31
|
-
</li>
|
32
|
-
<%= render 'twitter_reply_modal', tweet: tweet %>
|
@@ -1,41 +0,0 @@
|
|
1
|
-
<div id="reply-<%= tweet.id %>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
2
|
-
<div class="modal-header" id="modal-header">
|
3
|
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
4
|
-
<h3 id="modal-title"><%= I18n.t('action.reply') %> en Twitter</h3>
|
5
|
-
</div>
|
6
|
-
<div id="modal-container">
|
7
|
-
<%= form_tag reply_to_analytics_path(tweet), method: :post, class: 'form-horizontal' do |f| %>
|
8
|
-
<div class="row-fluid">
|
9
|
-
<div class="modal-body clearfix">
|
10
|
-
<div class="span12">
|
11
|
-
<i class="fa fa-quote-left"></i>
|
12
|
-
<%= tweet.text %>
|
13
|
-
<i class="fa fa-quote-right"></i>
|
14
|
-
</div>
|
15
|
-
<div class="control-group">
|
16
|
-
<%= label_tag 'tweet', 'Respuesta:', class: 'control-label' %>
|
17
|
-
|
18
|
-
<div class="controls">
|
19
|
-
<%= text_area_tag 'tweet', "@#{tweet.user.username} ", id: "twitter-message-#{tweet.id}", label: I18n.t('twitter.message'), :rows => 4, maxlength: 140 %>
|
20
|
-
</div>
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
<div class="modal-footer">
|
25
|
-
<button id="modal-button" class="btn" data-dismiss="modal" aria-hidden="true">
|
26
|
-
<%= I18n.t('action.close') %>
|
27
|
-
</button>
|
28
|
-
<%= submit_tag(
|
29
|
-
I18n.t('action.reply'),
|
30
|
-
class: 'btn btn-primary',
|
31
|
-
data: {
|
32
|
-
:disable_with => I18n.t('action.submitting')
|
33
|
-
},
|
34
|
-
:id =>"reply-tweet-#{tweet.id}"
|
35
|
-
)
|
36
|
-
%>
|
37
|
-
</div>
|
38
|
-
<% end %>
|
39
|
-
|
40
|
-
</div>
|
41
|
-
</div>
|
@@ -1,90 +0,0 @@
|
|
1
|
-
<% provide(:page_title, I18n.t('analytics.twitter')) -%>
|
2
|
-
|
3
|
-
<div class="row-fluid">
|
4
|
-
<div class="widget widget-padding span12">
|
5
|
-
<div class="widget-header">
|
6
|
-
<%= render 'header' %>
|
7
|
-
<div class="widget-buttons">
|
8
|
-
<% if !exist_twitter_account? && (Adminpanel.twitter_api_key.nil? || Adminpanel.twitter_api_secret) %>
|
9
|
-
<!-- This is the route created by oauth2 -->
|
10
|
-
<%= button_to '/auth/twitter', method: :get, class: 'btn btn-success' do %>
|
11
|
-
Iniciar sesión <i class="fa fa-twitter"></i>
|
12
|
-
<% end %>
|
13
|
-
<% end %>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
<div class="widget-body">
|
17
|
-
|
18
|
-
<div class="row-fluid">
|
19
|
-
|
20
|
-
<% if exist_twitter_account? %>
|
21
|
-
<div class="widget span6">
|
22
|
-
<div class="widget-header">
|
23
|
-
<i class="fa fa-bullhorn"></i>
|
24
|
-
<h5>Replies (Menciones) a @ <%= @twitter_user.screen_name %>:</h5>
|
25
|
-
</div>
|
26
|
-
<div class="widget-body clearfix">
|
27
|
-
<div class="widget-tickets widget-tickets-large clearfix">
|
28
|
-
<ul>
|
29
|
-
<% @tweets.collect do |tweet| %>
|
30
|
-
<%= render 'tweet', tweet: tweet %>
|
31
|
-
<% end %>
|
32
|
-
</ul>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
</div>
|
36
|
-
|
37
|
-
<div class="widget span6">
|
38
|
-
<div class="widget-header">
|
39
|
-
<i class="fa fa-bullhorn"></i>
|
40
|
-
<h5>Información de @<%= @twitter_user.screen_name %></h5>
|
41
|
-
</div>
|
42
|
-
<div class="widget-body clearfix">
|
43
|
-
<div class="widget-tickets widget-tickets-large clearfix">
|
44
|
-
<ul>
|
45
|
-
<li>
|
46
|
-
<h5>Número de personas que siguen a @<%= @twitter_user.screen_name %></h5>
|
47
|
-
<i class="fa fa-sign-in"></i>
|
48
|
-
<h4>
|
49
|
-
<%= @twitter_user.followers_count %>
|
50
|
-
</h4>
|
51
|
-
</li>
|
52
|
-
<li>
|
53
|
-
<h5>Número de personas que @<%= @twitter_user.screen_name %> sigue</h5>
|
54
|
-
<i class="fa fa-sign-out"></i>
|
55
|
-
<h4>
|
56
|
-
<%= @twitter_user.friends_count %>
|
57
|
-
</h4>
|
58
|
-
</li>
|
59
|
-
<li>
|
60
|
-
<h5>Número de listas a las que @<%= @twitter_user.screen_name %> pertenece</h5>
|
61
|
-
<i class="fa fa-list"></i>
|
62
|
-
<h4>
|
63
|
-
<%= @twitter_user.listed_count %>
|
64
|
-
</h4>
|
65
|
-
</li>
|
66
|
-
<li>
|
67
|
-
<h5>Promedio de Favoritos de los últimos 20 tweets:</h5>
|
68
|
-
<i class="fa fa-bar-chart-o"></i>
|
69
|
-
<h4>
|
70
|
-
<%= @favorites %>
|
71
|
-
</h4>
|
72
|
-
</li>
|
73
|
-
<li>
|
74
|
-
<h5>Promedio de Retweets de los últimos 20 tweets:</h5>
|
75
|
-
<i class="fa fa-bar-chart-o"></i>
|
76
|
-
<h4>
|
77
|
-
<%= @retweets %>
|
78
|
-
</h4>
|
79
|
-
</li>
|
80
|
-
</ul>
|
81
|
-
</div>
|
82
|
-
</div>
|
83
|
-
</div>
|
84
|
-
<% end %><!-- close exist twitter account -->
|
85
|
-
|
86
|
-
</div>
|
87
|
-
|
88
|
-
</div>
|
89
|
-
</div>
|
90
|
-
</div>
|
@@ -1,29 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
if @model.twitter_share?
|
3
|
-
if @twitter_token.nil? || @twitter_secret.nil?
|
4
|
-
link = '/auth/twitter'
|
5
|
-
options = {}
|
6
|
-
else
|
7
|
-
link = '#'
|
8
|
-
options = { target: "#twitter-#{resource.id}", toggle: 'modal' }
|
9
|
-
end
|
10
|
-
options[:toggle] ||= ''
|
11
|
-
options[:toggle] << ' tooltip'
|
12
|
-
options[:title] = 'Compartir en Facebook'
|
13
|
-
%>
|
14
|
-
<%=
|
15
|
-
link_to(
|
16
|
-
content_tag(
|
17
|
-
:i,
|
18
|
-
nil,
|
19
|
-
class: 'fa fa-twitter'
|
20
|
-
),
|
21
|
-
link,
|
22
|
-
title: 'Compartir en Twitter',
|
23
|
-
id: 'resource-tweet',
|
24
|
-
data: options
|
25
|
-
)
|
26
|
-
%>
|
27
|
-
<!-- the modal that it's going to toggle if exist there's a twitter account -->
|
28
|
-
<%= render 'adminpanel/shared/twitter_publish_modal', resource: resource %>
|
29
|
-
<% end %>
|
@@ -1,40 +0,0 @@
|
|
1
|
-
<div id="twitter-<%= resource.id %>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
2
|
-
<div class="modal-header" id="modal-header">
|
3
|
-
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
4
|
-
<h3 id="modal-title"><%= I18n.t('action.publish') %> en Twitter</h3>
|
5
|
-
</div>
|
6
|
-
<div id="modal-container">
|
7
|
-
<%=
|
8
|
-
adminpanel_form_for(
|
9
|
-
resource,
|
10
|
-
url: url_for({
|
11
|
-
controller: params[:controller],
|
12
|
-
action: :twitter_publish,
|
13
|
-
id: resource
|
14
|
-
}),
|
15
|
-
method: :post
|
16
|
-
) do |f|
|
17
|
-
%>
|
18
|
-
<div class="row-fluid">
|
19
|
-
<div class="modal-body">
|
20
|
-
<%= f.text_area :twitter_message, 'id' => "twitter-message-#{resource.id}", 'label' => I18n.t('twitter.message'), value: resource.share_link, rows: 4, maxlength: 140 %>
|
21
|
-
</div>
|
22
|
-
</div>
|
23
|
-
<div class="modal-footer">
|
24
|
-
<button id="modal-button" class="btn" data-dismiss="modal" aria-hidden="true">
|
25
|
-
<%= I18n.t('action.close') %>
|
26
|
-
</button>
|
27
|
-
<%=
|
28
|
-
f.submit(
|
29
|
-
I18n.t('action.publish') + " " + @model.display_name,
|
30
|
-
data: {
|
31
|
-
:disable_with => I18n.t('action.submitting')
|
32
|
-
},
|
33
|
-
:id =>"tweet-#{@model.name.demodulize}-button"
|
34
|
-
)
|
35
|
-
%>
|
36
|
-
</div>
|
37
|
-
<% end %>
|
38
|
-
|
39
|
-
</div>
|
40
|
-
</div>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Rails.application.config.middleware.use OmniAuth::Builder do
|
2
|
-
if !Adminpanel.twitter_api_key.nil? && !Adminpanel.twitter_api_secret.nil?
|
3
|
-
provider(
|
4
|
-
:twitter,
|
5
|
-
Adminpanel.twitter_api_key,
|
6
|
-
Adminpanel.twitter_api_secret,
|
7
|
-
{
|
8
|
-
authorize_params: {
|
9
|
-
force_login: 'true',
|
10
|
-
lang: I18n.default_locale.to_s
|
11
|
-
}
|
12
|
-
}
|
13
|
-
)
|
14
|
-
end
|
15
|
-
end
|