Actualizar plugin Additionals a 3.0.0
This commit is contained in:
parent
3d976f1b3b
commit
a26f5567af
399 changed files with 70374 additions and 4093 deletions
|
@ -1,18 +1,29 @@
|
|||
module AdditionalsIssuesHelper
|
||||
def issue_author_options_for_select(project, issue = nil)
|
||||
authors = project.users.sorted
|
||||
def author_options_for_select(project, entity = nil, permission = nil)
|
||||
scope = project.present? ? project.users.visible : User.active.visible
|
||||
scope = scope.with_permission(permission, project) unless permission.nil?
|
||||
authors = scope.sorted.to_a
|
||||
|
||||
unless entity.nil?
|
||||
current_author_found = authors.detect { |u| u.id == entity.author_id_was }
|
||||
if current_author_found.blank?
|
||||
current_author = User.find_by id: entity.author_id_was
|
||||
authors << current_author if current_author
|
||||
end
|
||||
end
|
||||
|
||||
s = []
|
||||
return s unless authors.any?
|
||||
|
||||
s << content_tag('option', "<< #{l(:label_me)} >>", value: User.current.id) if authors.include?(User.current)
|
||||
s << tag.option("<< #{l :label_me} >>", value: User.current.id) if authors.include?(User.current)
|
||||
|
||||
if issue.nil?
|
||||
if entity.nil?
|
||||
s << options_from_collection_for_select(authors, 'id', 'name')
|
||||
else
|
||||
s << content_tag('option', issue.author, value: issue.author_id, selected: true) if issue.author && !authors.include?(issue.author)
|
||||
s << options_from_collection_for_select(authors, 'id', 'name', issue.author_id)
|
||||
s << tag.option(entity.author, value: entity.author_id, selected: true) if entity.author && authors.exclude?(entity.author)
|
||||
s << options_from_collection_for_select(authors, 'id', 'name', entity.author_id)
|
||||
end
|
||||
safe_join(s)
|
||||
safe_join s
|
||||
end
|
||||
|
||||
def show_issue_change_author?(issue)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue