Commit de452eab71dd38e715efd6304c51f4bb7cdeb499

Authored by Daniela Feitosa
1 parent 52abfab2

[suggestions] Added suggestion list on friends block

(ActionItem3234)
app/views/shared/_profile_suggestions_list.html.erb
@@ -11,7 +11,7 @@ @@ -11,7 +11,7 @@
11 <%= link_to_profile profile_image(s.suggestion, :minor) + '<br/>' + s.suggestion.short_name, 11 <%= link_to_profile profile_image(s.suggestion, :minor) + '<br/>' + s.suggestion.short_name,
12 s.suggestion.identifier, :class => 'profile-link' %> 12 s.suggestion.identifier, :class => 'profile-link' %>
13 <%= button_without_text :help, content_tag('span',_('info about suggestion')), 13 <%= button_without_text :help, content_tag('span',_('info about suggestion')),
14 - { :action => '#' }, 14 + '#',
15 :class => 'explain-suggestion', 15 :class => 'explain-suggestion',
16 :title => _('Why this suggestion?') %> 16 :title => _('Why this suggestion?') %>
17 <div class='extra_info' style='display:none'> 17 <div class='extra_info' style='display:none'>
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 :class => 'add-friend accept-suggestion', 24 :class => 'add-friend accept-suggestion',
25 :title => _('Add friend') %> 25 :title => _('Add friend') %>
26 <%= button_without_text :remove, content_tag('span',_('remove')), 26 <%= button_without_text :remove, content_tag('span',_('remove')),
27 - { :action => 'remove_suggestion', :id => s.suggestion.identifier }, 27 + { :controller => 'friends', :action => 'remove_suggestion', :id => s.suggestion.identifier },
28 :class => 'remove-suggestion', 28 :class => 'remove-suggestion',
29 :title => _('Remove suggestion'), 29 :title => _('Remove suggestion'),
30 :confirm => _('Are you sure you want to remove this suggestion?') %> 30 :confirm => _('Are you sure you want to remove this suggestion?') %>
plugins/people_block/lib/friends_block.rb
@@ -16,10 +16,15 @@ class FriendsBlock &lt; PeopleBlockBase @@ -16,10 +16,15 @@ class FriendsBlock &lt; PeopleBlockBase
16 owner.friends 16 owner.friends
17 end 17 end
18 18
  19 + def suggestions
  20 + owner.profile_suggestions.of_person.enabled.limit(limit).includes(:suggestion)
  21 + end
  22 +
19 def footer 23 def footer
20 profile = self.owner 24 profile = self.owner
  25 + suggestions = self.suggestions
21 proc do 26 proc do
22 - render :file => 'blocks/friends', :locals => { :profile => profile } 27 + render :file => 'blocks/friends', :locals => { :profile => profile, :suggestions => suggestions }
23 end 28 end
24 end 29 end
25 30
plugins/people_block/public/style.css
@@ -102,3 +102,29 @@ @@ -102,3 +102,29 @@
102 #content .members-block .block-footer-content a.view-all { 102 #content .members-block .block-footer-content a.view-all {
103 background: url(/designs/themes/base/imgs/arrow-right-p.png) 100% 50% no-repeat; 103 background: url(/designs/themes/base/imgs/arrow-right-p.png) 100% 50% no-repeat;
104 } 104 }
  105 +
  106 +#content .friends-block .block-footer-content .profiles-suggestions a,
  107 +#content .friends-block .block-footer-content a.more-suggestions {
  108 + position: relative;
  109 +}
  110 +#content .friends-block .block-footer-content .profiles-suggestions a.explain-suggestion {
  111 + position: absolute;
  112 +}
  113 +
  114 +#content .common-profile-list-block .profiles-suggestions .profile-list .extra_info {
  115 + top: 20px;
  116 + left: -69px;
  117 +}
  118 +
  119 +#content .common-profile-list-block .profiles-suggestions .button span {
  120 + display: none;
  121 +}
  122 +#content .common-profile-list-block .profiles-suggestions .controll {
  123 + top: 0px;
  124 + right: 0px;
  125 +}
  126 +#content .common-profile-list-block .profiles-suggestions .controll a,
  127 +#content .friends-block .block-footer-content .profiles-suggestions a.explain-suggestion {
  128 + width: 16px;
  129 + padding: 1px;
  130 +}
plugins/people_block/views/blocks/friends.html.erb
1 <%= link_to s_('friends|View all'), {:profile => profile.identifier, :controller => 'profile', :action => 'friends'}, :class => 'view-all' %> 1 <%= link_to s_('friends|View all'), {:profile => profile.identifier, :controller => 'profile', :action => 'friends'}, :class => 'view-all' %>
  2 +
  3 +<% if user == profile && !suggestions.empty? %>
  4 + <div class='common-profile-list-block'>
  5 + <h4 class='block-subtitle'><%= _('Some suggestions for you') %></h4>
  6 + <div class='profiles-suggestions'>
  7 + <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => suggestions, :collection => :friends_suggestions } %>
  8 + </div>
  9 + <%= link_to _('See more suggestions'), profile.people_suggestions_url, :class => 'more-suggestions' %>
  10 + </div>
  11 +<% end %>
public/designs/themes/base/style.css
@@ -405,13 +405,17 @@ div#notice { @@ -405,13 +405,17 @@ div#notice {
405 } 405 }
406 406
407 407
408 -#content .block-title { 408 +#content .block-title,
  409 +#content .block-subtitle {
409 font-variant: small-caps; 410 font-variant: small-caps;
410 color: #AAA; 411 color: #AAA;
411 font-size: 14px; 412 font-size: 14px;
412 text-align: left; 413 text-align: left;
413 border-bottom: 2px solid #AAA; 414 border-bottom: 2px solid #AAA;
414 } 415 }
  416 +#content .block-subtitle {
  417 + font-size: 13px;
  418 +}
415 419
416 /*************************** Login block *****************************/ 420 /*************************** Login block *****************************/
417 421
public/stylesheets/application.css
@@ -3969,14 +3969,10 @@ h1#agenda-title { @@ -3969,14 +3969,10 @@ h1#agenda-title {
3969 width: 90px; 3969 width: 90px;
3970 max-width: 80px; 3970 max-width: 80px;
3971 } 3971 }
3972 -.profiles-suggestions .profile-list li {  
3973 - width: 76px;  
3974 - max-width: 76px;  
3975 -}  
3976 3972
3977 .controller-favorite_enterprises .profile-list li:hover, 3973 .controller-favorite_enterprises .profile-list li:hover,
3978 .controller-friends .profile-list li:hover, 3974 .controller-friends .profile-list li:hover,
3979 -.profiles-suggestions .profile-list li:hover { 3975 +.box-1 .profiles-suggestions .profile-list li:hover {
3980 border: 2px solid #eeeeec; 3976 border: 2px solid #eeeeec;
3981 } 3977 }
3982 .controller-favorite_enterprises .profile-list img, 3978 .controller-favorite_enterprises .profile-list img,
@@ -3999,7 +3995,7 @@ h1#agenda-title { @@ -3999,7 +3995,7 @@ h1#agenda-title {
3999 } 3995 }
4000 .controller-favorite_enterprises .profile-list .profile_link span, 3996 .controller-favorite_enterprises .profile-list .profile_link span,
4001 .controller-friends .profile-list .profile_link span, 3997 .controller-friends .profile-list .profile_link span,
4002 -.profiles-suggestions .profile-list .profile_link span { 3998 +.box-1 .profiles-suggestions .profile-list .profile_link span {
4003 width: 80px; 3999 width: 80px;
4004 display: block; 4000 display: block;
4005 overflow: hidden; 4001 overflow: hidden;
@@ -4066,6 +4062,18 @@ h1#agenda-title { @@ -4066,6 +4062,18 @@ h1#agenda-title {
4066 display: block; 4062 display: block;
4067 line-height: 20px; 4063 line-height: 20px;
4068 padding: 0 0 0 25px; 4064 padding: 0 0 0 25px;
  4065 + width: auto;
  4066 +}
  4067 +
  4068 +.profiles-suggestions .profile-list li {
  4069 + width: 58px;
  4070 + max-width: 58px;
  4071 +}
  4072 +
  4073 +.box-1 .profiles-suggestions .profile-list li {
  4074 + width: 76px;
  4075 + max-width: 76px;
  4076 + border: 2px solid transparent;
4069 } 4077 }
4070 4078
4071 /* ==> public/stylesheets/controller_friends.css <== */ 4079 /* ==> public/stylesheets/controller_friends.css <== */