Commit 97584541 authored by jplang's avatar jplang

Sort user memberships by project.

git-svn-id: https://svn.redmine.org/redmine/trunk@16150 e93f8b46-1217-0410-a6f0-8f06a7374b81
parent 5c4bf7c3
......@@ -37,6 +37,10 @@ class Member < ActiveRecord::Base
reorder("#{Role.table_name}.position").
order(Principal.fields_for_order_statement)
}
scope :sorted_by_project, lambda {
includes(:project).
reorder("#{Project.table_name}.lft")
}
alias :base_reload :reload
def reload(*args)
......
<% memberships = principal.memberships.preload(:member_roles => :role).sorted_by_project.to_a %>
<p><%= link_to l(:label_add_projects), new_principal_membership_path(principal), :remote => true, :class => "icon icon-add" %></p>
<% if principal.memberships.any? %>
<% if memberships.any? %>
<table class="list memberships">
<thead><tr>
<th><%= l(:label_project) %></th>
......@@ -9,7 +11,7 @@
<%= call_table_header_hook principal %>
</tr></thead>
<tbody>
<% principal.memberships.preload(:member_roles => :role).each do |membership| %>
<% memberships.each do |membership| %>
<% next if membership.new_record? %>
<tr id="member-<%= membership.id %>" class="<%= cycle 'odd', 'even' %> class">
<td class="project name">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment