Index: app/helpers/application_helper.rb =================================================================== --- app/helpers/application_helper.rb (revision 12823) +++ app/helpers/application_helper.rb (working copy) @@ -324,11 +324,15 @@ end # Returns a string for users/groups option tags - def principals_options_for_select(collection, selected=nil) + def principals_options_for_select(collection, selected=nil, previous=nil) s = '' if collection.include?(User.current) s << content_tag('option', "<< #{l(:label_me)} >>", :value => User.current.id) end + if previous!=nil && collection.include?(User.find_by_id(previous)) + p = User.find_by_id(previous) + s << content_tag('option', "<< #{l(:label_previous)}: #{h p.name} >>", :value => p.id) + end groups = '' collection.sort.each do |element| selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id.to_s == selected Index: app/helpers/issues_helper.rb =================================================================== --- app/helpers/issues_helper.rb (revision 12823) +++ app/helpers/issues_helper.rb (working copy) @@ -260,30 +260,32 @@ strings = [] values_by_field = {} details.each do |detail| - if detail.property == 'cf' - field = detail.custom_field - if field && field.multiple? - values_by_field[field] ||= {:added => [], :deleted => []} - if detail.old_value - values_by_field[field][:deleted] << detail.old_value - end - if detail.value - values_by_field[field][:added] << detail.value - end - next - end + unless detail.prop_key == "previous_assigned_to_id" + if detail.property == 'cf' + field = detail.custom_field + if field && field.multiple? + values_by_field[field] ||= {:added => [], :deleted => []} + if detail.old_value + values_by_field[field][:deleted] << detail.old_value + end + if detail.value + values_by_field[field][:added] << detail.value + end + next + end + end + strings << show_detail(detail, no_html, options) + end end - strings << show_detail(detail, no_html, options) - end values_by_field.each do |field, changes| detail = JournalDetail.new(:property => 'cf', :prop_key => field.id.to_s) detail.instance_variable_set "@custom_field", field - if changes[:added].any? - detail.value = changes[:added] - strings << show_detail(detail, no_html, options) - elsif changes[:deleted].any? - detail.old_value = changes[:deleted] - strings << show_detail(detail, no_html, options) + if changes[:added].any? + detail.value = changes[:added] + strings << show_detail(detail, no_html, options) + elsif changes[:deleted].any? + detail.old_value = changes[:deleted] + strings << show_detail(detail, no_html, options) end end strings Index: app/models/issue.rb =================================================================== --- app/models/issue.rb (revision 12823) +++ app/models/issue.rb (working copy) @@ -93,7 +93,7 @@ before_create :default_assign before_save :close_duplicates, :update_done_ratio_from_issue_status, - :force_updated_on_change, :update_closed_on, :set_assigned_to_was + :force_updated_on_change, :update_closed_on, :set_assigned_to_was, :update_previous_assignee after_save {|issue| issue.send :after_project_change if !issue.id_changed? && issue.project_id_changed?} after_save :reschedule_following_issues, :update_nested_set_attributes, :update_parent_attributes, :create_journal @@ -1459,6 +1459,15 @@ end end + + def update_previous_assignee + if assigned_to_id? + #self.previous_assigned_to = User.find_by_id(assigned_to_id_was) + self.previous_assigned_to_id = assigned_to_id_was + end + end + + # Saves the changes in a Journal # Called after_save def create_journal Index: app/views/issues/_attributes.html.erb =================================================================== --- app/views/issues/_attributes.html.erb (revision 12823) +++ app/views/issues/_attributes.html.erb (working copy) @@ -15,7 +15,7 @@ <% end %> <% if @issue.safe_attribute? 'assigned_to_id' %> -

<%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to), :include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %>

+

<%= f.select :assigned_to_id, principals_options_for_select(@issue.assignable_users, @issue.assigned_to, @issue.previous_assigned_to_id ), :include_blank => true, :required => @issue.required_attribute?('assigned_to_id') %>

<% end %> <% if @issue.safe_attribute?('category_id') && @issue.project.issue_categories.any? %>