Fix bug with change author and projects with no members

This commit is contained in:
Alexander Meindl 2018-09-24 11:28:20 +02:00
parent 624900724c
commit f2d04ae3f2
3 changed files with 14 additions and 8 deletions

View File

@ -2,6 +2,8 @@ module AdditionalsIssuesHelper
def issue_author_options_for_select(project, issue = nil)
authors = project.users.sorted
s = []
return s unless authors.any?
s << content_tag('option', "<< #{l(:label_me)} >>", value: User.current.id) if authors.include?(User.current)
if issue.nil?

View File

@ -1,5 +1,7 @@
- if show_issue_change_author?(issue) && issue.safe_attribute?('author_id')
p#change_author
= form.select :author_id, issue_author_options_for_select(issue.project, issue), required: true
javascript:
$('#change_author').insertBefore($('#issue_tracker_id').parent());
- author_options = issue_author_options_for_select(issue.project, issue)
- if author_options.present?
p#change_author
= form.select :author_id, author_options, required: true
javascript:
$('#change_author').insertBefore($('#issue_tracker_id').parent());

View File

@ -1,5 +1,7 @@
- if @project && User.current.allowed_to?(:edit_issue_author, @project)
p#change_author
= label_tag('issue[author_id]', l(:field_author))
= select_tag('issue[author_id]',
content_tag('option', l(:label_no_change_option), value: '') + issue_author_options_for_select(@project))
- author_options = issue_author_options_for_select(@project)
- if author_options.present?
p#change_author
= label_tag('issue[author_id]', l(:field_author))
= select_tag('issue[author_id]',
content_tag('option', l(:label_no_change_option), value: '') + author_options)