From 06611e5d307b7fbbbd876b8d730e03357f8804f5 Mon Sep 17 00:00:00 2001 From: Daniela Feitosa Date: Mon, 4 Aug 2014 14:20:45 -0300 Subject: [PATCH] [suggestion] Update community suggestions list --- app/controllers/my_profile/memberships_controller.rb | 8 ++++---- app/views/memberships/suggest.html.erb | 22 ++++++---------------- app/views/shared/_profile_suggestions_list.html.erb | 7 +++---- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/app/controllers/my_profile/memberships_controller.rb b/app/controllers/my_profile/memberships_controller.rb index 91190aa..961a26a 100644 --- a/app/controllers/my_profile/memberships_controller.rb +++ b/app/controllers/my_profile/memberships_controller.rb @@ -40,16 +40,16 @@ class MembershipsController < MyProfileController end def suggest - @suggestions = profile.profile_suggestions.of_community.includes(:suggestion).limit(per_page) + @suggestions = profile.profile_suggestions.of_community.enabled.includes(:suggestion).limit(per_page) end def remove_suggestion @community = profile.suggested_communities.find_by_identifier(params[:id]) redirect_to :action => 'suggest' unless @community if @community && request.post? - suggestion = profile.profile_suggestions.find_by_suggestion_id @community.id - suggestion.disable - redirect_to :action => 'suggest' + profile.remove_suggestion(@community) + @suggestions = profile.profile_suggestions.of_community.enabled.includes(:suggestion).limit(per_page) + render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => @suggestions, :collection => :communities_suggestions } end end diff --git a/app/views/memberships/suggest.html.erb b/app/views/memberships/suggest.html.erb index 06aa66e..2c5f0f5 100644 --- a/app/views/memberships/suggest.html.erb +++ b/app/views/memberships/suggest.html.erb @@ -1,19 +1,9 @@ -
-

<%= _("Communities suggestions for %s") % profile.name %>

+

<%= _("Communities suggestions for %s") % profile.name %>

- <% button_bar do %> - <%= button(:back, _('Go to groups list'), :controller => 'memberships') %> - <% end %> +<% button_bar do %> + <%= button(:back, _('Go to groups list'), :controller => 'memberships') %> +<% end %> - <% if @suggestions.empty? %> -

- - <%= _('You have no suggestions yet.') %> - <%= link_to _('Do you want to see communities in this environment?'), :controller => 'search', :action => 'assets', :asset => 'communities' %> - -

- <% else %> - <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => @suggestions, :collection => :communities_suggestions } %> - <% end %> -
+
+ <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => @suggestions, :collection => :friends_suggestions } %>
diff --git a/app/views/shared/_profile_suggestions_list.html.erb b/app/views/shared/_profile_suggestions_list.html.erb index 31b0bdd..c22f671 100644 --- a/app/views/shared/_profile_suggestions_list.html.erb +++ b/app/views/shared/_profile_suggestions_list.html.erb @@ -1,8 +1,7 @@ <% if suggestions.empty? %>

- <%= _('You have no suggestions yet.') %> - <%= link_to _('Do you want to see other people in this environment?'), :controller => 'search', :action => 'assets', :asset => 'people' %> + <%= _('You have no more suggestions :(') %>

<% else %> @@ -32,12 +31,12 @@ <% elsif collection == :communities_suggestions %> <%= button_without_text :add, content_tag('span',_('join')), s.suggestion.join_url, - :class => 'join-community', + :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 }, + :class => 'remove-suggestion', :title => _('Remove suggestion'), - :method => 'post', :confirm => _('Are you sure you want to remove this suggestion?') %> <% end %>
-- libgit2 0.21.2