Commit f15193c360fd93acabfe9bb5d1c34ee6d18f0ccb
Exists in
master
and in
22 other branches
Merge branch 'ActionItem2909-SortUsersAlphabetically' of https://gitlab.com/unb-…
…gama/noosfero into ActionItem2909-SortUsersAlphabetically
Showing
5 changed files
with
31 additions
and
3 deletions
Show diff stats
app/controllers/my_profile/profile_members_controller.rb
app/controllers/public/profile_controller.rb
... | ... | @@ -67,7 +67,7 @@ class ProfileController < PublicController |
67 | 67 | |
68 | 68 | def members |
69 | 69 | if is_cache_expired?(profile.members_cache_key(params)) |
70 | - @members = profile.members.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage]) | |
70 | + @members = profile.members_by_name.includes(relations_to_include).paginate(:per_page => members_per_page, :page => params[:npage]) | |
71 | 71 | end |
72 | 72 | end |
73 | 73 | ... | ... |
app/models/profile.rb
app/views/profile_members/_members_list.rhtml
1 | -<% collection = @collection == :profile_admins ? profile.admins : profile.members %> | |
1 | +<% collection = @collection == :profile_admins ? profile.admins : profile.members_by_name %> | |
2 | 2 | <% title = @title ? @title : _('Current members') %> |
3 | 3 | <% remove_action = @remove_action ? @remove_action : {:action => 'unassociate'} %> |
4 | 4 | ... | ... |
test/unit/profile_test.rb
... | ... | @@ -1692,6 +1692,30 @@ class ProfileTest < ActiveSupport::TestCase |
1692 | 1692 | assert_equal 1, community.members_count |
1693 | 1693 | end |
1694 | 1694 | |
1695 | + should 'order members by name alphabetically considering special characters' do | |
1696 | + community = fast_create(Community) | |
1697 | + | |
1698 | + community.add_member(create_user('José').person) | |
1699 | + community.add_member(create_user('João').person) | |
1700 | + community.add_member(create_user('Mariana').person) | |
1701 | + members = community.members_by_name | |
1702 | + | |
1703 | + assert_equal "João", members.first.name | |
1704 | + assert_equal "Mariana", members.last.name | |
1705 | + end | |
1706 | + | |
1707 | + should 'order members by name alphabetically considering upper and lower cases' do | |
1708 | + community = fast_create(Community) | |
1709 | + | |
1710 | + community.add_member(create_user('mariana').person) | |
1711 | + community.add_member(create_user('João').person) | |
1712 | + community.add_member(create_user('guest').person) | |
1713 | + members = community.members_by_name | |
1714 | + | |
1715 | + assert_equal "guest", members.first.name | |
1716 | + assert_equal "mariana", members.last.name | |
1717 | + end | |
1718 | + | |
1695 | 1719 | should 'know if url is the profile homepage' do |
1696 | 1720 | profile = fast_create(Profile) |
1697 | 1721 | ... | ... |