Commit 4094e4250516eaf9f32d01dc71ff430828e4b53c

Authored by Larissa Reis
1 parent 597d32c4

profile-suggestions: creates a page that shows all connections

  Links to a page that shows all connections when there are more
  connections than the max shown in the blocks. This way the user can
  see all the connections with a profile.

(ActionItem3234)
app/controllers/my_profile/friends_controller.rb
@@ -31,6 +31,16 @@ class FriendsController < MyProfileController @@ -31,6 +31,16 @@ class FriendsController < MyProfileController
31 end 31 end
32 end 32 end
33 33
  34 + def connections
  35 + @suggestion = profile.profile_suggestions.of_person.enabled.find_by_suggestion_id(params[:id])
  36 + if @suggestion
  37 + @tags = @suggestion.tag_connections
  38 + @profiles = @suggestion.profile_connections
  39 + else
  40 + redirect_to :action => 'suggest'
  41 + end
  42 + end
  43 +
34 protected 44 protected
35 45
36 class << self 46 class << self
app/controllers/my_profile/memberships_controller.rb
@@ -53,6 +53,16 @@ class MembershipsController &lt; MyProfileController @@ -53,6 +53,16 @@ class MembershipsController &lt; MyProfileController
53 end 53 end
54 end 54 end
55 55
  56 + def connections
  57 + @suggestion = profile.profile_suggestions.of_community.enabled.find_by_suggestion_id(params[:id])
  58 + if @suggestion
  59 + @tags = @suggestion.tag_connections
  60 + @profiles = @suggestion.profile_connections
  61 + else
  62 + redirect_to :action => 'suggest'
  63 + end
  64 + end
  65 +
56 protected 66 protected
57 67
58 def per_page 68 def per_page
app/helpers/application_helper.rb
@@ -1422,9 +1422,12 @@ module ApplicationHelper @@ -1422,9 +1422,12 @@ module ApplicationHelper
1422 def profile_suggestion_profile_connections(suggestion) 1422 def profile_suggestion_profile_connections(suggestion)
1423 profiles = suggestion.profile_connections.first(4).map do |profile| 1423 profiles = suggestion.profile_connections.first(4).map do |profile|
1424 link_to(profile_image(profile, :icon), profile.url, :class => 'profile-suggestion-connection-icon') 1424 link_to(profile_image(profile, :icon), profile.url, :class => 'profile-suggestion-connection-icon')
1425 - end.join  
1426 - extra = suggestion.profile_connections.count > 4 ? "<big> +#{suggestion.profile_connections.count - 4}</big>" : ''  
1427 - content_tag(:p, profiles + extra) 1425 + end
  1426 +
  1427 + controller_target = suggestion.suggestion_type == 'Person' ? :friends : :memberships
  1428 + profiles << link_to("<big> +#{suggestion.profile_connections.count - 4}</big>", :controller => controller_target, :action => :connections, :id => suggestion.suggestion_id) if suggestion.profile_connections.count > 4
  1429 +
  1430 + content_tag(:p, profiles.join)
1428 end 1431 end
1429 1432
1430 def profile_suggestion_tag_connections(suggestion) 1433 def profile_suggestion_tag_connections(suggestion)
@@ -1433,7 +1436,10 @@ module ApplicationHelper @@ -1433,7 +1436,10 @@ module ApplicationHelper
1433 end 1436 end
1434 last_tag = tags.pop 1437 last_tag = tags.pop
1435 tags << last_tag.strip.chop if last_tag.present? 1438 tags << last_tag.strip.chop if last_tag.present?
1436 - tags << '...' if suggestion.tag_connections.count > 4 1439 +
  1440 + controller_target = suggestion.suggestion_type == 'Person' ? :friends : :memberships
  1441 + tags << link_to('...', :controller => controller_target, :action => :connections, :id => suggestion.suggestion_id) if suggestion.tag_connections.count > 4
  1442 +
1437 content_tag(:p, tags.join) 1443 content_tag(:p, tags.join)
1438 end 1444 end
1439 end 1445 end
public/stylesheets/application.css
@@ -4095,6 +4095,10 @@ h1#agenda-title { @@ -4095,6 +4095,10 @@ h1#agenda-title {
4095 margin: 0px; 4095 margin: 0px;
4096 } 4096 }
4097 4097
  4098 +.profiles-suggestions .profile-list .extra_info a {
  4099 + text-decoration: none;
  4100 +}
  4101 +
4098 #content .profiles-suggestions .profile-list .extra_info .profile-suggestion-connection-icon { 4102 #content .profiles-suggestions .profile-list .extra_info .profile-suggestion-connection-icon {
4099 position: relative; 4103 position: relative;
4100 } 4104 }
@@ -4114,6 +4118,13 @@ h1#agenda-title { @@ -4114,6 +4118,13 @@ h1#agenda-title {
4114 width: auto; 4118 width: auto;
4115 } 4119 }
4116 4120
  4121 +.list-profile-connections .profile-list li {
  4122 + border: 1px solid transparent;
  4123 + -moz-border-radius: 5px;
  4124 + -webkit-border-radius: 5px;
  4125 +}
  4126 +
  4127 +.list-profile-connections .profile-list li:hover,
4117 .profiles-suggestions .profile-list li:hover { 4128 .profiles-suggestions .profile-list li:hover {
4118 border: 1px solid #ccc; 4129 border: 1px solid #ccc;
4119 background: #eee; 4130 background: #eee;