Commit 4b68f273ab72cf214e8492b820132204fa4b6cad
1 parent
0a7e61da
Exists in
theme-brasil-digital-from-staging
and in
2 other branches
removing community_hub
Showing
57 changed files
with
1 additions
and
3101 deletions
Show diff stats
plugins/community_hub/Gemfile
plugins/community_hub/controllers/myprofile/community_dashboard_plugin_myprofile_controller.rb
... | ... | @@ -1,18 +0,0 @@ |
1 | -class CommunityDashboardPluginMyprofileController < MyProfileController | |
2 | - | |
3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | - | |
5 | - before_filter :allow_edit_dashboard, :only => :save_order | |
6 | - | |
7 | - def save_order | |
8 | - dashboard = profile.articles.find(params[:dashboard]) | |
9 | - redirect_to dashboard.url | |
10 | - end | |
11 | - | |
12 | - protected | |
13 | - | |
14 | - def allow_edit_dashboard | |
15 | - render_access_denied unless profile.articles.find(params[:dashboard]).allow_edit?(user) | |
16 | - end | |
17 | - | |
18 | -end |
plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb
... | ... | @@ -1,219 +0,0 @@ |
1 | -class CommunityHubPluginPublicController < PublicController | |
2 | - | |
3 | - append_view_path File.join(File.dirname(__FILE__) + '/../../views') | |
4 | - | |
5 | - layout false | |
6 | - | |
7 | - | |
8 | - def new_message | |
9 | - if logged_in? | |
10 | - | |
11 | - begin | |
12 | - hub = Article.find(params[:article_id]) | |
13 | - rescue | |
14 | - hub = nil | |
15 | - end | |
16 | - | |
17 | - if hub | |
18 | - message_data = {} | |
19 | - message_data.merge!(params[:message]) if params[:message] | |
20 | - | |
21 | - message = Comment.new(message_data) | |
22 | - message.author = user | |
23 | - message.title = message_timestamp | |
24 | - message.article = hub | |
25 | - message.ip_address = request.remote_ip | |
26 | - message.user_agent = request.user_agent | |
27 | - message.referrer = request.referrer | |
28 | - | |
29 | - if message && message.save | |
30 | - render :text => {'ok' => true}.to_json, :content_type => 'application/json' | |
31 | - return true | |
32 | - end | |
33 | - end | |
34 | - | |
35 | - end | |
36 | - render :text => {'ok' => false}.to_json, :content_type => 'application/json' | |
37 | - end | |
38 | - | |
39 | - | |
40 | - def new_mediation | |
41 | - if logged_in? | |
42 | - | |
43 | - begin | |
44 | - profile = Profile.find(params[:profile_id]) | |
45 | - rescue | |
46 | - profile = nil | |
47 | - end | |
48 | - | |
49 | - if profile | |
50 | - mediation_data = {} | |
51 | - mediation_data.merge!(params[:article]) if params[:article] | |
52 | - | |
53 | - mediation = CommunityHubPlugin::Mediation.new(mediation_data) | |
54 | - mediation.name = CommunityHubPlugin::Mediation.timestamp | |
55 | - mediation.profile = profile | |
56 | - mediation.last_changed_by = user | |
57 | - mediation.created_by_id = user.id | |
58 | - mediation.source = 'local' | |
59 | - | |
60 | - if mediation && mediation.save | |
61 | - render :text => {'ok' => true}.to_json, :content_type => 'application/json' | |
62 | - return true | |
63 | - end | |
64 | - end | |
65 | - | |
66 | - end | |
67 | - render :text => {'ok' => false}.to_json, :content_type => 'application/json' | |
68 | - end | |
69 | - | |
70 | - | |
71 | - def newer_mediation_comment | |
72 | - latest_id = params[:latest_post] | |
73 | - mediation = params[:mediation] | |
74 | - comments = Comment.find(:all, :conditions => ["id > :id and source_id = :mediation", { :id => latest_id, :mediation => mediation }]) | |
75 | - render :partial => "mediation_comment", :collection => comments | |
76 | - end | |
77 | - | |
78 | - | |
79 | - def newer_comments | |
80 | - latest_post = params[:latest_post] | |
81 | - hub = Article.find(params[:hub]) | |
82 | - posts = Comment.find(:all, :order => "id desc", :conditions => ["id > :id and source_id = :hub", { :id => latest_post, :hub => hub }], :limit => 30) | |
83 | - | |
84 | - if !posts.empty? | |
85 | - oldest_post = posts.last.id | |
86 | - latest_post = posts.first.id | |
87 | - size = posts.size | |
88 | - else | |
89 | - oldest_post = 0 | |
90 | - latest_post = 0 | |
91 | - end | |
92 | - | |
93 | - render :partial => "post", :collection => posts, :locals => { :latest_id => latest_post, :oldest_id => oldest_post, :hub => hub } | |
94 | - end | |
95 | - | |
96 | - | |
97 | - def older_comments | |
98 | - oldest_id = params[:oldest_id] | |
99 | - hub = Article.find(params[:hub]) | |
100 | - posts = Comment.find(:all, :order => "id desc", :conditions => ["id < :id and source_id = :hub", { :id => oldest_id, :hub => hub }], :limit => 30) | |
101 | - | |
102 | - if !posts.empty? | |
103 | - oldest_id = posts.last.id | |
104 | - latest_id = posts.first.id | |
105 | - end | |
106 | - | |
107 | - render :partial => "post", :collection => posts, :locals => { :latest_id => latest_id, :oldest_id => oldest_id, :hub => hub } | |
108 | - end | |
109 | - | |
110 | - | |
111 | - def newer_articles | |
112 | - latest_post = params[:latest_post] | |
113 | - hub = Article.find(params[:hub]) | |
114 | - posts = CommunityHubPlugin::Mediation.find(:all, :order => "id desc", :conditions => ["id > :id and parent_id = :hub", { :id => latest_post, :hub => hub.id }]) | |
115 | - | |
116 | - if !posts.empty? | |
117 | - oldest_post = posts.last.id | |
118 | - latest_post = posts.first.id | |
119 | - else | |
120 | - oldest_post = 0 | |
121 | - latest_post = 0 | |
122 | - end | |
123 | - | |
124 | - render :partial => "mediation", :collection => posts, :locals => { :latest_post => latest_post, :oldest_post => oldest_post, :hub => hub } | |
125 | - end | |
126 | - | |
127 | - | |
128 | - def promote_user | |
129 | - if logged_in? | |
130 | - if (!params[:hub].blank? && !params[:user].blank?) | |
131 | - begin | |
132 | - hub = Article.find(params[:hub]) | |
133 | - rescue | |
134 | - hub = nil | |
135 | - end | |
136 | - if hub && hub.mediator?(user) | |
137 | - begin | |
138 | - user_to_promote = Profile.find(params[:user]) | |
139 | - rescue | |
140 | - user_to_promote = nil | |
141 | - end | |
142 | - if user_to_promote | |
143 | - hub.mediators += [user_to_promote.id] unless hub.mediators.include?(user_to_promote.id) | |
144 | - if hub.save | |
145 | - render :text => {'ok' => true}.to_json, :content_type => 'application/json' | |
146 | - return true | |
147 | - end | |
148 | - end | |
149 | - end | |
150 | - end | |
151 | - end | |
152 | - render :text => {'ok' => false}.to_json, :content_type => 'application/json' | |
153 | - end | |
154 | - | |
155 | - | |
156 | - def pin_message | |
157 | - if logged_in? | |
158 | - if (!params[:hub].blank? && !params[:message].blank?) | |
159 | - | |
160 | - begin | |
161 | - hub = Article.find(params[:hub]) | |
162 | - rescue | |
163 | - hub = nil | |
164 | - end | |
165 | - | |
166 | - if hub && hub.mediator?(user) | |
167 | - begin | |
168 | - message = Comment.find(params[:message]) | |
169 | - rescue | |
170 | - message = nil | |
171 | - end | |
172 | - | |
173 | - if message | |
174 | - author = message.author.blank? ? user : message.author | |
175 | - | |
176 | - mediation = CommunityHubPlugin::Mediation.new | |
177 | - mediation.name = CommunityHubPlugin::Mediation.timestamp | |
178 | - | |
179 | - mediation.profile = hub.profile | |
180 | - mediation.last_changed_by = author | |
181 | - mediation.created_by_id = author.id | |
182 | - mediation.body = message.body | |
183 | - mediation.parent_id = hub.id | |
184 | - mediation.source = 'local' | |
185 | - | |
186 | - if mediation && mediation.save | |
187 | - | |
188 | - if ( message.title == 'hub-message-twitter' ) | |
189 | - mediation.source = 'twitter' | |
190 | - mediation.author_name = message.name | |
191 | - mediation.profile_picture = message.profile_picture | |
192 | - mediation.save | |
193 | - end | |
194 | - | |
195 | - hub.pinned_messages += [message.id] unless hub.pinned_messages.include?(message.id) | |
196 | - hub.pinned_mediations += [mediation.id] unless hub.pinned_mediations.include?(mediation.id) | |
197 | - | |
198 | - if hub && hub.save | |
199 | - render :text => {'ok' => true}.to_json, :content_type => 'application/json' | |
200 | - return true | |
201 | - end | |
202 | - | |
203 | - end | |
204 | - | |
205 | - end | |
206 | - end | |
207 | - end | |
208 | - end | |
209 | - render :text => {'ok' => false}.to_json, :content_type => 'application/json' | |
210 | - end | |
211 | - | |
212 | - | |
213 | - protected | |
214 | - | |
215 | - def message_timestamp | |
216 | - "hub-message-#{(Time.now.to_f * 1000).to_i}" | |
217 | - end | |
218 | - | |
219 | -end |
plugins/community_hub/facebook_stream/codfish_facebook_api.rb
... | ... | @@ -1,86 +0,0 @@ |
1 | -require 'rubygems' | |
2 | -require 'open-uri' | |
3 | -require 'json' | |
4 | - | |
5 | -token = 'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' | |
6 | -hashtag = "love" | |
7 | -pooling_time = 10 | |
8 | - | |
9 | - | |
10 | -#Aviso 12/04/2014 | |
11 | -#token que só deverá expirar em 59 dias | |
12 | -#@graph = Koala::Facebook::API.new('CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') | |
13 | -# https://graph.facebook.com/v1.0/search?q=%23nba&type=post&access_token=CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH | |
14 | - | |
15 | -def not_blank(v) | |
16 | - if v == nil || v == "" | |
17 | - false | |
18 | - else | |
19 | - true | |
20 | - end | |
21 | -end | |
22 | - | |
23 | -#if hashtag[0]='#' | |
24 | -# hashtag = hashtag[1,hashtag.length-1] | |
25 | -#end | |
26 | - | |
27 | -extractedComments = [] | |
28 | -initialComments = [] | |
29 | -firstTime = true | |
30 | -read = 1 | |
31 | - | |
32 | -while true | |
33 | - file = open("https://graph.facebook.com/v1.0/search?q=%23#{hashtag}&type=post&access_token=#{token}") | |
34 | - itens = JSON.parse(file.read)['data'] | |
35 | - mostRecent = "" | |
36 | - itens.each{|i| | |
37 | - from = "" | |
38 | - message = "" | |
39 | - if not_blank(i['from']['name']) | |
40 | - from = i['from']['name'] | |
41 | - if not_blank(i['message']) | |
42 | - message += i['message'] | |
43 | - end | |
44 | - if not_blank(message) | |
45 | - if mostRecent == "" or mostRecent < i["created_time"] | |
46 | - mostRecent = i["created_time"] | |
47 | - end | |
48 | - | |
49 | - extractedComments.push("#{from} said: #{message}") | |
50 | - # puts "#{from} said: #{message}" | |
51 | - end | |
52 | - end | |
53 | - } | |
54 | - | |
55 | - extractedComments = extractedComments.uniq | |
56 | - if firstTime | |
57 | - initialComments = extractedComments.clone | |
58 | - firstTime = false | |
59 | - end | |
60 | - | |
61 | -# extractedComments.each{|comment| | |
62 | -# puts comment | |
63 | -# } | |
64 | - | |
65 | -# extractedComments.each{|comment| | |
66 | -# puts comment | |
67 | -# } | |
68 | - | |
69 | - | |
70 | - newComments = extractedComments - initialComments | |
71 | - newComments = newComments.uniq | |
72 | - initialComments += newComments | |
73 | - initialComments = initialComments.uniq | |
74 | - newComments.each{|comment| | |
75 | - puts comment | |
76 | - } | |
77 | - puts "****************************************************************************************************************" | |
78 | - puts "most recent post at #{mostRecent}" | |
79 | - puts "Read: #{read} newComments: #{newComments.length} initialComments: #{initialComments.length} extractedComments: #{extractedComments.length} *******" | |
80 | - | |
81 | - read+=1 | |
82 | - sleep(pooling_time) | |
83 | -end | |
84 | - | |
85 | - | |
86 | - |
plugins/community_hub/facebook_stream/facebook_stream.rb
... | ... | @@ -1,56 +0,0 @@ |
1 | -require 'rubygems' | |
2 | -require 'koala' | |
3 | -require 'json' | |
4 | - | |
5 | -#Aviso 12/04/2014 | |
6 | -#token que só deverá expirar em 59 dias | |
7 | -@graph = Koala::Facebook::API.new('CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') | |
8 | -# https://graph.facebook.com/v1.0/search?q=%23dilma&type=post&access_token=CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH | |
9 | - | |
10 | -#feed = @graph.get_connections("participabr", "posts") | |
11 | - | |
12 | -comentariosIniciais = [] | |
13 | -comentariosExtraidos = [] | |
14 | -comentariosNovos = [] | |
15 | - | |
16 | -primeiraVez = true | |
17 | - | |
18 | -while true | |
19 | - | |
20 | - feed = @graph.get_connections("mundoreagindo", "posts") | |
21 | - | |
22 | - array = [] | |
23 | - comentariosExtraidos = [] | |
24 | - feed.each {|f| | |
25 | - if f['comments'] != nil && f['comments']['data'] != nil | |
26 | - array.push(f['comments']['data']) | |
27 | - end | |
28 | - } | |
29 | - | |
30 | - array.each{ |comentarios| | |
31 | - comentarios.each{|comentario| | |
32 | - comentariosExtraidos.push("#{comentario['from']['name']} disse: #{comentario['message']}") | |
33 | - } | |
34 | - } | |
35 | - | |
36 | - comentariosExtraidos = comentariosExtraidos.uniq | |
37 | - | |
38 | - if primeiraVez | |
39 | - comentariosIniciais=comentariosExtraidos.clone | |
40 | - primeiraVez = false | |
41 | - end | |
42 | - | |
43 | -# comentariosExtraidos.each{|comentario| | |
44 | -# puts comentario | |
45 | -# } | |
46 | - | |
47 | - comentariosNovos = comentariosExtraidos - comentariosIniciais | |
48 | - comentariosNovos = comentariosNovos.uniq | |
49 | - comentariosIniciais += comentariosNovos | |
50 | - comentariosIniciais = comentariosIniciais.uniq | |
51 | - comentariosNovos.each{|comentario| | |
52 | - puts comentario | |
53 | - } | |
54 | - | |
55 | - sleep(5) | |
56 | -end |
plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb
... | ... | @@ -1,48 +0,0 @@ |
1 | -require 'rubygems' | |
2 | -require 'koala' | |
3 | -require 'json' | |
4 | - | |
5 | -#Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! | |
6 | -#token will expire at 12/04/2014 (Brazilian date format) + 59 days | |
7 | -#'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' | |
8 | -# BACKUP TOKEN 'CAAEhsewl0ZAcBAHhipXszZCURSwWLmgvceDbs9mB5baJdLriFxYMEzywmF2fvZBuThuA2Mm7QF8wPd3E6R5pVqVEnC2VhcBb4VrfAnkZC73ZC5g1NRUnKZCB2e6CaRiUBDatR2nf505PeKp7Aj5XxvTdfSqdZCsXxQFYZApPNSUUgkUWm6HwL4rp21MRJXb612sZD' | |
9 | - | |
10 | -def deprecated_facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) | |
11 | - pooling_time ||= 5 | |
12 | - Koala.http_service.http_options = { :proxy => proxy_url } unless proxy_url.blank? | |
13 | - | |
14 | - @graph = Koala::Facebook::API.new(token) | |
15 | - initialComments = [] | |
16 | - firstTime = true | |
17 | - while true | |
18 | - feed = @graph.get_connections(page_id, "posts") | |
19 | - array = [] | |
20 | - extractedComments = [] | |
21 | - feed.each {|f| | |
22 | - if f['comments'] != nil && f['comments']['data'] != nil | |
23 | - array.push(f['comments']['data']) | |
24 | - end | |
25 | - } | |
26 | - extractedComments = array.flatten.uniq | |
27 | - if firstTime | |
28 | - initialComments = extractedComments.clone | |
29 | - firstTime = false | |
30 | - end | |
31 | - newComments = extractedComments - initialComments | |
32 | - newComments = newComments.uniq | |
33 | - initialComments += newComments | |
34 | - initialComments = initialComments.uniq | |
35 | - newComments.each{|comment| | |
36 | - puts "#{comment['from']['name']} " + _("said") + ": #{comment['message']}" | |
37 | - noosferoComment = Comment.new | |
38 | - noosferoComment.title = 'hub-message-facebook' | |
39 | - noosferoComment.source = hub | |
40 | - noosferoComment.body = comment['message'] | |
41 | - noosferoComment.author_id = author_id | |
42 | - noosferoComment.name = comment['from']['name'] | |
43 | - noosferoComment.email = 'admin@localhost.local' | |
44 | - noosferoComment.save! | |
45 | - } | |
46 | - sleep(pooling_time) | |
47 | - end | |
48 | -end |
plugins/community_hub/facebook_stream/lib_facebook_stream.rb
... | ... | @@ -1,117 +0,0 @@ |
1 | -require 'rubygems' | |
2 | -require 'open-uri' | |
3 | -require 'json' | |
4 | - | |
5 | -def not_blank?(v) | |
6 | - if v == nil || v == "" | |
7 | - false | |
8 | - else | |
9 | - true | |
10 | - end | |
11 | -end | |
12 | - | |
13 | -def save_comment(hub, comment, author_id) | |
14 | - noosferoComment = Comment.new | |
15 | - noosferoComment.title = 'hub-message-facebook' | |
16 | - noosferoComment.source = hub | |
17 | - noosferoComment.body = comment[:message] | |
18 | - noosferoComment.author_id = author_id | |
19 | - noosferoComment.name = comment[:from] | |
20 | - noosferoComment.email = 'admin@localhost.local' | |
21 | - noosferoComment.save! | |
22 | -end | |
23 | - | |
24 | - | |
25 | -def facebook_comments(hub, author_id, hashtag, pooling_time, token) | |
26 | - | |
27 | - pooling_time ||= 10 | |
28 | - token ||= 'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' | |
29 | - hashtag ||= "#nba" | |
30 | - #Aviso 12/04/2014 | |
31 | - #token que só deverá expirar em 59 dias | |
32 | - #https://graph.facebook.com/v1.0/search?q=%23nba&type=post&access_token=CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH | |
33 | - # | |
34 | - | |
35 | - #removes extra '#' | |
36 | - if hashtag[0,1]=='#' | |
37 | - hashtag = hashtag[1,hashtag.length-1] | |
38 | - end | |
39 | - | |
40 | - initialComments = [] | |
41 | - firstTime = true | |
42 | - read = 1 | |
43 | - url = "https://graph.facebook.com/v1.0/search?q=%23#{hashtag}&type=post&access_token=#{token}" | |
44 | - mostRecent = "" | |
45 | - | |
46 | - while true | |
47 | - connected = false | |
48 | - tries = 0 | |
49 | - while !connected | |
50 | - begin | |
51 | - tries += 1 | |
52 | - file = open(url) | |
53 | - connected = true | |
54 | - tries = 0 | |
55 | - rescue => e | |
56 | - puts "Error connecting to facebook: #{e.inspect} " | |
57 | - puts file | |
58 | - sleep (10 + 2 ** tries) | |
59 | - end | |
60 | - end | |
61 | - | |
62 | - extractedComments = [] | |
63 | - itens = JSON.parse(file.read)['data'] | |
64 | - itens.each{|i| | |
65 | - from = "" | |
66 | - message = "" | |
67 | - if not_blank?(i['from']['name']) | |
68 | - from = i['from']['name'] | |
69 | - if not_blank?(i['message']) | |
70 | - message += i['message'] | |
71 | - else | |
72 | - if not_blank?(i['description']) | |
73 | - message += i['description'] | |
74 | - else | |
75 | - if not_blank?(i['caption']) | |
76 | - message += i['caption'] | |
77 | - end | |
78 | - end | |
79 | - end | |
80 | - if not_blank?(message) | |
81 | - if mostRecent == "" or mostRecent < i["created_time"] | |
82 | - mostRecent = i["created_time"] | |
83 | - end | |
84 | - extractedComments.push({:from=>from, :message=>message}) | |
85 | - end | |
86 | - end | |
87 | - } | |
88 | - | |
89 | - extractedComments = extractedComments.uniq | |
90 | - if firstTime | |
91 | - initialComments = extractedComments.clone | |
92 | - firstTime = false | |
93 | - extractedComments.each{|comment| | |
94 | - puts "#{comment[:from]} " + _("said") + ": #{comment[:message]}" | |
95 | - save_comment(hub, comment, author_id) | |
96 | - } | |
97 | - end | |
98 | - | |
99 | -# if read == 2 | |
100 | -# extractedComments.push({:from=>"Evandro", :message=>"teste"}) | |
101 | -# end | |
102 | - | |
103 | - newComments = extractedComments - initialComments | |
104 | - newComments = newComments.uniq | |
105 | - initialComments += newComments | |
106 | - initialComments = initialComments.uniq | |
107 | - #y newComments | |
108 | - newComments.each{|comment| | |
109 | - puts "#{comment[:from]} " + _("said") + ": #{comment[:message]}" | |
110 | - save_comment(hub, comment, author_id) | |
111 | - } | |
112 | -# puts url | |
113 | -# puts "Read: #{read} last post #{mostRecent} newComments: #{newComments.length} initialComments: #{initialComments.length} extractedComments: #{extractedComments.length}" | |
114 | - read+=1 | |
115 | - sleep(pooling_time) | |
116 | - end | |
117 | -end | |
118 | 0 | \ No newline at end of file |
plugins/community_hub/lib/community_hub_plugin.rb
... | ... | @@ -1,30 +0,0 @@ |
1 | -class CommunityHubPlugin < Noosfero::Plugin | |
2 | - | |
3 | - def self.plugin_name | |
4 | - 'Community Hub' | |
5 | - end | |
6 | - | |
7 | - def self.plugin_description | |
8 | - _("New kind of content for communities.") | |
9 | - end | |
10 | - | |
11 | - def stylesheet? | |
12 | - true | |
13 | - end | |
14 | - | |
15 | - def content_types | |
16 | - return [] if !context.kind_of?(CmsController) | |
17 | - if context.respond_to?(:params) && context.params | |
18 | - types = [] | |
19 | - types << CommunityHubPlugin::Hub if context.profile.community? | |
20 | - types | |
21 | - else | |
22 | - [CommunityHubPlugin::Hub] | |
23 | - end | |
24 | - end | |
25 | - | |
26 | - def content_remove_new(page) | |
27 | - page.kind_of?(CommunityHubPlugin::Hub) | |
28 | - end | |
29 | - | |
30 | -end |
plugins/community_hub/lib/community_hub_plugin/hub.rb
... | ... | @@ -1,63 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../../twitter/stream.rb' | |
2 | -require File.dirname(__FILE__) + '/../../facebook_stream/lib_facebook_stream' | |
3 | - | |
4 | -class CommunityHubPlugin::Hub < Folder | |
5 | - | |
6 | - attr_accessible :last_changed_by_id, :integer | |
7 | - | |
8 | - attr_accessible :twitter_enabled, :type => :booelan, :default => false | |
9 | - attr_accessible :twitter_hashtags, :type => :string, :default => "" | |
10 | - attr_accessible :twitter_consumer_key, :type => :string, :default => "" | |
11 | - attr_accessible :twitter_consumer_secret, :type => :string, :default => "" | |
12 | - attr_accessible :twitter_access_token, :type => :string, :default => "" | |
13 | - attr_accessible :twitter_access_token_secret, :type => :string, :default => "" | |
14 | - attr_accessible :facebook_enabled, :type => :string, :default => "" | |
15 | - attr_accessible :facebook_hashtag, :type => :string, :default => "" | |
16 | - attr_accessible :facebook_access_token, :type => :string, :default => "" | |
17 | - | |
18 | - settings_items :twitter_enabled, :type => :boolean, :default => false | |
19 | - settings_items :twitter_hashtags, :type => :string, :default => "" | |
20 | - settings_items :twitter_consumer_key, :type => :string, :default => "" | |
21 | - settings_items :twitter_consumer_secret, :type => :string, :default => "" | |
22 | - settings_items :twitter_access_token, :type => :string, :default => "" | |
23 | - settings_items :twitter_access_token_secret, :type => :string, :default => "" | |
24 | - settings_items :facebook_enabled, :type => :boolean, :default => false | |
25 | - settings_items :facebook_hashtag, :type => :string, :default => "" | |
26 | - settings_items :facebook_pooling_time, :type => :integer, :default => 5 # Time in seconds | |
27 | - settings_items :facebook_access_token, :type => :string, :default => '' | |
28 | - settings_items :pinned_messages, :type => Array, :default => [] | |
29 | - settings_items :pinned_mediations, :type => Array, :default => [] | |
30 | - settings_items :mediators, :type => Array, :default => [] | |
31 | - | |
32 | - before_create do |hub| | |
33 | - hub.mediators = [hub.author.id] | |
34 | - end | |
35 | - | |
36 | - def notify_comments | |
37 | - false | |
38 | - end | |
39 | - | |
40 | - def self.icon_name(article = nil) | |
41 | - 'community-hub' | |
42 | - end | |
43 | - | |
44 | - def self.short_description | |
45 | - _("Hub") | |
46 | - end | |
47 | - | |
48 | - def self.description | |
49 | - _('Defines a hub.') | |
50 | - end | |
51 | - | |
52 | - def accept_comments? | |
53 | - true | |
54 | - end | |
55 | - | |
56 | - def view_page | |
57 | - "content_viewer/hub" | |
58 | - end | |
59 | - | |
60 | - def mediator?(user) | |
61 | - self.allow_edit?(user) || self.mediators.include?(user.id) | |
62 | - end | |
63 | -end |
plugins/community_hub/lib/community_hub_plugin/hub_helper.rb
... | ... | @@ -1,23 +0,0 @@ |
1 | -module CommunityHubPlugin::HubHelper | |
2 | - | |
3 | - def mediator?(hub) | |
4 | - logged_in? && (user && hub.allow_edit?(user) || hub.mediators.include?(user.id)) | |
5 | - end | |
6 | - | |
7 | - def promoted?(hub, person) | |
8 | - logged_in? && (hub.allow_edit?(person) || hub.mediators.include?(person.id)) | |
9 | - end | |
10 | - | |
11 | - def pinned_message?(hub, message_id) | |
12 | - hub.pinned_messages.include?(message_id) ? true : false | |
13 | - end | |
14 | - | |
15 | - def pinned_mediation?(hub, mediation_id) | |
16 | - hub.pinned_mediations.include?(mediation_id) ? true : false | |
17 | - end | |
18 | - | |
19 | - def post_time(time) | |
20 | - _('%{hour}:%{minutes}') % { :hour => time.hour, :minutes => time.strftime("%M") } rescue '' | |
21 | - end | |
22 | - | |
23 | -end |
plugins/community_hub/lib/community_hub_plugin/listener.rb
... | ... | @@ -1,48 +0,0 @@ |
1 | -class CommunityHubPlugin::Listener | |
2 | - | |
3 | - class << self | |
4 | - | |
5 | - def twitter_service(hub) | |
6 | - listen_twitter_stream(hub, nil) | |
7 | - end | |
8 | - | |
9 | - def facebook_service(hub) | |
10 | - facebook_comments(hub, nil, hub.facebook_hashtag, hub.facebook_pooling_time, hub.facebook_access_token) | |
11 | - end | |
12 | - | |
13 | - def run | |
14 | - hubs = {} | |
15 | - loop do | |
16 | - log "searching for hubs" | |
17 | - CommunityHubPlugin::Hub.all.each do |hub| | |
18 | - hub_conf = hubs[hub.id] | |
19 | - if hub_conf.nil? || hub_conf[:hub].updated_at < hub.updated_at | |
20 | - hub_conf[:threads].each {|t| t.terminate} if hub_conf | |
21 | - log "hub #{hub.id} found!!!!!!" | |
22 | - threads = [] | |
23 | - threads << Thread.new { twitter_service(hub) } if hub.twitter_enabled | |
24 | - threads << Thread.new { facebook_service(hub) } if hub.facebook_enabled | |
25 | - hubs[hub.id] = {:threads => threads, :hub => hub} | |
26 | - end | |
27 | - end | |
28 | - sleep(10) | |
29 | - end | |
30 | - end | |
31 | - | |
32 | - def initialize_logger | |
33 | - logdir = File.join(Rails.root, 'log', CommunityHubPlugin::Listener.name.underscore) | |
34 | - FileUtils.makedirs(logdir) if !File.exist?(logdir) | |
35 | - logpath = File.join(logdir, "#{ENV['RAILS_ENV']}_#{Time.now.strftime('%F')}.log") | |
36 | - @logger = Logger.new(logpath) | |
37 | - end | |
38 | - | |
39 | - def log(message) | |
40 | - #puts message | |
41 | - initialize_logger unless @initiated | |
42 | - @initiated ||= true | |
43 | - @logger << "[#{Time.now.strftime('%F %T %z')}] #{message}\n" | |
44 | - end | |
45 | - | |
46 | - end | |
47 | - | |
48 | -end |
plugins/community_hub/lib/community_hub_plugin/mediation.rb
... | ... | @@ -1,23 +0,0 @@ |
1 | -class CommunityHubPlugin::Mediation < Article | |
2 | - | |
3 | - before_save do |mediation| | |
4 | - mediation.advertise = false | |
5 | - mediation.notify_comments = false | |
6 | - nil | |
7 | - end | |
8 | - | |
9 | - settings_items :profile_picture, :type => :string, :default => "" | |
10 | - | |
11 | - def self.timestamp | |
12 | - "hub-mediation-#{(Time.now.to_f * 1000).to_i}" | |
13 | - end | |
14 | - | |
15 | - def self.description | |
16 | - _('Hub mediation') | |
17 | - end | |
18 | - | |
19 | - def self.short_description | |
20 | - _('Hub mediation') | |
21 | - end | |
22 | - | |
23 | -end |
plugins/community_hub/lib/ext/comment.rb
plugins/community_hub/po/community_hub.pot
... | ... | @@ -1,176 +0,0 @@ |
1 | -# SOME DESCRIPTIVE TITLE. | |
2 | -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER | |
3 | -# This file is distributed under the same license as the PACKAGE package. | |
4 | -# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. | |
5 | -# | |
6 | -#, fuzzy | |
7 | -msgid "" | |
8 | -msgstr "" | |
9 | -"Project-Id-Version: 1.1~rc2-1809-gd4babc7\n" | |
10 | -"POT-Creation-Date: 2015-04-13 19:39-0300\n" | |
11 | -"PO-Revision-Date: 2015-04-13 19:39-0300\n" | |
12 | -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
13 | -"Language-Team: LANGUAGE <LL@li.org>\n" | |
14 | -"MIME-Version: 1.0\n" | |
15 | -"Content-Type: text/plain; charset=UTF-8\n" | |
16 | -"Content-Transfer-Encoding: 8bit\n" | |
17 | -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | |
18 | - | |
19 | -#: plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb:36 plugins/community_hub/facebook_stream/lib_facebook_stream.rb:94 | |
20 | -#: plugins/community_hub/facebook_stream/lib_facebook_stream.rb:109 | |
21 | -msgid "said" | |
22 | -msgstr "" | |
23 | - | |
24 | -#: plugins/community_hub/lib/community_hub_plugin/hub.rb:45 | |
25 | -msgid "Hub" | |
26 | -msgstr "" | |
27 | - | |
28 | -#: plugins/community_hub/lib/community_hub_plugin/hub.rb:49 | |
29 | -msgid "Defines a hub." | |
30 | -msgstr "" | |
31 | - | |
32 | -#: plugins/community_hub/lib/community_hub_plugin/hub_helper.rb:20 | |
33 | -msgid "%{hour}:%{minutes}" | |
34 | -msgstr "" | |
35 | - | |
36 | -#: plugins/community_hub/lib/community_hub_plugin/mediation.rb:16 plugins/community_hub/lib/community_hub_plugin/mediation.rb:20 | |
37 | -msgid "Hub mediation" | |
38 | -msgstr "" | |
39 | - | |
40 | -#: plugins/community_hub/lib/community_hub_plugin.rb:8 | |
41 | -msgid "New kind of content for communities." | |
42 | -msgstr "" | |
43 | - | |
44 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:3 | |
45 | -msgid "HUB Settings:" | |
46 | -msgstr "" | |
47 | - | |
48 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:8 | |
49 | -msgid "Title" | |
50 | -msgstr "" | |
51 | - | |
52 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:12 | |
53 | -msgid "Description" | |
54 | -msgstr "" | |
55 | - | |
56 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:16 | |
57 | -msgid "Image:" | |
58 | -msgstr "" | |
59 | - | |
60 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:22 | |
61 | -msgid "Twitter Settings:" | |
62 | -msgstr "" | |
63 | - | |
64 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:26 | |
65 | -msgid "Turn on TWITTER" | |
66 | -msgstr "" | |
67 | - | |
68 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:28 | |
69 | -msgid "Twitter's Hashtags, comma separated (example: participa.br,participabr)" | |
70 | -msgstr "" | |
71 | - | |
72 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:31 | |
73 | -msgid "Twitter's consumer key" | |
74 | -msgstr "" | |
75 | - | |
76 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:35 | |
77 | -msgid "Twitter's consumer secret" | |
78 | -msgstr "" | |
79 | - | |
80 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:39 | |
81 | -msgid "Twitter's access token" | |
82 | -msgstr "" | |
83 | - | |
84 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:43 | |
85 | -msgid "Twitter's access token secret" | |
86 | -msgstr "" | |
87 | - | |
88 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:47 | |
89 | -msgid "Facebook Settings:" | |
90 | -msgstr "" | |
91 | - | |
92 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:51 | |
93 | -msgid "Turn on FACEBOOK" | |
94 | -msgstr "" | |
95 | - | |
96 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:53 | |
97 | -msgid "Facebook's hashtag (example: #participabr)" | |
98 | -msgstr "" | |
99 | - | |
100 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:55 | |
101 | -msgid "Facebook's access token" | |
102 | -msgstr "" | |
103 | - | |
104 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:57 | |
105 | -msgid "How to get a new access token?" | |
106 | -msgstr "" | |
107 | - | |
108 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:14 plugins/community_hub/views/content_viewer/hub.html.erb:54 | |
109 | -msgid "Live" | |
110 | -msgstr "" | |
111 | - | |
112 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:18 plugins/community_hub/views/content_viewer/hub.html.erb:58 | |
113 | -msgid "Mediation" | |
114 | -msgstr "" | |
115 | - | |
116 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:25 | |
117 | -msgid "Auto scrolling" | |
118 | -msgstr "" | |
119 | - | |
120 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:38 | |
121 | -msgid "Message" | |
122 | -msgstr "" | |
123 | - | |
124 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:40 | |
125 | -msgid "Type your message here" | |
126 | -msgstr "" | |
127 | - | |
128 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:41 plugins/community_hub/views/content_viewer/hub.html.erb:79 | |
129 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb:11 | |
130 | -msgid "Send" | |
131 | -msgstr "" | |
132 | - | |
133 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:93 | |
134 | -msgid "Are you sure that you want to pin this message?" | |
135 | -msgstr "" | |
136 | - | |
137 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:94 | |
138 | -msgid "Are you sure that you want to promote this user?" | |
139 | -msgstr "" | |
140 | - | |
141 | -#: plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb:4 | |
142 | -msgid "General settings" | |
143 | -msgstr "" | |
144 | - | |
145 | -#: plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb:4 | |
146 | -msgid "Embed" | |
147 | -msgstr "" | |
148 | - | |
149 | -#: plugins/community_hub/views/community_hub_plugin_public/_post.html.erb:23 | |
150 | -msgid "Pin message" | |
151 | -msgstr "" | |
152 | - | |
153 | -#: plugins/community_hub/views/community_hub_plugin_public/_post.html.erb:26 | |
154 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:40 | |
155 | -msgid "Message pinned" | |
156 | -msgstr "" | |
157 | - | |
158 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:29 | |
159 | -msgid "User not promoted" | |
160 | -msgstr "" | |
161 | - | |
162 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:32 | |
163 | -msgid "User promoted" | |
164 | -msgstr "" | |
165 | - | |
166 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:54 | |
167 | -msgid "Comments" | |
168 | -msgstr "" | |
169 | - | |
170 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb:10 | |
171 | -msgid "Type your comment here" | |
172 | -msgstr "" | |
173 | - | |
174 | -#: plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb:2 | |
175 | -msgid "BANNER SPACE" | |
176 | -msgstr "" |
plugins/community_hub/po/pt/community_hub.po
... | ... | @@ -1,177 +0,0 @@ |
1 | -msgid "" | |
2 | -msgstr "" | |
3 | -"Project-Id-Version: 0.45.0-6097-g490300c\n" | |
4 | -"POT-Creation-Date: 2015-07-23 16:26-0300\n" | |
5 | -"PO-Revision-Date: 2015-04-13 19:39-0300\n" | |
6 | -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | |
7 | -"Language-Team: LANGUAGE <LL@li.org>\n" | |
8 | -"Language: \n" | |
9 | -"MIME-Version: 1.0\n" | |
10 | -"Content-Type: text/plain; charset=UTF-8\n" | |
11 | -"Content-Transfer-Encoding: 8bit\n" | |
12 | -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" | |
13 | - | |
14 | -#: plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb:36 | |
15 | -#: plugins/community_hub/facebook_stream/lib_facebook_stream.rb:94 | |
16 | -#: plugins/community_hub/facebook_stream/lib_facebook_stream.rb:109 | |
17 | -msgid "said" | |
18 | -msgstr "disse" | |
19 | - | |
20 | -#: plugins/community_hub/lib/community_hub_plugin/hub.rb:45 | |
21 | -msgid "Hub" | |
22 | -msgstr "Hub" | |
23 | - | |
24 | -#: plugins/community_hub/lib/community_hub_plugin/hub.rb:49 | |
25 | -msgid "Defines a hub." | |
26 | -msgstr "Define um hub." | |
27 | - | |
28 | -#: plugins/community_hub/lib/community_hub_plugin/hub_helper.rb:20 | |
29 | -msgid "%{hour}:%{minutes}" | |
30 | -msgstr "" | |
31 | - | |
32 | -#: plugins/community_hub/lib/community_hub_plugin/mediation.rb:16 | |
33 | -#: plugins/community_hub/lib/community_hub_plugin/mediation.rb:20 | |
34 | -msgid "Hub mediation" | |
35 | -msgstr "Mediação do hub" | |
36 | - | |
37 | -#: plugins/community_hub/lib/community_hub_plugin.rb:8 | |
38 | -msgid "New kind of content for communities." | |
39 | -msgstr "Novo tipo de conteúdo para diálogo em comunidades." | |
40 | - | |
41 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:3 | |
42 | -msgid "HUB Settings:" | |
43 | -msgstr "Configuração do Hub:" | |
44 | - | |
45 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:8 | |
46 | -msgid "Title" | |
47 | -msgstr "Título" | |
48 | - | |
49 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:12 | |
50 | -msgid "Description" | |
51 | -msgstr "Descrição" | |
52 | - | |
53 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:16 | |
54 | -msgid "Image:" | |
55 | -msgstr "Imagem:" | |
56 | - | |
57 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:22 | |
58 | -msgid "Twitter Settings:" | |
59 | -msgstr "Configurações do Twitter:" | |
60 | - | |
61 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:26 | |
62 | -msgid "Turn on TWITTER" | |
63 | -msgstr "Ativar Twitter" | |
64 | - | |
65 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:28 | |
66 | -msgid "Twitter's Hashtags, comma separated (example: participa.br,participabr)" | |
67 | -msgstr "" | |
68 | -"Hashtag do Twitter, separadas por vírgula (exemplo: participa.br,participabr)" | |
69 | - | |
70 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:31 | |
71 | -msgid "Twitter's consumer key" | |
72 | -msgstr "" | |
73 | - | |
74 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:35 | |
75 | -msgid "Twitter's consumer secret" | |
76 | -msgstr "" | |
77 | - | |
78 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:39 | |
79 | -msgid "Twitter's access token" | |
80 | -msgstr "" | |
81 | - | |
82 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:43 | |
83 | -msgid "Twitter's access token secret" | |
84 | -msgstr "" | |
85 | - | |
86 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:47 | |
87 | -msgid "Facebook Settings:" | |
88 | -msgstr "Configurações do Facebook:" | |
89 | - | |
90 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:51 | |
91 | -msgid "Turn on FACEBOOK" | |
92 | -msgstr "Ativar Facebook" | |
93 | - | |
94 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:53 | |
95 | -msgid "Facebook's hashtag (example: #participabr)" | |
96 | -msgstr "Hashtag do Facebook (exemplo: #participabr)" | |
97 | - | |
98 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:55 | |
99 | -msgid "Facebook's access token" | |
100 | -msgstr "" | |
101 | - | |
102 | -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:57 | |
103 | -msgid "How to get a new access token?" | |
104 | -msgstr "Como obter um novo token de acesso?" | |
105 | - | |
106 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:14 | |
107 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:54 | |
108 | -msgid "Live" | |
109 | -msgstr "Ao Vivo" | |
110 | - | |
111 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:18 | |
112 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:58 | |
113 | -msgid "Mediation" | |
114 | -msgstr "Mediação" | |
115 | - | |
116 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:25 | |
117 | -msgid "Auto scrolling" | |
118 | -msgstr "Rolagem automática" | |
119 | - | |
120 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:38 | |
121 | -msgid "Message" | |
122 | -msgstr "Mensagem" | |
123 | - | |
124 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:40 | |
125 | -msgid "Type your message here" | |
126 | -msgstr "Digite sua mensagem aqui" | |
127 | - | |
128 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:41 | |
129 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:79 | |
130 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb:11 | |
131 | -msgid "Send" | |
132 | -msgstr "Enviar" | |
133 | - | |
134 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:93 | |
135 | -msgid "Are you sure that you want to pin this message?" | |
136 | -msgstr "Tem certeza que deseja fixar esta mensagem?" | |
137 | - | |
138 | -#: plugins/community_hub/views/content_viewer/hub.html.erb:94 | |
139 | -msgid "Are you sure that you want to promote this user?" | |
140 | -msgstr "Tem certeza que deseja promover este usuário?" | |
141 | - | |
142 | -#: plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb:4 | |
143 | -msgid "General settings" | |
144 | -msgstr "Configurações gerais" | |
145 | - | |
146 | -#: plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb:4 | |
147 | -msgid "Embed" | |
148 | -msgstr "" | |
149 | - | |
150 | -#: plugins/community_hub/views/community_hub_plugin_public/_post.html.erb:23 | |
151 | -msgid "Pin message" | |
152 | -msgstr "Fixar mensagem" | |
153 | - | |
154 | -#: plugins/community_hub/views/community_hub_plugin_public/_post.html.erb:26 | |
155 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:40 | |
156 | -msgid "Message pinned" | |
157 | -msgstr "Mensagem fixada" | |
158 | - | |
159 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:29 | |
160 | -msgid "User not promoted" | |
161 | -msgstr "Usuário não promovido" | |
162 | - | |
163 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:32 | |
164 | -msgid "User promoted" | |
165 | -msgstr "Usuário promovido" | |
166 | - | |
167 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:54 | |
168 | -msgid "Comments" | |
169 | -msgstr "Comentários" | |
170 | - | |
171 | -#: plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb:10 | |
172 | -msgid "Type your comment here" | |
173 | -msgstr "Digite seu comentário aqui" | |
174 | - | |
175 | -#: plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb:2 | |
176 | -msgid "BANNER SPACE" | |
177 | -msgstr "" |
plugins/community_hub/public/icons/community-hub.png
442 Bytes
plugins/community_hub/public/icons/hub-arrow-right.png
349 Bytes
plugins/community_hub/public/icons/hub-not-pinned-icon.png
772 Bytes
plugins/community_hub/public/icons/hub-not-promote-icon.png
674 Bytes
plugins/community_hub/public/icons/hub-pinned-icon.png
772 Bytes
plugins/community_hub/public/icons/hub-promote-icon.png
674 Bytes
plugins/community_hub/public/icons/hub-remove-icon.png
567 Bytes
plugins/community_hub/public/icons/hub-samarelo-a.png
424 Bytes
plugins/community_hub/public/icons/hub-samarelo-b.png
426 Bytes
plugins/community_hub/public/icons/hub-samarelo.gif
357 Bytes
plugins/community_hub/public/icons/hub-sverde-a.png
438 Bytes
plugins/community_hub/public/icons/hub-sverde-b.png
438 Bytes
plugins/community_hub/public/icons/hub-svermelho-a.png
373 Bytes
plugins/community_hub/public/icons/hub-svermelho-b.png
374 Bytes
plugins/community_hub/public/icons/hub-time-bg.gif
807 Bytes
plugins/community_hub/public/icons/logo_facebook_50x50.png
905 Bytes
plugins/community_hub/public/icons/logo_twitter_50x50.png
1.73 KB
plugins/community_hub/public/icons/logo_twitter_bird_blue_50x50.png
1.08 KB
plugins/community_hub/public/icons/logo_twitter_bird_white_50x50.png
1.02 KB
plugins/community_hub/public/javascripts/community_hub.js
... | ... | @@ -1,366 +0,0 @@ |
1 | -var latest_post_id = 0; | |
2 | -var oldest_post_id = 0; | |
3 | -live_scroll_position = 0; | |
4 | -var mediations = []; | |
5 | -var message_interval_id; | |
6 | - | |
7 | -function load_more(tab) { | |
8 | - switch (tab) { | |
9 | - case 'live': | |
10 | - load_more_messages(); | |
11 | - break; | |
12 | - } | |
13 | -} | |
14 | - | |
15 | - | |
16 | -function load_more_messages() { | |
17 | - var hub_id = jQuery(".hub").attr('id'); | |
18 | - var oldest_id = jQuery("#live-posts li.post").last().attr("id"); | |
19 | - | |
20 | - jQuery.ajax({ | |
21 | - url: '/plugin/community_hub/public/older_comments', | |
22 | - type: 'get', | |
23 | - data: { oldest_id: oldest_id, hub: hub_id }, | |
24 | - success: function(data) { | |
25 | - if (data.trim().length > 0) { | |
26 | - jQuery("#live-posts").append(data); | |
27 | - } | |
28 | - }, | |
29 | - error: function(ajax, stat, errorThrown) { | |
30 | - } | |
31 | - }); | |
32 | -} | |
33 | - | |
34 | - | |
35 | -function validate_textarea(txt) { | |
36 | - return (txt.search(/[^\n\s]/)!=-1); | |
37 | -} | |
38 | - | |
39 | - | |
40 | -function toogle_mediation_comments(mediation) { | |
41 | - jQuery("#mediation-comment-list-" + mediation ).toggle(); | |
42 | - jQuery("#mediation-comment-form-" + mediation ).toggle(); | |
43 | -} | |
44 | - | |
45 | - | |
46 | -function new_mediation_comment(button, mediation) { | |
47 | - | |
48 | - if (!validate_textarea(jQuery("#mediation-comment-form-" + mediation + " textarea").val())) { | |
49 | - return false; | |
50 | - } | |
51 | - | |
52 | - for (var i = 0; i < mediations.length; i++) { | |
53 | - mediation_id = mediations[i][0]; | |
54 | - if (mediation_id == mediation) { | |
55 | - interval_id = mediations[i][1]; | |
56 | - clearInterval( interval_id ); | |
57 | - break; | |
58 | - } | |
59 | - | |
60 | - } | |
61 | - | |
62 | - mediations.splice(i, 1); | |
63 | - | |
64 | - var form = jQuery(button).parents("form"); | |
65 | - | |
66 | - jQuery("#mediation-comment-form-" + mediation + " .submit").attr("disabled", true); | |
67 | - | |
68 | - jQuery("body").addClass("hub-loading"); | |
69 | - | |
70 | - jQuery.post(form.attr("action"), form.serialize(), function(data) { | |
71 | - jQuery("body").removeClass("hub-loading"); | |
72 | - if (data.ok) { | |
73 | - jQuery("#mediation-comment-form-" + mediation + " textarea").val(''); | |
74 | - jQuery("#mediation-comment-form-" + mediation + " .submit").attr("disabled", false); | |
75 | - update_mediation_comments(mediation, false); | |
76 | - mediations.push( [ mediation, setInterval(function() { update_mediation_comments(mediation, false)}, 5000) ] ); | |
77 | - } | |
78 | - else { | |
79 | - jQuery("#mediation-comment-form-" + mediation + " .submit").attr("disabled", false); | |
80 | - mediations.push( [ mediation, setInterval(function() { update_mediation_comments(mediation, false)}, 5000) ] ); | |
81 | - } | |
82 | - }, 'json'); | |
83 | - | |
84 | -} | |
85 | - | |
86 | - | |
87 | -function new_message(button) { | |
88 | - | |
89 | - if (!validate_textarea(jQuery(".hub .form-message #message_body").val())) { | |
90 | - return false; | |
91 | - } | |
92 | - | |
93 | - clearInterval( message_interval_id ); | |
94 | - | |
95 | - var form = jQuery(button).parents("form"); | |
96 | - | |
97 | - jQuery(".hub .form-message .submit").attr("disabled", true); | |
98 | - | |
99 | - jQuery("body").addClass("hub-loading"); | |
100 | - | |
101 | - jQuery.post(form.attr("action"), form.serialize(), function(data) { | |
102 | - jQuery("body").removeClass("hub-loading"); | |
103 | - if (data.ok) { | |
104 | - jQuery(".hub .form-message #message_body").val(''); | |
105 | - jQuery(".hub .form-message .submit").attr("disabled", false); | |
106 | - update_live_stream(); | |
107 | - message_interval_id = setInterval(function() { update_live_stream()}, 5000); | |
108 | - } | |
109 | - else { | |
110 | - jQuery(".hub .form-message .submit").attr("disabled", false); | |
111 | - message_interval_id = setInterval(function() { update_live_stream()}, 5000); | |
112 | - } | |
113 | - }, 'json'); | |
114 | - | |
115 | -} | |
116 | - | |
117 | - | |
118 | -function new_mediation(button) { | |
119 | - | |
120 | - if (!validate_textarea(tinymce.get('article_body').getContent(''))) { | |
121 | - return false; | |
122 | - } | |
123 | - | |
124 | - var form = jQuery(button).parents("form"); | |
125 | - | |
126 | - jQuery(".hub .form-mediation .submit").attr("disabled", true); | |
127 | - | |
128 | - jQuery("body").addClass("hub-loading"); | |
129 | - | |
130 | - tinymce.triggerSave(); | |
131 | - jQuery.post(form.attr("action"), form.serialize(), function(data) { | |
132 | - jQuery("body").removeClass("hub-loading"); | |
133 | - if (data.ok) { | |
134 | - jQuery(".hub .form-mediation .submit").attr("disabled", false); | |
135 | - tinymce.get('article_body').setContent(''); | |
136 | - update_mediations(); | |
137 | - } | |
138 | - else { | |
139 | - jQuery(".hub .form-mediation .submit").attr("disabled", false); | |
140 | - } | |
141 | - }, 'json'); | |
142 | - | |
143 | -} | |
144 | - | |
145 | - | |
146 | -function promote_user(mediation, user_id) { | |
147 | - | |
148 | - if (confirm(DEFAULT_PROMOTE_QUESTION)) { | |
149 | - | |
150 | - var hub_id = jQuery(".hub").attr('id'); | |
151 | - | |
152 | - jQuery.ajax({ | |
153 | - url: '/plugin/community_hub/public/promote_user', | |
154 | - type: 'get', | |
155 | - dataType: 'json', | |
156 | - data: { user: user_id, hub: hub_id }, | |
157 | - success: function(data) { | |
158 | - jQuery(".promote a").filter("#" + mediation).replaceWith( '<img class="promoted" src="/plugins/community_hub/icons/hub-not-promote-icon.png" title="User promoted">' ); | |
159 | - }, | |
160 | - error: function(ajax, stat, errorThrown) { | |
161 | - } | |
162 | - }); | |
163 | - | |
164 | - } | |
165 | - | |
166 | -} | |
167 | - | |
168 | - | |
169 | -function pin_message(post_id) { | |
170 | - | |
171 | - if (confirm(DEFAULT_PIN_QUESTION)) { | |
172 | - | |
173 | - var hub_id = jQuery(".hub").attr('id'); | |
174 | - | |
175 | - jQuery.ajax({ | |
176 | - url: '/plugin/community_hub/public/pin_message', | |
177 | - type: 'get', | |
178 | - dataType: 'json', | |
179 | - data: { message: post_id, hub: hub_id }, | |
180 | - success: function(data) { | |
181 | - jQuery(".pin a").filter("#" + post_id).replaceWith( '<img class="pinned" src="/plugins/community_hub/icons/hub-not-pinned-icon.png" title="Message pinned">' ); | |
182 | - }, | |
183 | - error: function(ajax, stat, errorThrown) { | |
184 | - } | |
185 | - }); | |
186 | - | |
187 | - } | |
188 | - | |
189 | -} | |
190 | - | |
191 | - | |
192 | -function update_mediation_comments(mediation, recursive) { | |
193 | - | |
194 | - if (jQuery("#right-tab.show").size() != 0) { | |
195 | - | |
196 | - if (jQuery(".hub #mediation-comment-list-" + mediation).css('display') != "none") { | |
197 | - | |
198 | - var hub_id = jQuery(".hub").attr('id'); | |
199 | - | |
200 | - if (jQuery("#mediation-comment-list-" + mediation + " li").first().length == 0) { | |
201 | - var latest_post_id = 0; | |
202 | - } | |
203 | - else { | |
204 | - var latest_post_id = jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").last().attr('id'); | |
205 | - } | |
206 | - | |
207 | - jQuery.ajax({ | |
208 | - url: '/plugin/community_hub/public/newer_mediation_comment', | |
209 | - type: 'get', | |
210 | - data: { latest_post: latest_post_id, mediation: mediation }, | |
211 | - success: function(data) { | |
212 | - if (data.trim().length > 0) { | |
213 | - jQuery("#mediation-comment-list-" + mediation + "").append(data); | |
214 | - jQuery("#mediation-comment-total-" + mediation).html(jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").size()); | |
215 | - } | |
216 | - }, | |
217 | - error: function(ajax, stat, errorThrown) { | |
218 | - } | |
219 | - }); | |
220 | - | |
221 | - } | |
222 | - | |
223 | - } | |
224 | - | |
225 | - if (recursive) { | |
226 | - setTimeout(function() { | |
227 | - update_mediation_comments(mediation, true); | |
228 | - }, 5000); | |
229 | - } | |
230 | -} | |
231 | - | |
232 | - | |
233 | -function update_mediations() { | |
234 | - | |
235 | - if (jQuery("#right-tab.show").size() != 0) { | |
236 | - | |
237 | - var hub_id = jQuery(".hub").attr('id'); | |
238 | - | |
239 | - if (jQuery("#mediation-posts li").first().length == 0) { | |
240 | - var latest_post_id = 0; | |
241 | - } | |
242 | - else { | |
243 | - var latest_post_id = jQuery("#mediation-posts li").first().attr('id'); | |
244 | - } | |
245 | - | |
246 | - jQuery.ajax({ | |
247 | - url: '/plugin/community_hub/public/newer_articles', | |
248 | - type: 'get', | |
249 | - data: { latest_post: latest_post_id, hub: hub_id }, | |
250 | - success: function(data) { | |
251 | - jQuery("body").removeClass("hub-loading"); | |
252 | - if (data.trim().length > 0) { | |
253 | - jQuery("#mediation-posts").prepend(data); | |
254 | - } | |
255 | - }, | |
256 | - error: function(ajax, stat, errorThrown) { | |
257 | - } | |
258 | - }); | |
259 | - | |
260 | - } | |
261 | - | |
262 | - setTimeout(update_mediations, 10000); | |
263 | -} | |
264 | - | |
265 | - | |
266 | -function update_live_stream() { | |
267 | - if (jQuery("#left-tab.show").size() != 0) { | |
268 | - | |
269 | - var hub_id = jQuery(".hub").attr('id'); | |
270 | - | |
271 | - if (jQuery("#live-posts li").first().length == 0) { | |
272 | - var latest_post_id = 0; | |
273 | - } | |
274 | - else { | |
275 | - var latest_post_id = jQuery("#live-posts li").first().attr('id'); | |
276 | - } | |
277 | - | |
278 | - jQuery.ajax({ | |
279 | - url: '/plugin/community_hub/public/newer_comments', | |
280 | - type: 'get', | |
281 | - data: { latest_post: latest_post_id, hub: hub_id }, | |
282 | - success: function(data) { | |
283 | - | |
284 | - if (data.trim().length > 0) { | |
285 | - jQuery("#live-posts").prepend(data); | |
286 | - if (jQuery("#auto_scrolling").prop('checked', true)) { | |
287 | - jQuery("#live-posts").scrollTop(0); | |
288 | - } | |
289 | - else { | |
290 | - jQuery("#live-posts").scrollTop(live_scroll_position); | |
291 | - } | |
292 | - } | |
293 | - | |
294 | - if (first_hub_load) { | |
295 | - jQuery("body").removeClass("hub-loading"); | |
296 | - first_hub_load = false; | |
297 | - } | |
298 | - | |
299 | - } | |
300 | - }); | |
301 | - | |
302 | - } | |
303 | -} | |
304 | - | |
305 | -function hub_left_tab_click() { | |
306 | - jQuery("#right-tab").removeClass('show'); | |
307 | - jQuery("#right-tab").addClass('hide'); | |
308 | - jQuery("#left-tab").removeClass('hide'); | |
309 | - jQuery("#left-tab").addClass('show'); | |
310 | -} | |
311 | - | |
312 | -function hub_right_tab_click() { | |
313 | - jQuery("#left-tab").removeClass('show'); | |
314 | - jQuery("#left-tab").addClass('hide'); | |
315 | - jQuery("#right-tab").removeClass('hide'); | |
316 | - jQuery("#right-tab").addClass('show'); | |
317 | - jQuery(".hub #right-tab.show h1.live").click(hub_left_tab_click); | |
318 | - if (first_mediations_load) { | |
319 | - jQuery("body").addClass("hub-loading"); | |
320 | - first_mediations_load = false; | |
321 | - update_mediations(); | |
322 | - } | |
323 | -} | |
324 | - | |
325 | -first_hub_load = true; | |
326 | -first_mediations_load = true; | |
327 | - | |
328 | -jQuery(".hub .envelope").scroll(function() { | |
329 | - jQuery("#auto_scrolling").prop('checked', false); | |
330 | - | |
331 | - | |
332 | - // live stream tab... | |
333 | - if (jQuery("#left-tab.show").size() != 0) { | |
334 | - current_envelope = jQuery(".hub .live .envelope"); | |
335 | - current_list_posts = jQuery(".hub ul#live-posts"); | |
336 | - tab = 'live'; | |
337 | - } | |
338 | - else { | |
339 | - // mediation tab... | |
340 | - if (jQuery("#right-tab.show").size() != 0) { | |
341 | - current_envelope = jQuery(".hub .mediation .envelope"); | |
342 | - current_list_posts = jQuery(".hub ul#mediation-posts"); | |
343 | - tab = 'mediation'; | |
344 | - } | |
345 | - } | |
346 | - | |
347 | - if (current_envelope.scrollTop() == (current_list_posts.height() - current_envelope.height() + 23)) { | |
348 | - load_more(tab); | |
349 | - } | |
350 | - | |
351 | -}); | |
352 | - | |
353 | - | |
354 | -jQuery(document).ready(function() { | |
355 | - | |
356 | - jQuery("#live-posts").scroll(function() { | |
357 | - live_scroll_position = jQuery("#live-posts").scrollTop(); | |
358 | - }); | |
359 | - | |
360 | - jQuery(".hub #left-tab.show h1.mediation").click(hub_right_tab_click); | |
361 | - | |
362 | - jQuery("body").addClass("hub-loading"); | |
363 | - | |
364 | - message_interval_id = setInterval(function() { update_live_stream() }, 5000); | |
365 | - | |
366 | -}); |
plugins/community_hub/public/style.css
... | ... | @@ -1,576 +0,0 @@ |
1 | -#banner-embed-container { | |
2 | - width: 49%; | |
3 | - float: right; | |
4 | -} | |
5 | - | |
6 | -#input-panel { | |
7 | - width: 100%; | |
8 | - padding-top: 10px; | |
9 | - display: inline-block; | |
10 | -} | |
11 | - | |
12 | -#hub-loading { | |
13 | - float: right; | |
14 | -} | |
15 | - | |
16 | -.hub-loading { | |
17 | - cursor: wait; | |
18 | -} | |
19 | - | |
20 | -.icon-newcommunity-hub, | |
21 | -.icon-community-hub { | |
22 | - background-image: url(/plugins/community_hub/icons/community-hub.png) | |
23 | -} | |
24 | - | |
25 | -.hub ul {padding-left: 0px; margin-top: 0;} | |
26 | - | |
27 | -#content .hub h1{ | |
28 | - margin-bottom: 0; | |
29 | -} | |
30 | - | |
31 | -#content .hub .content-tab h1{ | |
32 | - border-color: #D71410 #CCCCCC -moz-use-text-color; | |
33 | - border-left: 1px solid #CCCCCC; | |
34 | - border-right: 1px solid #CCCCCC; | |
35 | - border-style: solid solid none; | |
36 | - border-width: 1px 1px 0; | |
37 | - border-top: 1px solid #D71410; | |
38 | -} | |
39 | - | |
40 | -#content .hub .title { | |
41 | - font-size: 33px; | |
42 | - font-weight: normal; | |
43 | - padding-right: 70px; | |
44 | - color: #4b7421; | |
45 | - font-variant: normal; | |
46 | -} | |
47 | - | |
48 | -.hub .description { | |
49 | - font-size: 14px; | |
50 | -} | |
51 | - | |
52 | -.hub .post { | |
53 | - border-top: 1px solid #ddd; | |
54 | - background: url("images/hub-time-bg.gif") repeat-y left top #fff; | |
55 | - padding: 5px 0; | |
56 | -} | |
57 | - | |
58 | - | |
59 | -.hub .time{ | |
60 | - display: inline-block; | |
61 | - font-size: 8px; | |
62 | - padding-top: 10px; | |
63 | - text-align: center; | |
64 | - vertical-align: top; | |
65 | - width: 35px; | |
66 | -} | |
67 | - | |
68 | -.hub .avatar{ | |
69 | - background-color: lightGray; | |
70 | - display: inline-block; | |
71 | - height: 43px; | |
72 | - margin: 0 10px; | |
73 | - vertical-align: top; | |
74 | - width: 43px; | |
75 | - text-align: center; | |
76 | -} | |
77 | - | |
78 | -.hub .avatar img{ | |
79 | - max-height: 43px; | |
80 | - max-width: 43px; | |
81 | -} | |
82 | - | |
83 | -.hub .message { | |
84 | - display: inline-block; | |
85 | - width: 65%; | |
86 | - float: none; | |
87 | - clear: both; | |
88 | -} | |
89 | - | |
90 | -.hub .show .message { | |
91 | - width: 80%; | |
92 | -} | |
93 | - | |
94 | -.hub .message .author { | |
95 | - font-weight: bold; | |
96 | - display: inline-block; | |
97 | - margin-right: 5px; | |
98 | - padding-bottom: 0px; | |
99 | -} | |
100 | - | |
101 | -.hub .mediation-bar { | |
102 | - display: inline-block; | |
103 | - margin: 10px 0 10px 104px; | |
104 | - width: 83%; | |
105 | -} | |
106 | - | |
107 | -.hub .mediation-bar ul {} | |
108 | - | |
109 | -.hub .mediation-bar ul li { | |
110 | - display: inline-block; | |
111 | - overflow: hidden; | |
112 | - width: 16px; | |
113 | -} | |
114 | - | |
115 | -.hub .mediation-bar ul li.likes-dislikes{ | |
116 | - overflow: visible; | |
117 | - text-indent: 0px; | |
118 | - width: auto; | |
119 | - vertical-align: top; | |
120 | -} | |
121 | - | |
122 | -.hub .mediation-bar ul li.pin { | |
123 | - height: 25px; | |
124 | -} | |
125 | - | |
126 | -.hub .remove{} | |
127 | - | |
128 | -.hub .mediation-bar ul li a{ | |
129 | - text-indent: -10000px; | |
130 | -} | |
131 | - | |
132 | -.hub .not-promoted { | |
133 | - opacity: 0.5; | |
134 | - filter: alpha(opacity=50); | |
135 | -} | |
136 | - | |
137 | -.hub .pin .not-pinned { | |
138 | - opacity: 0.5; | |
139 | - filter: alpha(opacity=50); | |
140 | -} | |
141 | - | |
142 | -.hub .mediation-bar ul li.pin { | |
143 | - float: right; | |
144 | -} | |
145 | - | |
146 | -.hub ul.mediation-comment-list{ | |
147 | - margin-left: 80px; | |
148 | - display: inline-block; | |
149 | - padding: 10px 0; | |
150 | - background-color: #fff; | |
151 | - margin-bottom: 10px; | |
152 | -} | |
153 | - | |
154 | -.hub ul.mediation-comment-list li { | |
155 | - margin-bottom: 2px; | |
156 | -} | |
157 | - | |
158 | -.hub .mediation-comment-form { | |
159 | - margin-left: 70px; | |
160 | - margin-top: 10px; | |
161 | -} | |
162 | - | |
163 | -.hub input.button.with-text.icon-add.submit{ | |
164 | - display: block; | |
165 | -} | |
166 | - | |
167 | -.hub .live { | |
168 | - border: 0px solid lightGray; | |
169 | - display: inline-block; | |
170 | - float: left; | |
171 | - width: 49%; | |
172 | - margin-bottom: 2em; | |
173 | -} | |
174 | - | |
175 | -.hub .envelope { | |
176 | - height: 500px; | |
177 | - overflow-x: hidden; | |
178 | - overflow-y: scroll; | |
179 | - margin-bottom: 14px; | |
180 | - border: 1px solid lightgray; | |
181 | - width: 100%; | |
182 | - display: inline-block; | |
183 | - margin-top: 0; | |
184 | -} | |
185 | - | |
186 | -.hub ul#live-posts, .hub ul#mediation-posts{ | |
187 | - border-bottom: 1px solid lightgray; | |
188 | - padding-top: 10px; | |
189 | -} | |
190 | - | |
191 | -/*modificação da scroll bar*/ | |
192 | -.hub div.envelope::-webkit-scrollbar-button { | |
193 | - height: 0; | |
194 | - width: 0; | |
195 | -} | |
196 | - | |
197 | -.hub div.envelope::-webkit-scrollbar-thumb { | |
198 | - background-clip: padding-box; | |
199 | - background-color: rgba(0,0,0,.3); | |
200 | - border: 5px solid transparent; | |
201 | - border-radius: 10px; | |
202 | - min-height: 20px; | |
203 | - min-width: 20px; | |
204 | - height: 5px; | |
205 | - width: 5px; | |
206 | -} | |
207 | - | |
208 | -.hub div.envelope::-webkit-scrollbar { | |
209 | - height: 15px; | |
210 | - width: 15px; | |
211 | -} | |
212 | - | |
213 | -/*fim de modificação da scroll bar*/ | |
214 | - | |
215 | -.hub #live-posts .post { | |
216 | - background-color:#fff; | |
217 | -} | |
218 | - | |
219 | -.hub ul#mediation-posts .post{ | |
220 | - background-color:#eee; | |
221 | - border-color: #fff; | |
222 | - padding-bottom: 10px; | |
223 | -} | |
224 | - | |
225 | -/*novos elementos: h1.live - h1.mediation*/ | |
226 | -#content .main-block .hub .live h1.live, | |
227 | -#content .main-block .hub .mediation h1.mediation { | |
228 | - border: 1px solid lightGray; | |
229 | - border-top: 1px solid #96110D; | |
230 | - border-bottom: 0px solid #FFFFFF; | |
231 | - top: 3px; | |
232 | - float: left; | |
233 | - font-weight: normal; | |
234 | - margin-bottom: -1px; | |
235 | - position: relative; | |
236 | - width: 60%; | |
237 | -background-color: white; | |
238 | -z-index: 99; | |
239 | -} | |
240 | - | |
241 | -#content .main-block .hub .live h1.live{ | |
242 | - float: left; | |
243 | - margin-right: 20px; | |
244 | - margin-left: 0px; | |
245 | - text-align: center; | |
246 | -} | |
247 | - | |
248 | -#content .main-block .hub .mediation h1.mediation{ | |
249 | - float: right; | |
250 | - margin-right: 0px; | |
251 | - margin-left: 20px; | |
252 | - top: 0px; | |
253 | - left: 2px; | |
254 | - text-align: center; | |
255 | -} | |
256 | - | |
257 | -#content .main-block .hub .live h1.mediation, | |
258 | -#content .main-block .hub .mediation h1.live { | |
259 | - display: inline-block; | |
260 | - background-color: #EEEEEE; | |
261 | - border-bottom: 1px solid #CCCCCC; | |
262 | - border-top-color: #CCCCCC; | |
263 | - color: gray; | |
264 | - position: relative; | |
265 | - width: 30%; | |
266 | - text-align: center; | |
267 | - margin-top: 8px; | |
268 | - line-height: 27px; | |
269 | - cursor: pointer; | |
270 | - top: 1px; | |
271 | -} | |
272 | - | |
273 | -#content .main-block .hub .live h1.mediation {} | |
274 | - | |
275 | -#content .main-block .hub .mediation h1.live { | |
276 | - margin-left: 20px; | |
277 | - top:1px; | |
278 | -} | |
279 | - | |
280 | - | |
281 | -/*fim de novos elementos: h1.live - h1.mediation*/ | |
282 | - | |
283 | - | |
284 | -#content .hub .live .title { | |
285 | - color: #D71410; | |
286 | - display: inline-block; | |
287 | - font-size: 14px; | |
288 | - font-family: arial, sans-serif; | |
289 | - padding-right: 0; | |
290 | - width: 70%; | |
291 | -} | |
292 | -#content .hub .live .on-air { | |
293 | - background-color: #96110D; | |
294 | - border-radius: 10px 10px 10px 10px; | |
295 | - color: white; | |
296 | - display: inline-block; | |
297 | - font-size: 16px; | |
298 | - font-weight: bold; | |
299 | - padding: 0 0.5em; | |
300 | - text-align: center; | |
301 | - vertical-align: top; | |
302 | - width: 20%; | |
303 | - | |
304 | -} | |
305 | -#content .hub .live .off-air { | |
306 | - background-color: gray; | |
307 | - border-radius: 10px 10px 10px 10px; | |
308 | - color: black; | |
309 | - display: inline-block; | |
310 | - font-size: 16px; | |
311 | - font-weight: bold; | |
312 | - padding: 0 0.5em; | |
313 | - text-align: center; | |
314 | - text-transform: uppercase; | |
315 | - vertical-align: top; | |
316 | - width: 20%; | |
317 | -} | |
318 | - | |
319 | -/****aba live fechada****/ | |
320 | - | |
321 | - | |
322 | -.hub .live.hide { | |
323 | - width: 10%; | |
324 | -} | |
325 | - | |
326 | -.hub .live.hide ul#live-posts{ | |
327 | - overflow-x: visible; | |
328 | - overflow-y: visible; | |
329 | - background-color: lightGray; | |
330 | -} | |
331 | - | |
332 | -.hub .live.hide ul#live-posts li{ | |
333 | - display: none; | |
334 | -} | |
335 | - | |
336 | -#content .hub .live.hide h1 { | |
337 | - text-align: center; | |
338 | - cursor: pointer; | |
339 | -} | |
340 | - | |
341 | -#content .hub .live.hide h1 .title { | |
342 | - display: none; | |
343 | -} | |
344 | -#content .hub .live.hide .on-air, | |
345 | -#content .hub .live.hide .off-air { | |
346 | - width: auto; | |
347 | -} | |
348 | - | |
349 | -/****fim aba live fechada****/ | |
350 | - | |
351 | -/****aba live aberta****/ | |
352 | - | |
353 | -.hub .live.show { | |
354 | - width: 100%; | |
355 | -} | |
356 | - | |
357 | -.hub .live.show ul#live-posts .li{ | |
358 | - | |
359 | -} | |
360 | - | |
361 | -#content .hub .live.show .on-air, | |
362 | -#content .hub .live.show .off-air{ | |
363 | -margin-right: 10px; | |
364 | -} | |
365 | - | |
366 | -/****fim aba mlive aberta****/ | |
367 | - | |
368 | - | |
369 | -/**************************************/ | |
370 | - | |
371 | - | |
372 | -.hub .mediation { | |
373 | - border: 0px solid lightGray; | |
374 | - display: inline-block; | |
375 | - clear: right; | |
376 | - float: none; | |
377 | - margin-left: 1%; | |
378 | - width: 50%; | |
379 | - margin-bottom: 2em; | |
380 | -} | |
381 | - | |
382 | -#content .main-block .hub .mediation h1{ | |
383 | - border: 1px solid lightGray | |
384 | -} | |
385 | - | |
386 | -#content .hub .mediation .title { | |
387 | - color: gray; | |
388 | - display: inline-block; | |
389 | - font-size: 14px; | |
390 | - font-family: Arial, sans-serif; | |
391 | - padding-right: 0; | |
392 | -} | |
393 | -.hub .mediation .expand { | |
394 | - float: right; | |
395 | - padding-right: 1em; | |
396 | -} | |
397 | - | |
398 | -/****aba mediation fechada****/ | |
399 | - | |
400 | -.hub .mediation.hide { | |
401 | - border: 0px solid lightGray; | |
402 | - display: inline-block; | |
403 | - clear: right; | |
404 | - float: none; | |
405 | - margin-left: 1%; | |
406 | - width: 10%; | |
407 | - margin-bottom: 0em; | |
408 | -} | |
409 | - | |
410 | -#content .main-block .hub .mediation.hide h1{ | |
411 | - cursor: pointer; | |
412 | -} | |
413 | - | |
414 | -#content .hub .mediation.hide .title { | |
415 | - display: inline-block; | |
416 | - font-size: 14px; | |
417 | - font-family: arial, sans-serif; | |
418 | - padding-right: 0; | |
419 | - width: 100%; | |
420 | -} | |
421 | -.hub .mediation.hide .expand { | |
422 | - display: none; | |
423 | -} | |
424 | - | |
425 | - | |
426 | -.hub .mediation.hide ul#mediation-posts { | |
427 | -height: 500px; | |
428 | -overflow-x: visible; | |
429 | -overflow-y: visible; | |
430 | -border-width: 0 1px 1px; | |
431 | -border-style: solid; | |
432 | -border-color: lightGray; | |
433 | -padding-top: 10px; | |
434 | -background-color: lightgray; | |
435 | -} | |
436 | - | |
437 | -.hub .mediation.hide ul#mediation-posts li{ | |
438 | -display: none; | |
439 | -} | |
440 | - | |
441 | -/****fim aba mediation fechada****/ | |
442 | - | |
443 | -/****aba mediation aberta****/ | |
444 | - | |
445 | -.hub .mediation.show { | |
446 | - width: 100%; | |
447 | -} | |
448 | - | |
449 | -#content .hub .mediation.show .title { | |
450 | - display: inline-block; | |
451 | - font-family: arial, sans-serif; | |
452 | - padding-right: 0; | |
453 | -} | |
454 | - | |
455 | -.hub .mediation.show ul#mediation-posts li{ | |
456 | - | |
457 | -} | |
458 | - | |
459 | -/****fim aba mediation aberta****/ | |
460 | - | |
461 | -.hub .mediation.hide, | |
462 | -.hub .live.hide { | |
463 | - display: none; | |
464 | - visibility: hidden; | |
465 | -} | |
466 | - | |
467 | -.hub .mediation.show, | |
468 | -.hub .live.show { | |
469 | - display: inline-block; | |
470 | - visibility: visible; | |
471 | -} | |
472 | - | |
473 | -.hub .form-mediation { | |
474 | - width: 60%; | |
475 | - display: inline-block; | |
476 | - padding: 10px; | |
477 | - border: 1px solid #c0c0c0; | |
478 | - overflow-x: hidden; | |
479 | -} | |
480 | - | |
481 | -.hub .form-message { | |
482 | - height: 148px; | |
483 | - padding: 10px; | |
484 | - border: 1px solid #c0c0c0; | |
485 | -} | |
486 | - | |
487 | - | |
488 | -.hub div.settings { | |
489 | - display: inline-block; | |
490 | - margin-left: 1%; | |
491 | - margin-top: 10px; | |
492 | - vertical-align: top; | |
493 | - width: 35%; | |
494 | -} | |
495 | - | |
496 | -.hub ul.settings li { | |
497 | - height: 50px; | |
498 | - line-height: 50px; | |
499 | - margin-bottom: 10px; | |
500 | - padding: 0 10px; | |
501 | - background: url("images/hub-arrow-right.png") no-repeat 90% top #ed8e01; | |
502 | -} | |
503 | - | |
504 | -.hub ul.settings span.collapse { | |
505 | - padding-right: 0.5em; | |
506 | - float: right; | |
507 | -} | |
508 | - | |
509 | -.hub div.banner { | |
510 | - height: 70px; | |
511 | - background-color: #6d6d6d; | |
512 | - text-align: center; | |
513 | - padding-top: 30px; | |
514 | -} | |
515 | - | |
516 | -.hub div.banner span { | |
517 | - color: white; | |
518 | - font-family: Arial Black, arial, sans-serif; | |
519 | - font-size: large; | |
520 | - font-weight: normal; | |
521 | - display: block; | |
522 | -} | |
523 | - | |
524 | -.hub div.embed { | |
525 | - margin-top: 10px; | |
526 | - padding: 8px; | |
527 | - border: 1px solid #c0c0c0; | |
528 | -} | |
529 | - | |
530 | -.hub div.embed textarea.code { | |
531 | - background-color: #f0f0f0; | |
532 | - border: 1px solid #f0f0f0; | |
533 | - height: 195px; | |
534 | - resize: none; | |
535 | -} | |
536 | - | |
537 | -#content .hub ul.settings li a{ | |
538 | - color: white; | |
539 | - font-family: Arial Black, arial, sans-serif; | |
540 | - font-size: large; | |
541 | - font-weight: normal; | |
542 | -} | |
543 | - | |
544 | -#content .hub ul.settings li a:hover { | |
545 | - text-decoration: none; | |
546 | -} | |
547 | - | |
548 | -#content .hub form input.button.submit { | |
549 | - font-family: Arial Black, arial, sans-serif; | |
550 | - font-size: small; | |
551 | - font-weight: normal; | |
552 | - color: #333; | |
553 | - margin-top: 10px; | |
554 | -} | |
555 | - | |
556 | -textarea#message_body { | |
557 | - width: auto; | |
558 | - margin-left: 80px; | |
559 | -} | |
560 | - | |
561 | -.post .comment-count { | |
562 | - margin-left: 80px; | |
563 | - padding: 5px 10px; | |
564 | - background-color: white; | |
565 | - display: inline-block; | |
566 | - border-radius: 5px; | |
567 | - font-weight: bold; | |
568 | - display: block; | |
569 | - margin-bottom: -5px; | |
570 | - margin-top: 10px; | |
571 | - max-width: 100px; | |
572 | -} | |
573 | - | |
574 | -.hub ul.mediation-comment-list { | |
575 | - width: 80%; | |
576 | -} |
plugins/community_hub/script/hub_updater
... | ... | @@ -1,17 +0,0 @@ |
1 | -#!/usr/bin/env ruby | |
2 | - | |
3 | -require 'daemons' | |
4 | -require 'optparse' | |
5 | - | |
6 | -NOOSFERO_ROOT = File.expand_path(File.dirname(__FILE__) + '/../../../') | |
7 | - | |
8 | -Daemons.run_proc('hub') do | |
9 | - Dir.chdir NOOSFERO_ROOT | |
10 | - require './config/environment' | |
11 | - | |
12 | - unless ENV['PROXY'].blank? | |
13 | - ENV['NO_PROXY'] ||= 'localhost' | |
14 | - require 'proxifier/env' | |
15 | - end | |
16 | - CommunityHubPlugin::Listener.run | |
17 | -end |
plugins/community_hub/test/functional/community_hub_plugin_cms_controller_test.rb
... | ... | @@ -1,73 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | - | |
3 | -class CmsController; def rescue_action(e) raise e end; end | |
4 | - | |
5 | -class CmsControllerTest < ActionController::TestCase | |
6 | - | |
7 | - def setup | |
8 | - @controller = CmsController.new | |
9 | - @request = ActionController::TestRequest.new | |
10 | - @response = ActionController::TestResponse.new | |
11 | - | |
12 | - user = create_user('testinguser') | |
13 | - | |
14 | - @environment = user.environment | |
15 | - | |
16 | - @community = Community.create!( | |
17 | - :name => 'Sample community', | |
18 | - :identifier => 'sample-community', | |
19 | - :environment => @environment | |
20 | - ) | |
21 | - | |
22 | - @community.add_admin(user.person) | |
23 | - | |
24 | - @community.save! | |
25 | - | |
26 | - @hub = CommunityHubPlugin::Hub.new( | |
27 | - :abstract => 'abstract', | |
28 | - :body => 'body', | |
29 | - :name => 'test-hub', | |
30 | - :profile => @community, | |
31 | - :last_changed_by_id => user | |
32 | - ) | |
33 | - | |
34 | - @hub.save! | |
35 | - | |
36 | - login_as(user.login) | |
37 | - | |
38 | - end | |
39 | - | |
40 | - should 'be able to edit hub settings' do | |
41 | - get :edit, :id => @hub.id, :profile => @community.identifier | |
42 | - assert_tag :tag => 'input', :attributes => { :id => 'article_name' } | |
43 | - assert_tag :tag => 'textarea', :attributes => { :id => 'article_body' } | |
44 | - assert_tag :tag => 'input', :attributes => { :id => 'article_twitter_enabled' } | |
45 | - assert_tag :tag => 'input', :attributes => { :id => 'article_twitter_hashtags' } | |
46 | - assert_tag :tag => 'input', :attributes => { :id => 'article_facebook_enabled' } | |
47 | - assert_tag :tag => 'input', :attributes => { :id => 'article_facebook_hashtag' } | |
48 | - assert_tag :tag => 'input', :attributes => { :id => 'article_facebook_access_token' } | |
49 | - end | |
50 | - | |
51 | - should 'be able to save hub' do | |
52 | - get :edit, :id => @hub.id, :profile => @community.identifier | |
53 | - post :edit, :id => @hub.id, :profile => @community.identifier, :article => { | |
54 | - :name => 'changed', | |
55 | - :body => 'changed', | |
56 | - :twitter_enabled => true, | |
57 | - :twitter_hashtags => 'changed', | |
58 | - :facebook_enabled => true, | |
59 | - :facebook_hashtag => 'changed', | |
60 | - :facebook_access_token => 'changed' | |
61 | - } | |
62 | - @hub.reload | |
63 | - assert_equal 'changed', @hub.name | |
64 | - assert_equal 'changed', @hub.body | |
65 | - assert_equal true, @hub.twitter_enabled | |
66 | - assert_equal 'changed', @hub.twitter_hashtags | |
67 | - assert_equal true, @hub.facebook_enabled | |
68 | - assert_equal 'changed', @hub.facebook_hashtag | |
69 | - assert_equal 'changed', @hub.facebook_access_token | |
70 | - end | |
71 | - | |
72 | -end | |
73 | - |
plugins/community_hub/test/functional/community_hub_plugin_content_viewer_controller_test.rb
... | ... | @@ -1,108 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | -require 'content_viewer_controller' | |
3 | - | |
4 | -class ContentViewerController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | -class ContentViewerControllerTest < ActionController::TestCase | |
7 | - | |
8 | - all_fixtures | |
9 | - | |
10 | - def setup | |
11 | - @controller = ContentViewerController.new | |
12 | - @request = ActionController::TestRequest.new | |
13 | - @response = ActionController::TestResponse.new | |
14 | - | |
15 | - @user = create_user('testinguser').person | |
16 | - | |
17 | - @environment = @user.environment | |
18 | - | |
19 | - @community = Community.create!( | |
20 | - :name => 'Sample community', | |
21 | - :identifier => 'sample-community', | |
22 | - :environment => @environment | |
23 | - ) | |
24 | - | |
25 | - @hub = CommunityHubPlugin::Hub.new( | |
26 | - :abstract => 'abstract', | |
27 | - :body => 'body', | |
28 | - :name => 'test-hub', | |
29 | - :profile => community, | |
30 | - :last_changed_by_id => user.id | |
31 | - ) | |
32 | - | |
33 | - @hub.save! | |
34 | - | |
35 | - end | |
36 | - | |
37 | - attr_reader :user, :environment, :community, :hub | |
38 | - should 'display live tab' do | |
39 | - get :view_page, @hub.url | |
40 | - assert_tag :tag => 'div', :attributes => { :id => 'left-tab' } | |
41 | - end | |
42 | - | |
43 | - should 'display mediation tab' do | |
44 | - get :view_page, @hub.url | |
45 | - assert_tag :tag => 'div', :attributes => { :id => 'right-tab' } | |
46 | - end | |
47 | - | |
48 | - should 'display auto scroll checkbox for live stream content' do | |
49 | - get :view_page, @hub.url | |
50 | - assert_tag :tag => 'div', :attributes => { :id => 'left-tab' }, :descendant => { | |
51 | - :tag => 'span', :descendant => { | |
52 | - :tag => 'input', :attributes => { :id => 'auto_scrolling', :type => 'checkbox' } | |
53 | - } | |
54 | - } | |
55 | - end | |
56 | - | |
57 | - should 'not display auto scroll setting for mediation content' do | |
58 | - get :view_page, @hub.url | |
59 | - assert_no_tag :tag => 'div', :attributes => { :id => 'right-tab' }, :descendant => { | |
60 | - :tag => 'span', :descendant => { | |
61 | - :tag => 'input', :attributes => { :id => 'auto_scrolling', :type => 'checkbox' } | |
62 | - } | |
63 | - } | |
64 | - end | |
65 | - | |
66 | - should 'not display message form if user is not logged' do | |
67 | - get :view_page, @hub.url | |
68 | - assert_no_tag :tag => 'div', :attributes => { :class => 'form-message' } | |
69 | - end | |
70 | - | |
71 | - should 'not display mediation form if user is not loged' do | |
72 | - get :view_page, @hub.url | |
73 | - assert_no_tag :tag => 'div', :attributes => { :class => 'form-mediation' } | |
74 | - end | |
75 | - | |
76 | - should 'display message form if user is logged' do | |
77 | - user = create_user('visitor') | |
78 | - login_as(user.login) | |
79 | - get :view_page, @hub.url | |
80 | - assert_tag :tag => 'div', :attributes => { :class => 'form-message' } | |
81 | - end | |
82 | - | |
83 | - should 'display mediation form if user is logged and is hub''s mediator' do | |
84 | - login_as(user.user.login) | |
85 | - get :view_page, @hub.url | |
86 | - assert_tag :tag => 'div', :attributes => { :class => 'form-mediation' } | |
87 | - end | |
88 | - | |
89 | - should 'not display mediation form if user is logged but is not hub''s mediator' do | |
90 | - visitor = create_user('visitor') | |
91 | - login_as(visitor.login) | |
92 | - assert_no_tag :tag => 'div', :attributes => { :class => 'form-mediation' } | |
93 | - end | |
94 | - | |
95 | - should 'display link to hub''s settings if user is mediator' do | |
96 | - login_as(user.user.login) | |
97 | - get :view_page, @hub.url | |
98 | - assert_tag :tag => 'div', :attributes => { :class => 'settings' } | |
99 | - end | |
100 | - | |
101 | - should 'not display link to hub''s settings if user is not mediator' do | |
102 | - visitor = create_user('visitor') | |
103 | - login_as(visitor.login) | |
104 | - get :view_page, @hub.url | |
105 | - assert_no_tag :tag => 'div', :attributes => { :class => 'settings' } | |
106 | - end | |
107 | - | |
108 | -end |
plugins/community_hub/test/functional/community_hub_plugin_public_controller_test.rb
... | ... | @@ -1,186 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | -require File.dirname(__FILE__) + '/../../controllers/public/community_hub_plugin_public_controller' | |
3 | - | |
4 | -class CommunityHubPluginPublicController; def rescue_action(e) raise e end; end | |
5 | - | |
6 | -class CommunityHubPluginPublicControllerTest < ActionController::TestCase | |
7 | - | |
8 | - all_fixtures | |
9 | - | |
10 | - def setup | |
11 | - @controller = CommunityHubPluginPublicController.new | |
12 | - @request = ActionController::TestRequest.new | |
13 | - @response = ActionController::TestResponse.new | |
14 | - | |
15 | - @user = create_user('testinguser').person | |
16 | - | |
17 | - @environment = @user.environment | |
18 | - | |
19 | - @community = Community.create!( | |
20 | - :name => 'Sample community', | |
21 | - :identifier => 'sample-community', | |
22 | - :environment => @environment | |
23 | - ) | |
24 | - | |
25 | - @community.save! | |
26 | - | |
27 | - @hub = CommunityHubPlugin::Hub.new( | |
28 | - :abstract => 'abstract', | |
29 | - :body => 'body', | |
30 | - :name => 'test-hub', | |
31 | - :profile => community, | |
32 | - :last_changed_by_id => user.id | |
33 | - ) | |
34 | - | |
35 | - @hub.save! | |
36 | - | |
37 | - end | |
38 | - | |
39 | - attr_reader :user, :environment, :community, :hub | |
40 | - | |
41 | - should 'display pin message flag if user is logged and mediator' do | |
42 | - message = create_message( hub, user ) | |
43 | - login_as(user.user.login) | |
44 | - xhr :get, :newer_comments, { :latest_post => 0, :hub => hub.id } | |
45 | - assert_tag :tag => 'li', :attributes => { :class => 'pin' } | |
46 | - end | |
47 | - | |
48 | - should 'not display pin message flag if user is not mediator' do | |
49 | - message = create_message( hub, user ) | |
50 | - visitor = create_user('visitor') | |
51 | - login_as(visitor.login) | |
52 | - xhr :get, :newer_comments, { :latest_post => 0, :hub => hub.id } | |
53 | - assert_no_tag :tag => 'li', :attributes => { :class => 'pin' } | |
54 | - end | |
55 | - | |
56 | - should 'pin message flag is link if message has not been pinned' do | |
57 | - message = create_message( hub, user ) | |
58 | - login_as(user.user.login) | |
59 | - xhr :get, :newer_comments, { :latest_post => 0, :hub => hub.id } | |
60 | - assert_tag :tag => 'li', :attributes => { :class => 'pin' }, :descendant => { | |
61 | - :tag => 'a', :descendant => { | |
62 | - :tag => 'img', :attributes => { :class => 'not-pinned' } | |
63 | - } | |
64 | - } | |
65 | - end | |
66 | - | |
67 | - should 'ping message flag is not link if message has beem pinned' do | |
68 | - message = create_message( hub, user ) | |
69 | - hub.pinned_messages += [message.id] | |
70 | - hub.save | |
71 | - login_as(user.user.login) | |
72 | - xhr :get, :newer_comments, { :latest_post => 0, :hub => hub.id } | |
73 | - assert_tag :tag => 'li', :attributes => { :class => 'pin' }, :descendant => { | |
74 | - :tag => 'img', :attributes => { :class => 'pinned' } | |
75 | - } | |
76 | - end | |
77 | - | |
78 | - should 'display promote user flag if user is logged and mediator' do | |
79 | - mediation = create_mediation(hub, user, community) | |
80 | - login_as(user.user.login) | |
81 | - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } | |
82 | - assert_tag :tag => 'li', :attributes => { :class => 'promote' } | |
83 | - end | |
84 | - | |
85 | - should 'not display promote user flag if user is not mediator' do | |
86 | - mediation = create_mediation(hub, user, community) | |
87 | - visitor = create_user('visitor') | |
88 | - login_as(visitor.login) | |
89 | - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } | |
90 | - assert_no_tag :tag => 'li', :attributes => { :class => 'promote' } | |
91 | - end | |
92 | - | |
93 | - should 'promote user flag is link if user has not been promoted' do | |
94 | - visitor = create_user('visitor').person | |
95 | - mediation = create_mediation(hub, visitor, community) | |
96 | - login_as(user.user.login) | |
97 | - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } | |
98 | - assert_tag :tag => 'li', :attributes => { :class => 'promote' }, :descendant => { | |
99 | - :tag => 'a', :descendant => { | |
100 | - :tag => 'img', :attributes => { :class => 'not-promoted' } | |
101 | - } | |
102 | - } | |
103 | - end | |
104 | - | |
105 | - should 'promote user flag is not link if user has been promoted' do | |
106 | - mediation = create_mediation(hub, user, community) | |
107 | - login_as(user.user.login) | |
108 | - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } | |
109 | - assert_tag :tag => 'li', :attributes => { :class => 'promote' }, :descendant => { | |
110 | - :tag => 'img', :attributes => { :class => 'promoted' } | |
111 | - } | |
112 | - end | |
113 | - | |
114 | - should 'promote user flag is not link if user is hub''s owner' do | |
115 | - mediation = create_mediation(hub, user, community) | |
116 | - login_as(user.user.login) | |
117 | - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } | |
118 | - assert_tag :tag => 'li', :attributes => { :class => 'promote' }, :descendant => { | |
119 | - :tag => 'img', :attributes => { :class => 'promoted' } | |
120 | - } | |
121 | - end | |
122 | - | |
123 | - should 'should create new message' do | |
124 | - login_as(user.user.login) | |
125 | - xhr :post, :new_message, { :article_id => hub.id, :message => {"body"=>"testmessage"} } | |
126 | - response = JSON.parse(@response.body) | |
127 | - assert_equal true, response['ok'] | |
128 | - end | |
129 | - | |
130 | - should 'should create new mediation' do | |
131 | - login_as(user.user.login) | |
132 | - xhr :post, :new_mediation, { :profile_id => community.id, :article => { "parent_id" => hub.id , "body" => "<p>testmediation</p>" } } | |
133 | - response = JSON.parse(@response.body) | |
134 | - assert_equal true, response['ok'] | |
135 | - end | |
136 | - | |
137 | - should 'should create new mediation comment' do | |
138 | - login_as(user.user.login) | |
139 | - mediation = create_mediation(hub, user, community) | |
140 | - xhr :post, :new_message, { "article_id" => mediation.id, "message" => {"body"=>"testmediationcomment"} } | |
141 | - response = JSON.parse(@response.body) | |
142 | - assert_equal true, response['ok'] | |
143 | - end | |
144 | - | |
145 | - should 'should get newer messages' do | |
146 | - message1 = create_message( hub, user ) | |
147 | - message2 = create_message( hub, user ) | |
148 | - message3 = create_message( hub, user ) | |
149 | - xhr :get, :newer_comments, { :latest_post => message2.id, :hub => hub.id } | |
150 | - assert_tag :tag => 'li', :attributes => { :id => message3.id } | |
151 | - end | |
152 | - | |
153 | - should 'should get oldest messages' do | |
154 | - message1 = create_message( hub, user ) | |
155 | - message2 = create_message( hub, user ) | |
156 | - message3 = create_message( hub, user ) | |
157 | - xhr :get, :older_comments, { :oldest_id => message2.id, :hub => hub.id } | |
158 | - assert_tag :tag => 'li', :attributes => { :id => message1.id } | |
159 | - end | |
160 | - | |
161 | - should 'should get newer mediations' do | |
162 | - mediation1 = create_mediation(hub, user, community) | |
163 | - mediation2 = create_mediation(hub, user, community) | |
164 | - mediation3 = create_mediation(hub, user, community) | |
165 | - xhr :get, :newer_articles, { :latest_post => mediation2.id, :hub => hub.id } | |
166 | - assert_tag :tag => 'li', :attributes => { :id => mediation3.id } | |
167 | - end | |
168 | - | |
169 | - should 'should promote user' do | |
170 | - login_as(user.user.login) | |
171 | - visitor = create_user('visitor').person | |
172 | - xhr :post, :promote_user, { :hub => hub.id, :user => visitor.id } | |
173 | - response = JSON.parse(@response.body) | |
174 | - assert_equal true, response['ok'] | |
175 | - end | |
176 | - | |
177 | - should 'should pin message' do | |
178 | - login_as(user.user.login) | |
179 | - message = create_message( hub, user ) | |
180 | - xhr :post, :pin_message, { :hub => hub.id, :message => message.id } | |
181 | - response = JSON.parse(@response.body) | |
182 | - assert_equal true, response['ok'] | |
183 | - end | |
184 | - | |
185 | -end | |
186 | - |
plugins/community_hub/test/test_helper.rb
... | ... | @@ -1,38 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../../../test/test_helper' | |
2 | - | |
3 | -def create_hub(name, community, user) | |
4 | - hub = CommunityHubPlugin::Hub.new(:abstract => 'abstract', :body => 'body', :name => name, :profile => community, :last_changed_by_id => user.id ) | |
5 | - hub.save! | |
6 | - hub | |
7 | -end | |
8 | - | |
9 | -def create_mediation(hub, community) | |
10 | - mediation = CommunityHubPlugin::Mediation.new(:profile => community) | |
11 | - mediation.name = CommunityHubPlugin::Mediation.timestamp | |
12 | - mediation.save! | |
13 | - mediation | |
14 | -end | |
15 | - | |
16 | -def create_message(hub,user) | |
17 | - message = Comment.new | |
18 | - message.author = user | |
19 | - message.title = "hub-message-#{(Time.now.to_f * 1000).to_i}" | |
20 | - message.body = 'body' | |
21 | - message.article = hub | |
22 | - message.save! | |
23 | - message | |
24 | -end | |
25 | - | |
26 | -def create_mediation(hub, user, community) | |
27 | - | |
28 | - #raise community.inspect | |
29 | - mediation = CommunityHubPlugin::Mediation.new | |
30 | - mediation.name = CommunityHubPlugin::Mediation.timestamp | |
31 | - mediation.profile = community | |
32 | - mediation.last_changed_by = user | |
33 | - mediation.created_by_id = user.id | |
34 | - mediation.source = 'local' | |
35 | - mediation.parent_id = hub.id | |
36 | - mediation.save! | |
37 | - mediation | |
38 | -end |
plugins/community_hub/test/unit/community_hub_plugin/hub_helper_test.rb
... | ... | @@ -1,18 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../../test_helper' | |
2 | - | |
3 | -class HubHelperTest < ActiveSupport::TestCase | |
4 | - | |
5 | - include CommunityHubPlugin::HubHelper | |
6 | - include NoosferoTestHelper | |
7 | - | |
8 | - should 'return time formated to hh:mm' do | |
9 | - t = Time.utc(2014,"jan",1,17,40,0) | |
10 | - assert_equal post_time(t), "17:40" | |
11 | - end | |
12 | - | |
13 | - should 'return empty string if param is not time' do | |
14 | - i = 1 | |
15 | - assert_equal post_time(i), '' | |
16 | - end | |
17 | - | |
18 | -end |
plugins/community_hub/test/unit/community_hub_plugin/hub_test.rb
... | ... | @@ -1,128 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../../test_helper' | |
2 | - | |
3 | -class HubTest < ActiveSupport::TestCase | |
4 | - | |
5 | - def setup | |
6 | - @env = fast_create(Environment) | |
7 | - @user = create_user('testuser', :environment => @env).person | |
8 | - @comm = fast_create(Community, :environment_id => @env.id) | |
9 | - @hub = create_hub('hub', @comm, @user) | |
10 | - end | |
11 | - | |
12 | - should 'has setting twitter_enable' do | |
13 | - assert_respond_to @hub, :twitter_enabled | |
14 | - end | |
15 | - | |
16 | - should 'default value of setting twitter_enabled is false' do | |
17 | - assert_equal @hub.twitter_enabled, false | |
18 | - end | |
19 | - | |
20 | - should 'has setting twitter_hashtags' do | |
21 | - assert_respond_to @hub, :twitter_hashtags | |
22 | - end | |
23 | - | |
24 | - should 'default value of setting twitter_hashtags is blank' do | |
25 | - assert_equal @hub.twitter_hashtags, "" | |
26 | - end | |
27 | - | |
28 | - should 'has setting twitter_consumer_key' do | |
29 | - assert_respond_to @hub, :twitter_consumer_key | |
30 | - end | |
31 | - | |
32 | - should 'default value of setting twitter_consumer is blank' do | |
33 | - assert_equal @hub.twitter_consumer_key, "" | |
34 | - end | |
35 | - | |
36 | - should 'has setting twitter_consumer_secret' do | |
37 | - assert_respond_to @hub, :twitter_consumer_secret | |
38 | - end | |
39 | - | |
40 | - should 'default value of setting twitter_consumer_secret is blank' do | |
41 | - assert_equal @hub.twitter_consumer_secret, "" | |
42 | - end | |
43 | - | |
44 | - should 'has setting twitter_access_token' do | |
45 | - assert_respond_to @hub, :twitter_access_token | |
46 | - end | |
47 | - | |
48 | - should 'default value of setting twitter_access_token is blank' do | |
49 | - assert_equal @hub.twitter_access_token, "" | |
50 | - end | |
51 | - | |
52 | - should 'has setting twitter_access_token_secret' do | |
53 | - assert_respond_to @hub, :twitter_access_token_secret | |
54 | - end | |
55 | - | |
56 | - should 'default value of setting twitter_access_token_secret' do | |
57 | - assert_equal @hub.twitter_access_token_secret, "" | |
58 | - end | |
59 | - | |
60 | - should 'has setting facebook_enabled' do | |
61 | - assert_respond_to @hub, :facebook_enabled | |
62 | - end | |
63 | - | |
64 | - should 'default value of setting facebook_enabled is false' do | |
65 | - assert_equal @hub.facebook_enabled, false | |
66 | - end | |
67 | - | |
68 | - should 'has setting facebook_pooling_time' do | |
69 | - assert_respond_to @hub, :facebook_pooling_time | |
70 | - end | |
71 | - | |
72 | - should 'default value of setting facebook_pooling_time id five (5)' do | |
73 | - assert_equal @hub.facebook_pooling_time, 5 | |
74 | - end | |
75 | - | |
76 | - should 'has setting facebook_access_token' do | |
77 | - assert_respond_to @hub, :facebook_access_token | |
78 | - end | |
79 | - | |
80 | - should 'default value of setting facebook_access_token is blank' do | |
81 | - assert_equal @hub.facebook_access_token, "" | |
82 | - end | |
83 | - | |
84 | - should 'has pinned_messages' do | |
85 | - assert_respond_to @hub, :pinned_messages | |
86 | - end | |
87 | - | |
88 | - should 'default value of pinned_messags' do | |
89 | - assert_equal @hub.pinned_messages, [] | |
90 | - end | |
91 | - | |
92 | - should 'has pinned_mediations' do | |
93 | - assert_respond_to @hub, :pinned_mediations | |
94 | - end | |
95 | - | |
96 | - should 'default value of pinned_mediations' do | |
97 | - assert_equal @hub.pinned_mediations, [] | |
98 | - end | |
99 | - | |
100 | - should 'has mediators' do | |
101 | - assert_respond_to @hub, :mediators | |
102 | - end | |
103 | - | |
104 | - should 'hub creator is mediator by default' do | |
105 | - assert @hub.mediators.include?(@user.id) | |
106 | - end | |
107 | - | |
108 | - should 'describe yourself' do | |
109 | - assert CommunityHubPlugin::Hub.description | |
110 | - end | |
111 | - | |
112 | - should 'has a short descriptionf' do | |
113 | - assert CommunityHubPlugin::Hub.short_description | |
114 | - end | |
115 | - | |
116 | - should 'accept comments by default' do | |
117 | - assert @hub.accept_comments? | |
118 | - end | |
119 | - | |
120 | - should 'do not notify comments by default' do | |
121 | - assert !@hub.notify_comments | |
122 | - end | |
123 | - | |
124 | - should 'has a view page' do | |
125 | - assert @hub.view_page | |
126 | - end | |
127 | - | |
128 | -end |
plugins/community_hub/test/unit/community_hub_plugin/listener_test.rb
... | ... | @@ -1,31 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../../test_helper' | |
2 | - | |
3 | -class ListenerTest < ActiveSupport::TestCase | |
4 | - | |
5 | - should 'initialize logger' do | |
6 | - logger = CommunityHubPlugin::Listener.initialize_logger | |
7 | - logfile = logger.instance_variable_get(:@logdev).instance_variable_get(:@filename) | |
8 | - assert_instance_of(Logger, logger) | |
9 | - assert File.exists?(logfile) | |
10 | - end | |
11 | - | |
12 | - should 'log message' do | |
13 | - logdir = File.join(Rails.root, 'log', CommunityHubPlugin::Listener.name.underscore) | |
14 | - | |
15 | - if File.exists?(logdir) | |
16 | - Dir.foreach(logdir) { |f| | |
17 | - fn = File.join(logdir, f); | |
18 | - File.delete(fn) if f != '.' && f != '..' | |
19 | - } | |
20 | - end | |
21 | - | |
22 | - logger = CommunityHubPlugin::Listener.initialize_logger | |
23 | - CommunityHubPlugin::Listener.log('testmessage') | |
24 | - | |
25 | - logfile = logger.instance_variable_get(:@logdev).instance_variable_get(:@filename) | |
26 | - text = File.open(logfile).read | |
27 | - | |
28 | - assert_match /testmessage/, text | |
29 | - end | |
30 | - | |
31 | -end |
plugins/community_hub/test/unit/community_hub_plugin/mediation_test.rb
... | ... | @@ -1,33 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../../test_helper' | |
2 | - | |
3 | -class MediationTest < ActiveSupport::TestCase | |
4 | - | |
5 | - def setup | |
6 | - @env = fast_create(Environment) | |
7 | - @user = create_user('testuser', :environment => @env).person | |
8 | - @comm = fast_create(Community, :environment_id => @env.id) | |
9 | - @hub = create_hub('hub', @comm, @user) | |
10 | - @mediation = create_mediation(@hub, @user, @comm) | |
11 | - end | |
12 | - | |
13 | - should 'has setting profile_picture' do | |
14 | - assert_respond_to @mediation, :profile_picture | |
15 | - end | |
16 | - | |
17 | - should 'default value of setting profile_picture is blank' do | |
18 | - assert_equal @mediation.profile_picture, "" | |
19 | - end | |
20 | - | |
21 | - should 'generate timestamp for mediation' do | |
22 | - assert CommunityHubPlugin::Mediation.timestamp | |
23 | - end | |
24 | - | |
25 | - should 'default value of advertise is false' do | |
26 | - assert !@mediation.advertise | |
27 | - end | |
28 | - | |
29 | - should 'default value of notify comments is false' do | |
30 | - assert !@mediation.notify_comments | |
31 | - end | |
32 | - | |
33 | -end |
plugins/community_hub/test/unit/community_hub_plugin_test.rb
... | ... | @@ -1,49 +0,0 @@ |
1 | -require File.dirname(__FILE__) + '/../test_helper' | |
2 | - | |
3 | -class CommunityHubPluginTest < ActiveSupport::TestCase | |
4 | - | |
5 | - def setup | |
6 | - @plugin = CommunityHubPlugin.new | |
7 | - @profile = fast_create(Community) | |
8 | - @params = {} | |
9 | - @plugin.stubs(:context).returns(self) | |
10 | - end | |
11 | - | |
12 | - attr_reader :profile, :params | |
13 | - | |
14 | - should 'has name' do | |
15 | - assert CommunityHubPlugin.plugin_name | |
16 | - end | |
17 | - | |
18 | - should 'describe yourself' do | |
19 | - assert CommunityHubPlugin.plugin_description | |
20 | - end | |
21 | - | |
22 | - should 'has stylesheet' do | |
23 | - assert @plugin.stylesheet? | |
24 | - end | |
25 | - | |
26 | - should 'return Hub as a content type if profile is a community' do | |
27 | - assert_includes @plugin.content_types, CommunityHubPlugin::Hub | |
28 | - end | |
29 | - | |
30 | - should 'do not return Hub as a content type if profile is not a community' do | |
31 | - @profile = Organization.new | |
32 | - assert_not_includes @plugin.content_types, CommunityHubPlugin::Hub | |
33 | - end | |
34 | - | |
35 | - should 'do not return Hub as a content type if there is a parent' do | |
36 | - parent = fast_create(Blog, :profile_id => @profile.id) | |
37 | - @params[:parent_id] = parent.id | |
38 | - assert_not_includes @plugin.content_types, CommunityHubPlugin::Hub | |
39 | - end | |
40 | - | |
41 | - should 'return true at content_remove_new if page is a Hub' do | |
42 | - assert @plugin.content_remove_new(CommunityHubPlugin::Hub.new) | |
43 | - end | |
44 | - | |
45 | - should 'return false at content_remove_new if page is not a Hub' do | |
46 | - assert !@plugin.content_remove_new(Article.new) | |
47 | - end | |
48 | - | |
49 | -end |
plugins/community_hub/twitter/stream.rb
... | ... | @@ -1,69 +0,0 @@ |
1 | -require 'rubygems' | |
2 | -require 'twitter' | |
3 | -require 'iconv' | |
4 | - | |
5 | -#disable address resolv to avoid problems with proxy | |
6 | -class Resolv | |
7 | - def self.getaddress(host) | |
8 | - host | |
9 | - end | |
10 | -end | |
11 | - | |
12 | -#Filters non-UTF8 octets | |
13 | -def UTF8Filter(string) | |
14 | - ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') | |
15 | - #Attention please, don't remove + ' ')[0..-2] it is used for UTF8 validation | |
16 | - ic.iconv(string + ' ')[0..-2] | |
17 | -end | |
18 | - | |
19 | -def listen_twitter_stream(hub, author_id) | |
20 | - | |
21 | - connected = false | |
22 | - tries = 0 | |
23 | - while !connected | |
24 | - begin | |
25 | - tries += 1 | |
26 | - client = Twitter::Streaming::Client.new do |config| | |
27 | - config.consumer_key = hub.twitter_consumer_key | |
28 | - config.consumer_secret = hub.twitter_consumer_secret | |
29 | - config.access_token = hub.twitter_access_token | |
30 | - config.access_token_secret = hub.twitter_access_token_secret | |
31 | - end | |
32 | - puts client.inspect | |
33 | - connected = true | |
34 | - tries = 0 | |
35 | - rescue => e | |
36 | - puts "Error connecting to twitter stream: #{e.inspect}" | |
37 | - sleep (10 + 2 ** tries) | |
38 | - end | |
39 | - end | |
40 | - | |
41 | - tries = 0 | |
42 | - while true | |
43 | - begin | |
44 | - tries += 1 | |
45 | - client.filter(:track => hub.twitter_hashtags) do |object| | |
46 | - if object.is_a?(Twitter::Tweet) | |
47 | - comment = Comment.new | |
48 | - comment.title = 'hub-message-twitter' | |
49 | - comment.source = hub | |
50 | - comment.body = UTF8Filter(object.text) | |
51 | - comment.profile_picture = object.user.profile_image_url.to_s | |
52 | - comment.author_id = author_id | |
53 | - comment.name = UTF8Filter(object.user.screen_name) | |
54 | - comment.email = 'admin@localhost.local' | |
55 | - | |
56 | - tries = 0 | |
57 | - begin | |
58 | - comment.save! | |
59 | - rescue => e | |
60 | - puts "Error writing twitter comment #{e.inspect}" | |
61 | - end | |
62 | - end | |
63 | - end | |
64 | - rescue => e | |
65 | - puts "Error reading twitter stream #{e.inspect}" | |
66 | - sleep (10 + 2 ** tries) | |
67 | - end | |
68 | - end | |
69 | -end |
plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb
... | ... | @@ -1,59 +0,0 @@ |
1 | -<div class='hub'> | |
2 | - | |
3 | - <h1><%= _("HUB Settings:") %></h1> | |
4 | - | |
5 | - <%= required_fields_message %> | |
6 | - | |
7 | - <div> | |
8 | - <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> | |
9 | - </div> | |
10 | - | |
11 | - <div> | |
12 | - <%= required labelled_form_field(_('Description'), text_area(:article, 'body', :style => 'width: 99%;')) %> | |
13 | - </div> | |
14 | - | |
15 | - <%= fields_for 'article[image_builder]', @article.image do |i| %> | |
16 | - <%= file_field_or_thumbnail(_('Image:'), @article.image, i) %> | |
17 | - <% end %> | |
18 | - | |
19 | - <br /> | |
20 | - | |
21 | - <div> | |
22 | - <h2><%= _('Twitter Settings:') %></h2> | |
23 | - </div> | |
24 | - | |
25 | - <%= check_box(:article, :twitter_enabled) %> | |
26 | - <span><%= _("Turn on TWITTER") %></span> | |
27 | - | |
28 | - <span><%= labelled_form_field(_('Twitter\'s Hashtags, comma separated (example: participa.br,participabr)'), text_field(:article, :twitter_hashtags)) %></span> | |
29 | - | |
30 | - <div> | |
31 | - <%= labelled_form_field(_('Twitter\'s consumer key'), text_field(:article, :twitter_consumer_key)) %> | |
32 | - </div> | |
33 | - | |
34 | - <div> | |
35 | - <%= labelled_form_field(_('Twitter\'s consumer secret'), text_field(:article, :twitter_consumer_secret)) %> | |
36 | - </div> | |
37 | - | |
38 | - <div> | |
39 | - <%= labelled_form_field(_('Twitter\'s access token'), text_field(:article, :twitter_access_token)) %> | |
40 | - </div> | |
41 | - | |
42 | - <div> | |
43 | - <%= labelled_form_field(_('Twitter\'s access token secret'), text_field(:article, :twitter_access_token_secret)) %> | |
44 | - </div> | |
45 | - <br /> | |
46 | - <div> | |
47 | - <h2><%= _('Facebook Settings:') %></h2> | |
48 | - </div> | |
49 | - | |
50 | - <%= check_box(:article, :facebook_enabled) %> | |
51 | - <span><%= _("Turn on FACEBOOK") %></span> | |
52 | - | |
53 | - <span><%= labelled_form_field(_('Facebook\'s hashtag (example: #participabr)'), text_field(:article, :facebook_hashtag)) %></span> | |
54 | - | |
55 | - <span><%= labelled_form_field(_('Facebook\'s access token'), text_field(:article, :facebook_access_token)) %></span> | |
56 | - <br /> | |
57 | - <a href='https://smashballoon.com/custom-facebook-feed/access-token/' ><%= _('How to get a new access token?') %><a> | |
58 | - <br /> | |
59 | -</div> |
plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb
plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb
... | ... | @@ -1,11 +0,0 @@ |
1 | -<% extend CommunityHubPlugin::HubHelper %> | |
2 | - | |
3 | -<div class="embed"> | |
4 | - <span class="label">Embed / <%= _("Embed") %></span> | |
5 | - <textarea cols="38" | |
6 | - id="comment_body" | |
7 | - name="comment[body]" | |
8 | - rows="10" | |
9 | - class="code" | |
10 | - style="width: 99%;"><%= embed_code(@page) %></textarea> | |
11 | -</div> | |
12 | 0 | \ No newline at end of file |
plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb
... | ... | @@ -1,87 +0,0 @@ |
1 | -<% extend CommunityHubPlugin::HubHelper %> | |
2 | - | |
3 | -<li id="<%= mediation.id %>" class="post"> | |
4 | - | |
5 | - <ul> | |
6 | - <li class="time"><%= post_time(mediation.created_at) %></li> | |
7 | - | |
8 | - <li class="avatar"> | |
9 | - <% if mediation.source == 'twitter' %> | |
10 | - <%= image_tag(mediation.profile_picture, :alt => "Twitter") %> | |
11 | - <% elsif mediation.source == 'facebook' %> | |
12 | - <%= image_tag('/plugins/community_hub/icons/logo_facebook_50x50.png', :alt => "Facebook") %> | |
13 | - <% else %> | |
14 | - <%= image_tag(profile_icon(mediation.created_by, :minor)) if mediation.created_by %> | |
15 | - <% end %> | |
16 | - </li> | |
17 | - <li class="message"><span class="author"><%= mediation.setting[:author_name] %>:</span> <%= mediation.body %></li> | |
18 | - | |
19 | - <% if mediator?(hub) %> | |
20 | - <li class="mediation-bar"> | |
21 | - | |
22 | - <ul> | |
23 | - | |
24 | - <% if mediation.source != 'twitter' && mediation.source != 'facebook' %> | |
25 | - | |
26 | - <li class="promote"> | |
27 | - <% if !promoted?(hub, mediation.created_by) %> | |
28 | - <a id="<%= mediation.id %>" href="#" onclick="promote_user(<%= mediation.id %>,<%= mediation.created_by.id %>); return false;"> | |
29 | - <img class="not-promoted" src="/plugins/community_hub/icons/hub-not-promote-icon.png" title="<%= _("User not promoted") %>" /> | |
30 | - </a> | |
31 | - <% else %> | |
32 | - <img class="promoted" src="/plugins/community_hub/icons/hub-not-promote-icon.png" title="<%= _("User promoted") %>" /> | |
33 | - <% end %> | |
34 | - </li> | |
35 | - | |
36 | - <% end %> | |
37 | - | |
38 | - <% if pinned_mediation?(hub, mediation.id) %> | |
39 | - <li class="pin"> | |
40 | - <img class="pinned" src="/plugins/community_hub/icons/hub-not-pinned-icon.png" title="<%= _("Message pinned")%>" /> | |
41 | - </li> | |
42 | - <% end %> | |
43 | - | |
44 | - </ul> | |
45 | - | |
46 | - </li> | |
47 | - <% end %> | |
48 | - | |
49 | - </ul> | |
50 | - | |
51 | - <% total_mediation_comments = mediation.comments.count %> | |
52 | - | |
53 | - <span class="comment-count"> | |
54 | - <%= link_to( "<span id='mediation-comment-total-#{mediation.id}'>#{total_mediation_comments}</span> " + _("Comments") , '#', | |
55 | - :class => 'display-comment-form', | |
56 | - :id => 'top-post-comment-button', | |
57 | - :onclick => "toogle_mediation_comments(#{mediation.id}); return false;") %> | |
58 | - </span> | |
59 | - | |
60 | - <script type="text/javascript"> | |
61 | - mediations.push( [ <%= mediation.id %>, setInterval(function() { update_mediation_comments('<%= mediation.id %>', false)}, 5000) ] ); | |
62 | - </script> | |
63 | - | |
64 | - <ul id="mediation-comment-list-<%=mediation.id%>" class="mediation-comment-list" style="display:none;"> | |
65 | - <% if mediation.accept_comments? && mediation.comments.count > 0 %> | |
66 | - <%= render :partial => 'community_hub_plugin_public/mediation_comment', :collection => mediation.comments %> | |
67 | - <% end %> | |
68 | - </ul> | |
69 | - | |
70 | - <% if logged_in? && mediation.accept_comments? %> | |
71 | - <div id='mediation-comment-form-<%=mediation.id%>' class='mediation-comment-form' style="display:none;"> | |
72 | - <%= render :partial => 'community_hub_plugin_public/mediation_comment_form', | |
73 | - :locals => { | |
74 | - :hub => hub, | |
75 | - :mediation => mediation, | |
76 | - :comment => Comment.new, | |
77 | - :url => { | |
78 | - :controller => :comment, | |
79 | - :action => :create | |
80 | - }, | |
81 | - :display_link => true, | |
82 | - :cancel_triggers_hide => true | |
83 | - } %> | |
84 | - </div> | |
85 | - <% end %> | |
86 | - | |
87 | -</li> |
plugins/community_hub/views/community_hub_plugin_public/_mediation_comment.html.erb
... | ... | @@ -1,6 +0,0 @@ |
1 | -<li id="<%= mediation_comment.id %>" class="mediation-comment"> | |
2 | - <ul> | |
3 | - <li class="avatar"><%= image_tag(profile_icon(mediation_comment.author, :minor)) %></li> | |
4 | - <li class="message"><span class="author"><%= mediation_comment.author_name %>:</span> <%= mediation_comment.body %></li> | |
5 | - </ul> | |
6 | -</li> | |
7 | 0 | \ No newline at end of file |
plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb
... | ... | @@ -1,12 +0,0 @@ |
1 | -<%= form_for :message, | |
2 | - :method => 'post', | |
3 | - :url => { | |
4 | - :controller => 'community_hub_plugin_public', | |
5 | - :action => 'new_message', | |
6 | - :article_id => mediation.id | |
7 | - } do |f| %> | |
8 | - <%= f.text_area(:body, | |
9 | - :rows => 4, | |
10 | - :placeholder => _('Type your comment here')) %> | |
11 | - <%= submit_button('add', _('Send'), :onclick => "new_mediation_comment(this,#{mediation.id}); return false;") %> | |
12 | -<% end %> |
plugins/community_hub/views/community_hub_plugin_public/_post.html.erb
... | ... | @@ -1,34 +0,0 @@ |
1 | -<% extend CommunityHubPlugin::HubHelper %> | |
2 | - | |
3 | -<li id="<%= post.id %>" class="post"> | |
4 | - <ul> | |
5 | - <li class="time"><%= post_time(post.created_at) %></li> | |
6 | - <li class="avatar"> | |
7 | - <% if post.title == 'hub-message-twitter' %> | |
8 | - <%= image_tag(post.profile_picture, :alt => "Twitter") %> | |
9 | - <% elsif post.title == 'hub-message-facebook' %> | |
10 | - <%= image_tag('/plugins/community_hub/icons/logo_facebook_50x50.png', :alt => "Facebook") %> | |
11 | - <% else %> | |
12 | - <%= image_tag(profile_icon(post.author, :minor)) if post.author %> | |
13 | - <% end %> | |
14 | - </li> | |
15 | - <li class="message"><span class="author"><%= post.author_name %>:</span> <%= post.body %></li> | |
16 | - | |
17 | - <% if mediator?(hub) && post.title != 'hub-message-facebook' %> | |
18 | - <li class="mediation-bar"> | |
19 | - <ul> | |
20 | - <li class="pin"> | |
21 | - <% if !pinned_message?(hub, post.id) %> | |
22 | - <a id="<%= post.id %>" href="#" onclick="pin_message(<%= post.id %>); return false;"> | |
23 | - <img class="not-pinned" src="/plugins/community_hub/icons/hub-pinned-icon.png" title="<%= _("Pin message")%>" /> | |
24 | - </a> | |
25 | - <% else %> | |
26 | - <img class="pinned" src="/plugins/community_hub/icons/hub-not-pinned-icon.png" title="<%= _("Message pinned")%>" /> | |
27 | - <% end %> | |
28 | - </li> | |
29 | - </ul> | |
30 | - </li> | |
31 | - <% end %> | |
32 | - | |
33 | - </ul> | |
34 | -</li> |
plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb
plugins/community_hub/views/content_viewer/hub.html.erb
... | ... | @@ -1,97 +0,0 @@ |
1 | -<% extend CommunityHubPlugin::HubHelper %> | |
2 | - | |
3 | -<div id="<%=@page.id%>" class="hub clearfix"> | |
4 | - | |
5 | - <div class="title"><%= @page.title %> HUB</div> | |
6 | - | |
7 | - <div class="description"><%= @page.body %></div> | |
8 | - | |
9 | - <br /> | |
10 | - | |
11 | - <div id="left-tab" class="live content-tab show"> | |
12 | - | |
13 | - <h1 class="live"> | |
14 | - <span class="on-air"><%= _("Live") %></span> | |
15 | - </h1> | |
16 | - | |
17 | - <h1 class="mediation"> | |
18 | - <span class="title"><%= _("Mediation") %></span> | |
19 | - </h1> | |
20 | - | |
21 | - <div class="envelope"> | |
22 | - <ul id="live-posts"></ul> | |
23 | - </div> | |
24 | - | |
25 | - <span><%= check_box_tag 'auto_scrolling', 'yes', true %><%= _("Auto scrolling") %></span> | |
26 | - | |
27 | - <% if logged_in? %> | |
28 | - <div id="input-panel"> | |
29 | - <div class="form-message"> | |
30 | - | |
31 | - <%= form_for :message, | |
32 | - :method => 'post', | |
33 | - :url => { | |
34 | - :controller => 'community_hub_plugin_public', | |
35 | - :action => 'new_message', | |
36 | - :article_id => @page.id | |
37 | - } do |f| %> | |
38 | - <span><%= _("Message") %>:</span> | |
39 | - <br /> | |
40 | - <%= f.text_area :body, :style => "width: 99%;", :cols => "38", :rows => "5", :placeholder => _("Type your message here") %> | |
41 | - <%= submit_button('add', _('Send'), :onclick => 'new_message(this); return false;') %> | |
42 | - | |
43 | - <% end %> | |
44 | - | |
45 | - </div> | |
46 | - </div> | |
47 | - <% end %> | |
48 | - | |
49 | - </div> | |
50 | - | |
51 | - <div id="right-tab" class="mediation content-tab hide"> | |
52 | - | |
53 | - <h1 class="live"> | |
54 | - <span class="on-air"><%= _("Live") %></span> | |
55 | - </h1> | |
56 | - | |
57 | - <h1 class="mediation"> | |
58 | - <span class="title"><%= _("Mediation") %></span> | |
59 | - </h1> | |
60 | - | |
61 | - <div class="envelope"> | |
62 | - <ul id="mediation-posts"></ul> | |
63 | - </div> | |
64 | - | |
65 | - <% if logged_in? && mediator?(@page) %> | |
66 | - <div class="form-mediation"> | |
67 | - | |
68 | - <%= render :file => 'shared/tiny_mce' %> | |
69 | - | |
70 | - <%= form_for :article, | |
71 | - :method => 'post', | |
72 | - :url => { | |
73 | - :controller => 'community_hub_plugin_public', | |
74 | - :action => 'new_mediation', | |
75 | - :profile_id => profile.id | |
76 | - } do |f| %> | |
77 | - <%= f.hidden_field :parent_id, :value => @page.id %> | |
78 | - <%= f.text_area :body, :style => "width: 100%;", :class => "mceEditor" %> | |
79 | - <%= submit_button('add', _('Send'), :onclick => 'new_mediation(this); return false;') %> | |
80 | - <% end %> | |
81 | - | |
82 | - </div> | |
83 | - | |
84 | - <%= render :partial => "community_hub_plugin_public/settings" %> | |
85 | - | |
86 | - <% end %> | |
87 | - | |
88 | - </div> | |
89 | - | |
90 | -</div> | |
91 | - | |
92 | -<script type="text/javascript"> | |
93 | - DEFAULT_PIN_QUESTION = '<%= _("Are you sure that you want to pin this message?") %>'; | |
94 | - DEFAULT_PROMOTE_QUESTION = '<%= _("Are you sure that you want to promote this user?") %>'; | |
95 | -</script> | |
96 | - | |
97 | -<%= javascript_include_tag '/plugins/community_hub/javascripts/community_hub.js' %> | |
98 | 0 | \ No newline at end of file |
plugins/gamification