##// END OF EJS Templates
Upgraded to Rails 2.3.4 (#3597)...
Upgraded to Rails 2.3.4 (#3597) * Ran the Rails upgrade * Upgraded to Rails Engines 2.3.2 * Added a plugin to let Engines override application views. * Converted tests to use the new classes: ** ActionController::TestCase for functional ** ActiveSupport::TestCase for units * Converted ActiveRecord::Error message to a string. * ActiveRecord grouping returns an ordered hash which doesn't have #sort! * Updated the I18n storage_units format. * Added some default initializers from a fresh rails app * Changed the order of check_box_tags and hidden_field_tags. The hidden tag needs to appear first in Rails 2.3, otherwise it will override any value in the check_box_tag. * Removed the custom handler for when the cookie store is tampered with. Rails 2.3 removed the TamperedWithCookie exception and instead Rails will not load the data from it when it's been tampered with (e.g. no user login). * Fixed mail layouts, 2.3 has problems with implicit multipart emails that use layouts. Also removed some custom Redmine mailer code. * Fixed a bug that occurred in tests where the "required" span tag would be added to the :field_status translation. This resulted in an email string of: <li>Status<span class="required"> *</span><span class="required"> *</span> Instead of: <li>Status: New</li> git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2887 e93f8b46-1217-0410-a6f0-8f06a7374b81

File last commit:

r2755:770745714544
r2773:7b0cb6aba871
Show More
member.rb
66 lines | 2.2 KiB | text/x-ruby | RubyLexer
Jean-Philippe Lang
Allows multiple roles on the same project (#706). Prerequisite for user groups feature....
r2627 # Redmine - project management software
# Copyright (C) 2006-2009 Jean-Philippe Lang
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 #
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Member < ActiveRecord::Base
belongs_to :user
Jean-Philippe Lang
User groups branch merged....
r2755 belongs_to :principal, :foreign_key => 'user_id'
has_many :member_roles, :dependent => :destroy
Jean-Philippe Lang
Allows multiple roles on the same project (#706). Prerequisite for user groups feature....
r2627 has_many :roles, :through => :member_roles
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 belongs_to :project
Jean-Philippe Lang
User groups branch merged....
r2755 validates_presence_of :principal, :project
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 validates_uniqueness_of :user_id, :scope => :project_id
Jean-Philippe Lang
Merged 0.6 branch into trunk....
r663
Jean-Philippe Lang
added svn:eol-style native property on /app files...
r330 def name
Jean-Philippe Lang
Removed User#display_name (replaced by User#name)....
r575 self.user.name
Jean-Philippe Lang
Localization plugin removed (replaced with GLoc)...
r12 end
Jean-Philippe Lang
Each category can now be associated to a user, so that new issues in that category are automatically assigned to that user....
r574
Jean-Philippe Lang
User groups branch merged....
r2755 alias :base_role_ids= :role_ids=
def role_ids=(arg)
ids = (arg || []).collect(&:to_i) - [0]
# Keep inherited roles
ids += member_roles.select {|mr| !mr.inherited_from.nil?}.collect(&:role_id)
new_role_ids = ids - role_ids
# Add new roles
new_role_ids.each {|id| member_roles << MemberRole.new(:role_id => id) }
# Remove roles (Rails' #role_ids= will not trigger MemberRole#on_destroy)
member_roles.select {|mr| !ids.include?(mr.role_id)}.each(&:destroy)
Jean-Philippe Lang
Adds a user search field with autocompleter on project members screen....
r2549 end
Jean-Philippe Lang
User display format is now configurable in administration settings....
r1089 def <=>(member)
Jean-Philippe Lang
Allows multiple roles on the same project (#706). Prerequisite for user groups feature....
r2627 a, b = roles.sort.first, member.roles.sort.first
Jean-Philippe Lang
User groups branch merged....
r2755 a == b ? (principal <=> member.principal) : (a <=> b)
end
def deletable?
member_roles.detect {|mr| mr.inherited_from}.nil?
Jean-Philippe Lang
User display format is now configurable in administration settings....
r1089 end
Jean-Philippe Lang
Each category can now be associated to a user, so that new issues in that category are automatically assigned to that user....
r574 def before_destroy
Jean-Philippe Lang
User groups branch merged....
r2755 if user
# remove category based auto assignments for this member
IssueCategory.update_all "assigned_to_id = NULL", ["project_id = ? AND assigned_to_id = ?", project.id, user.id]
end
Jean-Philippe Lang
Each category can now be associated to a user, so that new issues in that category are automatically assigned to that user....
r574 end
Jean-Philippe Lang
Allows multiple roles on the same project (#706). Prerequisite for user groups feature....
r2627
protected
def validate
Jean-Philippe Lang
User groups branch merged....
r2755 errors.add_to_base "Role can't be blank" if member_roles.empty? && roles.empty?
Jean-Philippe Lang
Allows multiple roles on the same project (#706). Prerequisite for user groups feature....
r2627 end
Jean-Philippe Lang
Initial commit...
r2 end