facebook_app 0.0.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.
Files changed (48) hide show
  1. data/Gemfile +4 -0
  2. data/Gemfile.lock +158 -0
  3. data/README.textile +52 -0
  4. data/Rakefile +1 -0
  5. data/app/assets/images/shared/ajax-loader.gif +0 -0
  6. data/app/assets/images/single_pixel.png +0 -0
  7. data/app/assets/javascripts/facebook_app.js +9 -0
  8. data/app/assets/javascripts/pages.coffee.erb +18 -0
  9. data/app/assets/stylesheets/admin.sass +13 -0
  10. data/app/assets/stylesheets/configurables.sass +11 -0
  11. data/app/assets/stylesheets/facebook_app.css +9 -0
  12. data/app/assets/stylesheets/layout.css.scss +280 -0
  13. data/app/assets/stylesheets/yui-3.4.1.css +7 -0
  14. data/app/controllers/facebook_app/achievements_controller.rb +21 -0
  15. data/app/controllers/facebook_app/admin_controller.rb +42 -0
  16. data/app/controllers/facebook_app/external_trackings_controller.rb +21 -0
  17. data/app/controllers/facebook_app/facebook_app_controller.rb +59 -0
  18. data/app/controllers/facebook_app/oauth_controller.rb +46 -0
  19. data/app/controllers/facebook_app/pages_controller.rb +14 -0
  20. data/app/helpers/facebook_app/application_helper.rb +55 -0
  21. data/app/mailers/.gitkeep +0 -0
  22. data/app/models/.gitkeep +0 -0
  23. data/app/models/facebook_app/conversion.rb +50 -0
  24. data/app/models/facebook_app/conversion_summary.rb +58 -0
  25. data/app/models/facebook_app/facebook_credentials.rb +56 -0
  26. data/app/models/facebook_app/infographic_server_communicator.rb +21 -0
  27. data/app/views/facebook_app/achievements/show.html.slim +12 -0
  28. data/app/views/facebook_app/admin/_conversion_stage.html.slim +5 -0
  29. data/app/views/facebook_app/admin/_spamalytics.html.slim +16 -0
  30. data/app/views/facebook_app/admin/new_fb_credentials.html.slim +10 -0
  31. data/app/views/facebook_app/admin/show.html.slim +28 -0
  32. data/app/views/facebook_app/external_trackings/test.html.slim +3 -0
  33. data/app/views/facebook_app/pages/privacy_policy.html.slim +49 -0
  34. data/app/views/facebook_app/pages/terms_of_service.html.slim +49 -0
  35. data/app/views/layouts/facebook_app.html.slim +17 -0
  36. data/config/routes.rb +31 -0
  37. data/db/migrate/20111024214949_add_facebook_app.rb +29 -0
  38. data/facebook_app.gemspec +33 -0
  39. data/lib/facebook_app/engine.rb +15 -0
  40. data/lib/facebook_app/recipes.rb +39 -0
  41. data/lib/facebook_app/version.rb +3 -0
  42. data/lib/facebook_app.rb +15 -0
  43. data/lib/generators/facebook_app/install_generator.rb +19 -0
  44. data/lib/generators/facebook_app/templates/configurable.yml +79 -0
  45. data/lib/generators/facebook_app/templates/delayed_job +5 -0
  46. data/lib/generators/facebook_app/templates/seeds.rb +7 -0
  47. data/script/infographic.py +180 -0
  48. metadata +180 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in facebook_app.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,158 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ facebook_app (0.0.2)
5
+ configurable_engine
6
+ delayed_job (~> 2.1.0)
7
+ formtastic
8
+ koala
9
+ rails (>= 3.1)
10
+ rubber (= 1.15.0)
11
+ slim-rails
12
+ state_machine
13
+
14
+ GEM
15
+ remote: http://rubygems.org/
16
+ specs:
17
+ actionmailer (3.1.0)
18
+ actionpack (= 3.1.0)
19
+ mail (~> 2.3.0)
20
+ actionpack (3.1.0)
21
+ activemodel (= 3.1.0)
22
+ activesupport (= 3.1.0)
23
+ builder (~> 3.0.0)
24
+ erubis (~> 2.7.0)
25
+ i18n (~> 0.6)
26
+ rack (~> 1.3.2)
27
+ rack-cache (~> 1.0.3)
28
+ rack-mount (~> 0.8.2)
29
+ rack-test (~> 0.6.1)
30
+ sprockets (~> 2.0.0)
31
+ activemodel (3.1.0)
32
+ activesupport (= 3.1.0)
33
+ bcrypt-ruby (~> 3.0.0)
34
+ builder (~> 3.0.0)
35
+ i18n (~> 0.6)
36
+ activerecord (3.1.0)
37
+ activemodel (= 3.1.0)
38
+ activesupport (= 3.1.0)
39
+ arel (~> 2.2.1)
40
+ tzinfo (~> 0.3.29)
41
+ activeresource (3.1.0)
42
+ activemodel (= 3.1.0)
43
+ activesupport (= 3.1.0)
44
+ activesupport (3.1.0)
45
+ multi_json (~> 1.0)
46
+ addressable (2.2.6)
47
+ amazon-ec2 (0.9.17)
48
+ xml-simple (>= 1.0.12)
49
+ arel (2.2.1)
50
+ aws-s3 (0.6.2)
51
+ builder
52
+ mime-types
53
+ xml-simple
54
+ bcrypt-ruby (3.0.1)
55
+ builder (3.0.0)
56
+ capistrano (2.9.0)
57
+ highline
58
+ net-scp (>= 1.0.0)
59
+ net-sftp (>= 2.0.0)
60
+ net-ssh (>= 2.0.14)
61
+ net-ssh-gateway (>= 1.1.0)
62
+ configurable_engine (0.2.9)
63
+ activerecord (~> 3)
64
+ rails (~> 3)
65
+ daemons (1.1.4)
66
+ delayed_job (2.1.4)
67
+ activesupport (~> 3.0)
68
+ daemons
69
+ erubis (2.7.0)
70
+ faraday (0.7.5)
71
+ addressable (~> 2.2.6)
72
+ multipart-post (~> 1.1.3)
73
+ rack (< 2, >= 1.1.0)
74
+ formtastic (2.0.0)
75
+ rails (~> 3.0)
76
+ highline (1.6.2)
77
+ hike (1.2.1)
78
+ httpclient (2.2.2)
79
+ i18n (0.6.0)
80
+ json (1.6.1)
81
+ koala (1.2.1)
82
+ faraday (~> 0.7.0)
83
+ multi_json (~> 1.0)
84
+ mail (2.3.0)
85
+ i18n (>= 0.4.0)
86
+ mime-types (~> 1.16)
87
+ treetop (~> 1.4.8)
88
+ mime-types (1.17.1)
89
+ multi_json (1.0.3)
90
+ multipart-post (1.1.3)
91
+ mumboe-soap4r (1.5.8.4)
92
+ httpclient (>= 2.1.1)
93
+ net-scp (1.0.4)
94
+ net-ssh (>= 1.99.1)
95
+ net-sftp (2.0.5)
96
+ net-ssh (>= 2.0.9)
97
+ net-ssh (2.2.1)
98
+ net-ssh-gateway (1.1.0)
99
+ net-ssh (>= 1.99.1)
100
+ nettica (0.4.0)
101
+ mumboe-soap4r
102
+ polyglot (0.3.2)
103
+ rack (1.3.5)
104
+ rack-cache (1.0.3)
105
+ rack (>= 0.4)
106
+ rack-mount (0.8.3)
107
+ rack (>= 1.0.0)
108
+ rack-ssl (1.3.2)
109
+ rack
110
+ rack-test (0.6.1)
111
+ rack (>= 1.0)
112
+ rails (3.1.0)
113
+ actionmailer (= 3.1.0)
114
+ actionpack (= 3.1.0)
115
+ activerecord (= 3.1.0)
116
+ activeresource (= 3.1.0)
117
+ activesupport (= 3.1.0)
118
+ bundler (~> 1.0)
119
+ railties (= 3.1.0)
120
+ railties (3.1.0)
121
+ actionpack (= 3.1.0)
122
+ activesupport (= 3.1.0)
123
+ rack-ssl (~> 1.3.2)
124
+ rake (>= 0.8.7)
125
+ rdoc (~> 3.4)
126
+ thor (~> 0.14.6)
127
+ rake (0.9.2.2)
128
+ rdoc (3.11)
129
+ json (~> 1.4)
130
+ rubber (1.15.0)
131
+ amazon-ec2 (>= 0.9.17)
132
+ aws-s3
133
+ capistrano (>= 2.4.0)
134
+ nettica
135
+ slim (1.0.3)
136
+ temple (~> 0.3.4)
137
+ tilt (~> 1.3.2)
138
+ slim-rails (0.2.1)
139
+ slim (>= 0.9.2)
140
+ sprockets (2.0.3)
141
+ hike (~> 1.2)
142
+ rack (~> 1.0)
143
+ tilt (!= 1.3.0, ~> 1.1)
144
+ state_machine (1.0.2)
145
+ temple (0.3.4)
146
+ thor (0.14.6)
147
+ tilt (1.3.3)
148
+ treetop (1.4.10)
149
+ polyglot
150
+ polyglot (>= 0.3.1)
151
+ tzinfo (0.3.30)
152
+ xml-simple (1.1.1)
153
+
154
+ PLATFORMS
155
+ ruby
156
+
157
+ DEPENDENCIES
158
+ facebook_app!
data/README.textile ADDED
@@ -0,0 +1,52 @@
1
+ h1. Facebook App Engine
2
+
3
+ Everything you need to quickly build and deploy Facebook apps.
4
+
5
+ h2. Features
6
+
7
+ h3. Tracking at permissions dialogue various stages, along viral and regular marketing methods
8
+
9
+ h3. Infographic generation and tagging server communication
10
+
11
+ h3. Comments and liking viral hooks.
12
+
13
+ h3. Achievements viral hooks.
14
+
15
+ h3. Thorough authenitcation solution using OAUTH2
16
+
17
+ h3. Admin backend for cranking up or down various virality hooks.
18
+
19
+ Visit admin/configurable
20
+
21
+ h3. Helper methods to help non technical users test the app.
22
+
23
+ Visit /admin
24
+
25
+ h3. Namespaced models and method names to avoid clashes
26
+
27
+ h3. Terms of service and privacy policy
28
+
29
+ Automatically modified to account for app name
30
+
31
+ Key methods:
32
+
33
+ Controller
34
+ before_filter :ensure_logged_in, :load_graph
35
+
36
+ begin_tracking
37
+ (start tracking at stage 1)
38
+
39
+ login_as_app
40
+ (you can log in as the app or as a user)
41
+
42
+
43
+ h2. Installation Instructions
44
+
45
+ gem "facebook_app"
46
+ rake facebook_app:install:migrations
47
+ rake db:migrate
48
+ rake facebook_app:install
49
+ rake db:migrate
50
+
51
+ #routes in main app
52
+ mount FacebookApp::Engine => "/"
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
Binary file
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,18 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
4
+
5
+ # Fix bug where Facebook platform added snippet to url
6
+
7
+ if (window.location.hash == '#_=_')
8
+ window.location.hash = ''
9
+
10
+ click_anywhere_redirect = (redirect_link) ->
11
+ $(document).ready(
12
+ () -> $("*").each($(this).click(() -> window.location = redirect_link))
13
+ )
14
+
15
+ if window.location.href.match(/infographic/)
16
+ identified_link = "http://www.identified.com/?fbg=1"
17
+ click_anywhere_redirect(identified_link)
18
+ setTimeout((() -> window.location = identified_link), 12000)
@@ -0,0 +1,13 @@
1
+ #spamalytics
2
+ h2
3
+ padding-bottom: 0px
4
+ margin-bottom: 15px
5
+ p
6
+ font-style: italic
7
+ margin-bottom: 6px
8
+ ul
9
+ margin-left: 10px
10
+ margin-bottom: 6px
11
+ li.total
12
+ font-weight: bold
13
+
@@ -0,0 +1,11 @@
1
+ .configurable
2
+ label
3
+ text-weight: bold
4
+ margin-bottom: 10px
5
+ input, textarea
6
+ width: 400px
7
+ height: 30px
8
+ clear:both
9
+ display: block
10
+ margin-bottom: 20px
11
+
@@ -0,0 +1,9 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require yui-3.4.1.css
6
+ *= require formtastic
7
+ *= require_self
8
+ *= require_tree .
9
+ */
@@ -0,0 +1,280 @@
1
+ body{
2
+ padding:0px;
3
+ margin:0px auto;
4
+ font-family:"Lucida Grande", Verdana, Arial;
5
+ font-size:13px;
6
+ width:760px;
7
+ line-height:1.5em;
8
+
9
+ }
10
+
11
+ a {
12
+ cursor: pointer;
13
+ color: #3B5998;
14
+ text-decoration: none;
15
+ &:hover{
16
+ text-decoration:underline
17
+ }
18
+ }
19
+
20
+ h1, h2{
21
+ font-family:"HelveticaNeue", "Helvetica", Arial;
22
+ }
23
+
24
+ h1{
25
+ font-weight:800;
26
+ font-size:40px;
27
+ padding:40px 0px 20px 0px;
28
+ }
29
+
30
+ h2{
31
+ font-weight:200;
32
+ font-size:24px;
33
+ color:#646464;
34
+ padding-bottom:40px;
35
+ }
36
+
37
+ #privacy {
38
+ p {
39
+ margin-bottom: 10px;
40
+ }
41
+ h2 {
42
+ padding-bottom: 10px;
43
+ }
44
+
45
+ }
46
+
47
+ div#header{
48
+ text-align:center;
49
+ }
50
+
51
+ div#content{
52
+
53
+ div.row{
54
+ width:680px;
55
+ margin:0px auto;
56
+ margin-bottom:20px;
57
+ zoom: 1;
58
+ &:after {
59
+ clear: both;
60
+ content: ".";
61
+ display: block;
62
+ height: 0;
63
+ visibility: hidden;
64
+ }
65
+
66
+ .split1,
67
+ .split2{
68
+ float:left;
69
+ margin-right:40px;
70
+ }
71
+
72
+ .split3{
73
+ float:left;
74
+ }
75
+
76
+ a.big.button{
77
+ width:578px;
78
+ text-align:center;
79
+ img{
80
+ margin-top: -8px;
81
+ margin-bottom: -2px;
82
+ margin-right: 5px;
83
+ }
84
+ }
85
+
86
+ div.widget{
87
+ width:200px;
88
+ .title{
89
+ font-family:"HelveticaNeue-Medium", "Helvetica", Arial;
90
+ font-size:26px;
91
+ font-weight:800;
92
+ padding:10px 5px;
93
+ color:white;
94
+ -webkit-border-top-left-radius: 6px;
95
+ -webkit-border-top-right-radius: 6px;
96
+ -moz-border-radius-topleft: 6px;
97
+ -moz-border-radius-topright: 6px;
98
+ border-top-left-radius: 6px;
99
+ border-top-right-radius: 6px;
100
+ text-align:center;
101
+ text-shadow:0px 0px 1px black;
102
+ }
103
+
104
+ .photo{
105
+ width:200px;
106
+ height:200px;
107
+ }
108
+
109
+ .photo img{
110
+ clip: rect(0px 200px 200px 0px);
111
+ position:absolute;
112
+ width:210px;
113
+ }
114
+
115
+ .badge{
116
+ position: relative;
117
+ top: -80px;
118
+ left: 120px;
119
+ margin-bottom: -100px;
120
+ width:100px;
121
+ }
122
+
123
+ .description{
124
+ border:1px solid #AAA;
125
+ background:#FFFFFF;
126
+
127
+ span.badge-area{
128
+ display: block;
129
+ width: 70px;
130
+ float: right;
131
+ }
132
+
133
+ p{
134
+ padding:6px;
135
+ }
136
+
137
+ ul li{
138
+ padding:6px;
139
+ color:#909090;
140
+ border-top:1px solid #DDD;
141
+ span{
142
+ float:right;
143
+ font-weight:bold;
144
+ text-align: right;
145
+ font-family:"HelveticaNeue-Medium", "Helvetica", Arial;
146
+ font-size:30px;
147
+
148
+ }
149
+
150
+ &.winner{
151
+ background: #FFFCCC;
152
+ color: #333;
153
+ }
154
+ }
155
+
156
+ ul.placeholder{
157
+ display:none;
158
+ }
159
+ }
160
+
161
+ &.award-1{
162
+ .title{
163
+ }
164
+ }
165
+
166
+ &.award-2{
167
+ .title{
168
+ }
169
+ }
170
+
171
+ &.award-3{
172
+ .title{
173
+ }
174
+ }
175
+
176
+ &.award-4{
177
+ .title{
178
+ }
179
+ }
180
+
181
+ &.award-5{
182
+ .title{
183
+ }
184
+ }
185
+
186
+ &.award-6{
187
+ .title{
188
+ }
189
+ }
190
+
191
+ &.award-7{
192
+ .title{
193
+ }
194
+ }
195
+
196
+ &.award-8{
197
+ .title{
198
+ }
199
+ }
200
+
201
+ &.award-9{
202
+ .title{
203
+ }
204
+ }
205
+
206
+ &.disabled{
207
+ .title{
208
+ }
209
+
210
+ .photo{
211
+ width:200px;
212
+ height:200px;
213
+ background-position:50% 50%;
214
+ }
215
+ }
216
+
217
+ &.loading{
218
+ background:#F2F2F2 url('shared/ajax-loader.gif') no-repeat 50% 45%;
219
+
220
+ & > div.photo{
221
+ visibility:hidden;
222
+ }
223
+
224
+ & > div.description ul.table{
225
+ display:none;
226
+ }
227
+
228
+ & > div.description ul.placeholder{
229
+ display:block;
230
+ }
231
+ }
232
+ }
233
+ }
234
+ }
235
+
236
+
237
+ .button{
238
+ display:inline-block;
239
+ }
240
+
241
+ .button.primary {
242
+ color:white;
243
+ border:1px solid #3b6e22;
244
+ box-shadow: 0px 1px 0px #dcdde1;
245
+ text-shadow:0px -1px 0px #3b6e22;
246
+ background-image: -webkit-gradient(
247
+ linear,
248
+ left bottom,
249
+ left top,
250
+ color-stop(0, #67a54b),
251
+ color-stop(0.97, #75ae5c),
252
+ color-stop(0.98, #98c286)
253
+ );
254
+ background-image: -moz-linear-gradient(
255
+ center bottom,
256
+ #67a54b 0%,
257
+ #75ae5c 97%,
258
+ #98c286 98%
259
+ );
260
+ }
261
+
262
+ .button.primary:active{
263
+ background:#609946;
264
+ }
265
+
266
+
267
+ .button.big{
268
+ font-size:18px;
269
+ padding-top:11px;
270
+ padding-bottom:11px;
271
+ padding-left:50px;
272
+ padding-right:50px;
273
+ font-weight:bold;
274
+ }
275
+
276
+ a.button{
277
+ text-decoration:none;
278
+ }
279
+
280
+
@@ -0,0 +1,7 @@
1
+ /*
2
+ YUI 3.4.1 (build 4118)
3
+ Copyright 2011 Yahoo! Inc. All rights reserved.
4
+ Licensed under the BSD License.
5
+ http://yuilibrary.com/license/
6
+ */
7
+ html{color:#000;background:#FFF}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0}table{border-collapse:collapse;border-spacing:0}fieldset,img{border:0}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal}ol,ul{list-style:none}caption,th{text-align:left}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal}q:before,q:after{content:''}abbr,acronym{border:0;font-variant:normal}sup{vertical-align:text-top}sub{vertical-align:text-bottom}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit}input,textarea,select{*font-size:100%}legend{color:#000}
@@ -0,0 +1,21 @@
1
+ module FacebookApp
2
+ class AchievementsController < FacebookAppController
3
+
4
+ before_filter :login_as_app, :except => :show
5
+
6
+ def show
7
+ end
8
+
9
+ def create
10
+ @user_uid = AwardSet.find_by_uid(params[:id])
11
+ app_graph.graph_call("#{user_uid}/achievements", {:achievement => achievement_url(1)}, :post)
12
+ end
13
+
14
+ # needs to be done once per Facebook app.
15
+ # make sure your app is set as a Game
16
+ def register_with_fb
17
+ @app_graph.graph_call("#{FB.app_id}/achievements", {:achievement => achievement_url(1), :display_order => 1 }, :post)
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,42 @@
1
+ module FacebookApp
2
+ class AdminController < FacebookAppController
3
+ layout "facebook_app"
4
+ http_basic_authenticate_with :name => 'identified', :password => 'identified'
5
+ before_filter :ensure_logged_in, :only => :log_me_out
6
+ before_filter :load_graph, :only => :log_me_out
7
+
8
+ def show
9
+ @conversion_summary = FacebookApp::ConversionSummary.new
10
+
11
+ @fb = FacebookApp::FacebookCredentials.current_credentials
12
+ end
13
+
14
+ def new_fb_credentials
15
+ @fb = FacebookApp::FacebookCredentials.new
16
+ end
17
+
18
+ def clear_conversion_data
19
+ FacebookApp::Conversion.destroy_all
20
+ redirect_to facebook_app.admin_path
21
+ end
22
+
23
+ def log_me_out
24
+ @graph.graph_call("#{@graph.get_object('me')['id']}/permissions", {}, :delete)
25
+
26
+ session[:at] = nil
27
+ session[:uid] = nil
28
+ cookies.delete(:conversion_id)
29
+ flash[:notice] = "You logged out as a Facebook user"
30
+ redirect_to facebook_app.admin_path
31
+ end
32
+
33
+ def create_fb_credentials
34
+ @fb = FacebookApp::FacebookCredentials.new(params[:facebook_app_fb])
35
+ if @fb.save
36
+ redirect_to facebook_app.admin_path, :notice => "Successful updated facebok credentials"
37
+ else
38
+ render :new_fb_credentials
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,21 @@
1
+ module FacebookApp
2
+ class ExternalTrackingsController < FacebookAppController
3
+
4
+ def identified_signup
5
+ Conversion.find_by_id(cookies[:conversion_id]).try(:sign_up_on_identified)
6
+ show_single_pixel
7
+ end
8
+
9
+ # show the pixel
10
+ def test
11
+ end
12
+
13
+ private
14
+
15
+ def show_single_pixel
16
+ single_pixel = File.read(File.join(Rails.root, "app", "assets", "images", "single_pixel.png"), :mode => "rb")
17
+ send_data single_pixel, :filename => 'single_pixel.png', :type => 'image/gif'
18
+ end
19
+
20
+ end
21
+ end