diff --git a/app/models/communities_block.rb b/app/models/communities_block.rb
index b5257b1..8cd5b8c 100644
--- a/app/models/communities_block.rb
+++ b/app/models/communities_block.rb
@@ -14,19 +14,16 @@ class CommunitiesBlock < ProfileListBlock
_('This block displays the communities in which the user is a member.')
end
+ def suggestions
+ return nil unless owner.kind_of?(Profile)
+ owner.profile_suggestions.of_community.enabled.limit(limit).includes(:suggestion)
+ end
+
def footer
owner = self.owner
- case owner
- when Profile
- lambda do |context|
- link_to s_('communities|View all'), :profile => owner.identifier, :controller => 'profile', :action => 'communities'
- end
- when Environment
- lambda do |context|
- link_to s_('communities|View all'), :controller => 'search', :action => 'communities'
- end
- else
- ''
+ suggestions = self.suggestions
+ proc do
+ render :file => 'blocks/communities', :locals => { :owner => owner, :suggestions => suggestions }
end
end
diff --git a/app/views/blocks/communities.html.erb b/app/views/blocks/communities.html.erb
new file mode 100644
index 0000000..e48bc50
--- /dev/null
+++ b/app/views/blocks/communities.html.erb
@@ -0,0 +1,17 @@
+<% if owner.kind_of?(Profile) %>
+ <%= link_to s_('communities|View all'), {:profile => owner.identifier, :controller => 'profile', :action => 'communities'}, :class => 'view-all' %>
+<% elsif owner.kind_of?(Environment) %>
+ <%= link_to s_('communities|View all'), {:controller => 'search', :action => 'communities'}, :class => 'view-all' %>
+<% else %>
+ ''
+<% end %>
+
+<% if user == profile && suggestions && !suggestions.empty? %>
+
+
<%= _('Some suggestions for you') %>
+
+ <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => suggestions, :collection => :communities_suggestions } %>
+
+ <%= link_to _('See more suggestions'), profile.communities_suggestions_url, :class => 'more-suggestions' %>
+
+<% end %>
diff --git a/app/views/memberships/suggest.html.erb b/app/views/memberships/suggest.html.erb
index 2c5f0f5..6bcc0bd 100644
--- a/app/views/memberships/suggest.html.erb
+++ b/app/views/memberships/suggest.html.erb
@@ -5,5 +5,5 @@
<% end %>
- <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => @suggestions, :collection => :friends_suggestions } %>
+ <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => @suggestions, :collection => :communities_suggestions } %>
diff --git a/app/views/shared/_profile_suggestions_list.html.erb b/app/views/shared/_profile_suggestions_list.html.erb
index d34d4db..5530c17 100644
--- a/app/views/shared/_profile_suggestions_list.html.erb
+++ b/app/views/shared/_profile_suggestions_list.html.erb
@@ -34,7 +34,7 @@
:class => 'join-community accept-suggestion',
:title => _("Join %s") % s.suggestion.name %>
<%= button_without_text :remove, content_tag('span',_('remove')),
- { :action => 'remove_suggestion', :id => s.suggestion.identifier },
+ { :controller => 'memberships', :action => 'remove_suggestion', :id => s.suggestion.identifier },
:class => 'remove-suggestion',
:title => _('Remove suggestion'),
:confirm => _('Are you sure you want to remove this suggestion?') %>
diff --git a/app/views/user_mailer/profiles_suggestions_email.html.erb b/app/views/user_mailer/profiles_suggestions_email.html.erb
index 7c8486c..7b5323b 100644
--- a/app/views/user_mailer/profiles_suggestions_email.html.erb
+++ b/app/views/user_mailer/profiles_suggestions_email.html.erb
@@ -1,6 +1,6 @@
<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>
-<%= _('We want to give you some suggestions to grow up your network.') %>
+
<%= _('We want to give you some suggestions to grow up your network.') %>
<%= _('Check it out!') %>
<% unless @people_suggestions.empty? %>
diff --git a/plugins/people_block/views/blocks/friends.html.erb b/plugins/people_block/views/blocks/friends.html.erb
index 1cc41ac..6278915 100644
--- a/plugins/people_block/views/blocks/friends.html.erb
+++ b/plugins/people_block/views/blocks/friends.html.erb
@@ -1,7 +1,7 @@
<%= link_to s_('friends|View all'), {:profile => profile.identifier, :controller => 'profile', :action => 'friends'}, :class => 'view-all' %>
<% if user == profile && !suggestions.empty? %>
-
+
<%= _('Some suggestions for you') %>
<%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => suggestions, :collection => :friends_suggestions } %>
diff --git a/public/designs/themes/base/style.css b/public/designs/themes/base/style.css
index deff3f3..18b95bb 100644
--- a/public/designs/themes/base/style.css
+++ b/public/designs/themes/base/style.css
@@ -515,7 +515,7 @@ div#notice {
#content .tags-block .block-footer-content a,
#content .profile-list-block .block-footer-content a,
#content .enterprises-block .block-footer-content a,
-#content .communities-block .block-footer-content a {
+#content .communities-block .block-footer-content a.view-all {
background: url(imgs/arrow-right-p.png) 100% 50% no-repeat;
}
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index db437d8..296e593 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -1060,6 +1060,13 @@ jQuery('.profiles-suggestions .explain-suggestion').live('click', function() {
return false;
});
+jQuery('.suggestions-block .block-subtitle').live('click', function() {
+ var clicked = jQuery(this);
+ clicked.next('.profiles-suggestions').toggle();
+ clicked.nextAll('.more-suggestions').toggle();
+ return false;
+});
+
jQuery(document).ready(function(){
showHideTermsOfUse();
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index 379c59f..94d8b4c 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -1667,6 +1667,30 @@ a.button.disabled, input.disabled {
text-align: center;
padding-bottom: 0px;
}
+
+#content .communities-block .block-footer-content .profiles-suggestions a.explain-suggestion {
+ padding: 1px;
+ width: 16px;
+}
+
+#content .communities-block .block-footer-content .profiles-suggestions a.accept-suggestion,
+#content .communities-block .block-footer-content .profiles-suggestions a.remove-suggestion {
+ position: relative;
+ z-index: 5;
+}
+
+#content .communities-block .profiles-suggestions .profile-list .extra_info {
+ z-index: 10;
+}
+
+#content .communities-block .block-footer-content a.more-suggestions {
+ position: relative;
+}
+
+.suggestions-block .block-subtitle {
+ cursor: pointer;
+}
+
.msie7 .communities-block .common-profile-list-block .vcard .profile_link {
height: 75px;
padding-bottom: 0px;
@@ -4066,8 +4090,8 @@ h1#agenda-title {
}
.profiles-suggestions .profile-list li {
- width: 58px;
- max-width: 58px;
+ width: 85px;
+ max-width: 85px;
}
.box-1 .profiles-suggestions .profile-list li {
--
libgit2 0.21.2