Commit 7ebc63886347583ccf0eaedd1cb5d21dd7219a78
1 parent
e58ae17f
Exists in
theme-brasil-digital-from-staging
and in
9 other branches
#community dashboard - allow pinning of messages from twitter / facebook
Showing
3 changed files
with
36 additions
and
5 deletions
Show diff stats
plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb
... | ... | @@ -169,18 +169,36 @@ class CommunityHubPluginPublicController < PublicController |
169 | 169 | rescue |
170 | 170 | message = nil |
171 | 171 | end |
172 | + | |
172 | 173 | if message |
173 | 174 | mediation = TinyMceArticle.new |
174 | 175 | mediation.profile = hub.profile |
175 | 176 | mediation.parent = hub |
176 | - mediation.last_changed_by = message.author | |
177 | - mediation.created_by_id = message.author.id | |
177 | + | |
178 | + author = message.author.blank? ? user : message.author | |
179 | + | |
180 | + mediation.last_changed_by = author | |
181 | + mediation.created_by_id = author.id | |
182 | + | |
178 | 183 | mediation.name = mediation_timestamp |
179 | 184 | mediation.body = message.body |
180 | 185 | mediation.notify_comments = false |
181 | 186 | mediation.type = 'TinyMceArticle' |
182 | 187 | mediation.advertise = false |
188 | + mediation.source = 'local' | |
189 | + | |
183 | 190 | if mediation.save |
191 | + | |
192 | + if ( message.title == 'hub-message-twitter' ) | |
193 | + mediation.source = 'twitter' | |
194 | + mediation.author_name = message.name | |
195 | + elsif ( message.title == 'hub-message-facebook' ) | |
196 | + mediation.source = 'facebook' | |
197 | + mediation.author_name = message.name | |
198 | + end | |
199 | + | |
200 | + mediation.save | |
201 | + | |
184 | 202 | hub.pinned_messages += [message.id] unless hub.pinned_messages.include?(message.id) |
185 | 203 | hub.pinned_mediations += [mediation.id] unless hub.pinned_mediations.include?(mediation.id) |
186 | 204 | if hub.save | ... | ... |
plugins/community_hub/views/community_hub_plugin_public/_mediation.rhtml
... | ... | @@ -4,14 +4,25 @@ |
4 | 4 | |
5 | 5 | <ul> |
6 | 6 | <li class="time"><%= post_time(mediation.created_at) %></li> |
7 | - <li class="avatar"><%= image_tag(profile_icon(mediation.author, :minor)) %></li> | |
8 | - <li class="message"><span class="author"><%= mediation.author_name %>:</span> <%= mediation.body %></li> | |
7 | + | |
8 | + <li class="avatar"> | |
9 | + <% if mediation.source == 'twitter' %> | |
10 | + <%= image_tag('/plugins/community_hub/icons/logo_twitter_bird_white_50x50.png', :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.author, :minor)) if mediation.author %> | |
15 | + <% end %> | |
16 | + </li> | |
17 | + <li class="message"><span class="author"><%= mediation.setting[:author_name] %>:</span> <%= mediation.body %></li> | |
9 | 18 | |
10 | 19 | <% if mediator?(hub) %> |
11 | 20 | <li class="mediation-bar"> |
12 | 21 | |
13 | 22 | <ul> |
14 | 23 | |
24 | + <% if mediation.source != 'twitter' && mediation.source != 'facebook' %> | |
25 | + | |
15 | 26 | <li class="promote"> |
16 | 27 | <% if !promoted?(hub, mediation.author.id) %> |
17 | 28 | <a id="<%= mediation.id %>" href="#" onclick="promote_user(<%= mediation.id %>,<%= mediation.author.id %>); return false;"> |
... | ... | @@ -22,6 +33,8 @@ |
22 | 33 | <% end %> |
23 | 34 | </li> |
24 | 35 | |
36 | + <% end %> | |
37 | + | |
25 | 38 | <% if pinned_mediation?(hub, mediation.id) %> |
26 | 39 | <li class="pin"> |
27 | 40 | <img class="pinned" src="/plugins/community_hub/icons/hub-not-pinned-icon.png" title="<%= _("Message pinned")%>" /> | ... | ... |
plugins/community_hub/views/community_hub_plugin_public/_post.rhtml
... | ... | @@ -14,7 +14,7 @@ |
14 | 14 | </li> |
15 | 15 | <li class="message"><span class="author"><%= post.author_name %>:</span> <%= post.body %></li> |
16 | 16 | |
17 | - <% if mediator?(hub) && post.title != 'hub-message-twitter' && post.title != 'hub-message-facebook' %> | |
17 | + <% if mediator?(hub) %> | |
18 | 18 | <li class="mediation-bar"> |
19 | 19 | <ul> |
20 | 20 | <li class="pin"> | ... | ... |