default_assignee.patch

Raffaello Pelagalli, 2010-06-24 18:21

Download (2.88 KB)

View differences:

app/models/issue.rb (working copy)
741 741
    if assigned_to.nil? && category && category.assigned_to
742 742
      self.assigned_to = category.assigned_to
743 743
    end
744
    if assigned_to.nil? && project.default_assignee
745
      self.assigned_to = project.default_assignee
746
    end
744 747
  end
745 748

  
746 749
  # Updates start/due dates of following issues
app/models/user.rb (working copy)
37 37
                                   :after_remove => Proc.new {|user, group| group.user_removed(user)}
38 38
  has_many :issue_categories, :foreign_key => 'assigned_to_id', :dependent => :nullify
39 39
  has_many :changesets, :dependent => :nullify
40
  has_many :projects, :foreign_key => 'default_assignee_id', :dependent => :nullify
40 41
  has_one :preference, :dependent => :destroy, :class_name => 'UserPreference'
41 42
  has_one :rss_token, :dependent => :destroy, :class_name => 'Token', :conditions => "action='feeds'"
42 43
  has_one :api_token, :dependent => :destroy, :class_name => 'Token', :conditions => "action='api'"
app/models/project.rb (working copy)
44 44
  has_one :repository, :dependent => :destroy
45 45
  has_many :changesets, :through => :repository
46 46
  has_one :wiki, :dependent => :destroy
47
  belongs_to :default_assignee, :class_name => 'User', :foreign_key => 'default_assignee_id'
48

  
47 49
  # Custom field for the project issues
48 50
  has_and_belongs_to_many :issue_custom_fields, 
49 51
                          :class_name => 'IssueCustomField',
app/views/projects/_form.rhtml (working copy)
15 15
<% end %></p>
16 16
<p><%= f.text_field :homepage, :size => 60 %></p>
17 17
<p><%= f.check_box :is_public %></p>
18
<p><%= f.select(:default_assignee_id, @project.assignable_users.collect {|u| [ u.name , u.id ] }, { :include_blank => true }) %>
18 19
<%= wikitoolbar_for 'project_description' %>
19 20

  
20 21
<% @project.custom_field_values.each do |value| %>
db/migrate/20100624104845_add_project_default_assignee.rb (revision 0)
1
class AddProjectDefaultAssignee < ActiveRecord::Migration
2
  def self.up
3
    add_column :projects, :default_assignee_id, :integer
4
  end
5

  
6
  def self.down
7
    remove_column :projects, :default_assignee_id, :integer
8
  end
9
end