Project

General

Profile

Patch #16045 » last_assignee_wip.diff

Luka Lüdicke, 2016-11-17 11:43

View differences:

app/helpers/application_helper.rb (working copy)
387 387
  end
388 388

  
389 389
  # Returns a string for users/groups option tags
390
  def principals_options_for_select(collection, selected=nil)
390
  def principals_options_for_select(collection, selected = nil)
391 391
    s = ''
392 392
    if collection.include?(User.current)
393
      s << content_tag('option', "<< #{l(:label_me)} >>", :value => User.current.id)
393
      s << content_tag('option', "<< #{l(:label_me_accusative, default: l(:label_me))} >>", value: User.current.id) # corrected for proper german (mich instead of ich!)
394 394
    end
395
    # TODO: add this to Redmine Core and throw away the reference to the @issue instance variable
396
    # The instance variable is used (instead of another parameter) to avoid the necessity of overriding the issues/_attributes partial
397
    unless @issue.nil? # do not add option in case of bulk and issue category edit
398
      last_assignee_id = @issue.last_assigned_to
399
      s << content_tag('option', "<< #{t('issue.last_assignee', name: User.find_by_id(last_assignee_id).try(:name))} >>",
400
                       value: last_assignee_id) if (last_assignee_id && (last_assignee_id != User.current.id))
401
    end
395 402
    groups = ''
396 403
    collection.sort.each do |element|
397 404
      selected_attribute = ' selected="selected"' if option_value_selected?(element, selected) || element.id.to_s == selected
app/models/issue.rb (working copy)
806 806
    scope
807 807
  end
808 808

  
809
  # Returns the last assigned_to_id from the issue history
810
  def last_assigned_to
811
    journals.reverse_each do |j|
812
      last_assignee_change = j.detail_for_attribute 'assigned_to_id'
813
      return last_assignee_change.old_value.to_i if last_assignee_change && last_assignee_change.old_value
814
    end
815
    nil # return nil instead of an empty array
816
  end
817

  
809 818
  # Returns the initial status of the issue
810 819
  # Returns nil for a new issue
811 820
  def status_was
config/locales/de.yml (working copy)
622 622
  label_only: nur
623 623
  label_max_size: Maximale Größe
624 624
  label_me: ich
625
  label_me_accusative: mich
626
  last_assignee: "ZULETZT: %{name}"
625 627
  label_member: Mitglied
626 628
  label_member_new: Neues Mitglied
627 629
  label_member_plural: Mitglieder
config/locales/en.yml (working copy)
816 816
  label_disabled: disabled
817 817
  label_show_completed_versions: Show completed versions
818 818
  label_me: me
819
  last_assignee: "LAST: %{name}"
819 820
  label_board: Forum
820 821
  label_board_new: New forum
821 822
  label_board_plural: Forums
(3-3/6)