Commit 06611e5d307b7fbbbd876b8d730e03357f8804f5
1 parent
43c12900
Exists in
master
and in
27 other branches
[suggestion] Update community suggestions list
After asking to be member removing suggestion, the list is updated (ActionItem3234)
Showing
3 changed files
with
13 additions
and
24 deletions
Show diff stats
app/controllers/my_profile/memberships_controller.rb
| @@ -40,16 +40,16 @@ class MembershipsController < MyProfileController | @@ -40,16 +40,16 @@ class MembershipsController < MyProfileController | ||
| 40 | end | 40 | end |
| 41 | 41 | ||
| 42 | def suggest | 42 | def suggest |
| 43 | - @suggestions = profile.profile_suggestions.of_community.includes(:suggestion).limit(per_page) | 43 | + @suggestions = profile.profile_suggestions.of_community.enabled.includes(:suggestion).limit(per_page) |
| 44 | end | 44 | end |
| 45 | 45 | ||
| 46 | def remove_suggestion | 46 | def remove_suggestion |
| 47 | @community = profile.suggested_communities.find_by_identifier(params[:id]) | 47 | @community = profile.suggested_communities.find_by_identifier(params[:id]) |
| 48 | redirect_to :action => 'suggest' unless @community | 48 | redirect_to :action => 'suggest' unless @community |
| 49 | if @community && request.post? | 49 | if @community && request.post? |
| 50 | - suggestion = profile.profile_suggestions.find_by_suggestion_id @community.id | ||
| 51 | - suggestion.disable | ||
| 52 | - redirect_to :action => 'suggest' | 50 | + profile.remove_suggestion(@community) |
| 51 | + @suggestions = profile.profile_suggestions.of_community.enabled.includes(:suggestion).limit(per_page) | ||
| 52 | + render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => @suggestions, :collection => :communities_suggestions } | ||
| 53 | end | 53 | end |
| 54 | end | 54 | end |
| 55 | 55 |
app/views/memberships/suggest.html.erb
| 1 | -<div class='profiles-suggestions'> | ||
| 2 | - <h1><%= _("Communities suggestions for %s") % profile.name %></h1> | 1 | +<h1><%= _("Communities suggestions for %s") % profile.name %></h1> |
| 3 | 2 | ||
| 4 | - <% button_bar do %> | ||
| 5 | - <%= button(:back, _('Go to groups list'), :controller => 'memberships') %> | ||
| 6 | - <% end %> | 3 | +<% button_bar do %> |
| 4 | + <%= button(:back, _('Go to groups list'), :controller => 'memberships') %> | ||
| 5 | +<% end %> | ||
| 7 | 6 | ||
| 8 | - <% if @suggestions.empty? %> | ||
| 9 | - <p> | ||
| 10 | - <em> | ||
| 11 | - <%= _('You have no suggestions yet.') %> | ||
| 12 | - <%= link_to _('Do you want to see communities in this environment?'), :controller => 'search', :action => 'assets', :asset => 'communities' %> | ||
| 13 | - </em> | ||
| 14 | - </p> | ||
| 15 | - <% else %> | ||
| 16 | - <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => @suggestions, :collection => :communities_suggestions } %> | ||
| 17 | - <% end %> | ||
| 18 | - <br style="clear:both" /> | 7 | +<div class="profiles-suggestions"> |
| 8 | + <%= render :partial => 'shared/profile_suggestions_list', :locals => { :suggestions => @suggestions, :collection => :friends_suggestions } %> | ||
| 19 | </div> | 9 | </div> |
app/views/shared/_profile_suggestions_list.html.erb
| 1 | <% if suggestions.empty? %> | 1 | <% if suggestions.empty? %> |
| 2 | <p> | 2 | <p> |
| 3 | <em> | 3 | <em> |
| 4 | - <%= _('You have no suggestions yet.') %> | ||
| 5 | - <%= link_to _('Do you want to see other people in this environment?'), :controller => 'search', :action => 'assets', :asset => 'people' %> | 4 | + <%= _('You have no more suggestions :(') %> |
| 6 | </em> | 5 | </em> |
| 7 | </p> | 6 | </p> |
| 8 | <% else %> | 7 | <% else %> |
| @@ -32,12 +31,12 @@ | @@ -32,12 +31,12 @@ | ||
| 32 | <% elsif collection == :communities_suggestions %> | 31 | <% elsif collection == :communities_suggestions %> |
| 33 | <%= button_without_text :add, content_tag('span',_('join')), | 32 | <%= button_without_text :add, content_tag('span',_('join')), |
| 34 | s.suggestion.join_url, | 33 | s.suggestion.join_url, |
| 35 | - :class => 'join-community', | 34 | + :class => 'join-community accept-suggestion', |
| 36 | :title => _("Join %s") % s.suggestion.name %> | 35 | :title => _("Join %s") % s.suggestion.name %> |
| 37 | <%= button_without_text :remove, content_tag('span',_('remove')), | 36 | <%= button_without_text :remove, content_tag('span',_('remove')), |
| 38 | { :action => 'remove_suggestion', :id => s.suggestion.identifier }, | 37 | { :action => 'remove_suggestion', :id => s.suggestion.identifier }, |
| 38 | + :class => 'remove-suggestion', | ||
| 39 | :title => _('Remove suggestion'), | 39 | :title => _('Remove suggestion'), |
| 40 | - :method => 'post', | ||
| 41 | :confirm => _('Are you sure you want to remove this suggestion?') %> | 40 | :confirm => _('Are you sure you want to remove this suggestion?') %> |
| 42 | <% end %> | 41 | <% end %> |
| 43 | </div><!-- end class="controll" --> | 42 | </div><!-- end class="controll" --> |