Project

General

Profile

Patch #4964 ยป 0001-Changed-sorting-of-users-global.patch

Aaron Fischer, 2010-03-02 14:27

View differences:

app/models/group.rb
28 28
  def to_s
29 29
    lastname.to_s
30 30
  end
31

  
32
  def name(formatter = nil)
33
    self.to_s
34
  end
31 35
  
32 36
  def user_added(user)
33 37
    members.each do |member|
app/models/member.rb
27 27

  
28 28
  after_destroy :unwatch_from_permission_change
29 29
  
30
  def name
31
    self.user.name
30
  def name(formatter = nil)
31
    self.user.name(formatter)
32 32
  end
33 33
  
34 34
  alias :base_role_ids= :role_ids=
app/models/principal.rb
35 35
  before_create :set_default_empty_values
36 36
  
37 37
  def <=>(principal)
38
    if self.class.name == principal.class.name
39
      self.to_s.downcase <=> principal.to_s.downcase
40
    else
41
      # groups after users
42
      principal.class.name <=> self.class.name
38
    unless self.class.name == principal.class.name
39
      return self.class.name <=> principal.class.name
43 40
    end
41

  
42
    a = (self.methods.include? "name")? self.name(:lastname_firstname) : self.to_s.downcase
43
    b = (principal.methods.include? "name")? principal.name(:lastname_firstname) : principal.to_s.downcase
44
    return a <=> b
45
  end
46

  
47
  def name(formatter = nil)
48
    self.user.name(formatter)
44 49
  end
45 50
  
46 51
  protected
app/views/projects/settings/_members.rhtml
51 51
</div>
52 52

  
53 53

  
54
<% principals = Principal.active.find(:all, :limit => 100, :order => 'type, login, lastname ASC') - @project.principals %>
54
<% principals = (Principal.active.find(:all) - @project.principals).sort %>
55 55

  
56 56
<div class="splitcontentright">
57 57
<% if roles.any? && principals.any? %>
    (1-1/1)