Commit 209f96bebeaf012ba941f2f8b1e659dd2334b5a1
1 parent
e940fbc7
Exists in
master
and in
4 other branches
Use project.team over project.users
Showing
7 changed files
with
22 additions
and
23 deletions
Show diff stats
app/controllers/issues_controller.rb
... | ... | @@ -23,7 +23,7 @@ class IssuesController < ProjectResourceController |
23 | 23 | |
24 | 24 | assignee_id, milestone_id = params[:assignee_id], params[:milestone_id] |
25 | 25 | |
26 | - @assignee = @project.users.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero? | |
26 | + @assignee = @project.team.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero? | |
27 | 27 | @milestone = @project.milestones.find(milestone_id) if milestone_id.present? && !milestone_id.to_i.zero? |
28 | 28 | |
29 | 29 | respond_to do |format| | ... | ... |
app/models/group.rb
app/models/project_team.rb
... | ... | @@ -21,6 +21,11 @@ class ProjectTeam |
21 | 21 | end |
22 | 22 | end |
23 | 23 | |
24 | + def find user_id | |
25 | + user = project.users.find_by_id(user_id) | |
26 | + user ||= project.group.users.find_by_id(user_id) | |
27 | + end | |
28 | + | |
24 | 29 | def get_tm user_id |
25 | 30 | project.users_projects.find_by_user_id(user_id) |
26 | 31 | end | ... | ... |
app/views/groups/people.html.haml
... | ... | @@ -16,16 +16,4 @@ |
16 | 16 | (#{@members.count}) |
17 | 17 | %ul.well-list |
18 | 18 | - @members.each do |member| |
19 | - - user = member.user | |
20 | - - next unless user | |
21 | - %li | |
22 | - = image_tag gravatar_icon(user.email, 16), class: "avatar s16" | |
23 | - %strong= user.name | |
24 | - %span.cgray= user.username | |
25 | - | |
26 | - %span.pull-right | |
27 | - - if @group.owners.include?(user) | |
28 | - %span.label.label-info Group Owner | |
29 | - - else | |
30 | - = member.human_access | |
31 | - | |
19 | + = render 'users_groups/users_group', member: member | ... | ... |
app/views/issues/_form.html.haml
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | Assign to |
22 | 22 | .input |
23 | 23 | .pull-left |
24 | - = f.select(:assignee_id, @project.users.alphabetically.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) | |
24 | + = f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) | |
25 | 25 | .pull-right |
26 | 26 | |
27 | 27 | = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' | ... | ... |
app/views/issues/_issues.html.haml
... | ... | @@ -7,7 +7,7 @@ |
7 | 7 | %span.update_issues_text Update selected issues with |
8 | 8 | .left |
9 | 9 | = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status") |
10 | - = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") | |
10 | + = select_tag('update[assignee_id]', options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id]), prompt: "Assignee") | |
11 | 11 | = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") |
12 | 12 | = hidden_field_tag 'update[issues_ids]', [] |
13 | 13 | = hidden_field_tag :status, params[:status] |
... | ... | @@ -50,7 +50,7 @@ |
50 | 50 | Any |
51 | 51 | = link_to project_issues_with_filter_path(@project, assignee_id: 0) do |
52 | 52 | Unassigned |
53 | - - @project.users.sort_by(&:name).each do |user| | |
53 | + - @project.team.members.sort_by(&:name).each do |user| | |
54 | 54 | %li |
55 | 55 | = link_to project_issues_with_filter_path(@project, assignee_id: user.id) do |
56 | 56 | = image_tag gravatar_icon(user.email), class: "avatar s16" | ... | ... |
... | ... | @@ -0,0 +1,12 @@ |
1 | +- user = member.user | |
2 | +- return unless user | |
3 | +%li | |
4 | + = image_tag gravatar_icon(user.email, 16), class: "avatar s16" | |
5 | + %strong= user.name | |
6 | + %span.cgray= user.username | |
7 | + | |
8 | + %span.pull-right | |
9 | + - if @group.owners.include?(user) | |
10 | + %span.label.label-info Group Owner | |
11 | + - else | |
12 | + = member.human_access | ... | ... |