Changeset 1138

Show
Ignore:
Timestamp:
08/22/07 11:48:07 (1 year ago)
Author:
alban
Message:

fixe la recherche par nom de DocumentsController#search_nonsubscribers? sur User/Group. Refs #2

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/app/controllers/documents_controller.rb

    r1137 r1138  
    131131    id = params[:id] 
    132132     
    133     @people = Document.find(id).nonsubscribers.delete_if do |user
    134       not (user.name.downcase.include?(input) or (not user.username.nil? and user.username.downcase.include?(input))
     133    @people = Document.find(id).nonsubscribers.delete_if do |people
     134      ! people.match_name?(input
    135135    end 
    136136    render :partial => "users/people", :object => @people, :locals => { :empty => "Aucun utilisateur ne correspond", :draggable => true } 
  • trunk/app/models/group.rb

    r1130 r1138  
    1212        User.find(:all, :conditions => ["confirmed = ?", true]) - users 
    1313  end 
     14   
     15  def match_name?(input) 
     16          self.name.downcase.include?(input) 
     17        end 
    1418 
    1519end 
  • trunk/app/models/user.rb

    r1135 r1138  
    131131        end 
    132132         
     133        def match_name?(input) 
     134          (self.name.downcase.include?(input) or (not self.username.nil? and self.username.downcase.include?(input))) 
     135        end 
     136         
    133137        def ==(other) 
    134138    id == other.id