Commit 209f96be authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Use project.team over project.users

parent e940fbc7
...@@ -23,7 +23,7 @@ class IssuesController < ProjectResourceController ...@@ -23,7 +23,7 @@ class IssuesController < ProjectResourceController
assignee_id, milestone_id = params[:assignee_id], params[:milestone_id] assignee_id, milestone_id = params[:assignee_id], params[:milestone_id]
@assignee = @project.users.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero? @assignee = @project.team.find(assignee_id) if assignee_id.present? && !assignee_id.to_i.zero?
@milestone = @project.milestones.find(milestone_id) if milestone_id.present? && !milestone_id.to_i.zero? @milestone = @project.milestones.find(milestone_id) if milestone_id.present? && !milestone_id.to_i.zero?
respond_to do |format| respond_to do |format|
......
...@@ -30,12 +30,6 @@ class Group < Namespace ...@@ -30,12 +30,6 @@ class Group < Namespace
) )
end end
def users
users = User.joins(:users_projects).where(users_projects: {project_id: project_ids})
users = users << owner
users.uniq
end
def human_name def human_name
name name
end end
......
...@@ -21,6 +21,11 @@ class ProjectTeam ...@@ -21,6 +21,11 @@ class ProjectTeam
end end
end end
def find user_id
user = project.users.find_by_id(user_id)
user ||= project.group.users.find_by_id(user_id)
end
def get_tm user_id def get_tm user_id
project.users_projects.find_by_user_id(user_id) project.users_projects.find_by_user_id(user_id)
end end
......
...@@ -16,16 +16,4 @@ ...@@ -16,16 +16,4 @@
(#{@members.count}) (#{@members.count})
%ul.well-list %ul.well-list
- @members.each do |member| - @members.each do |member|
- user = member.user = render 'users_groups/users_group', member: member
- next unless user
%li
= image_tag gravatar_icon(user.email, 16), class: "avatar s16"
%strong= user.name
%span.cgray= user.username
%span.pull-right
- if @group.owners.include?(user)
%span.label.label-info Group Owner
- else
= member.human_access
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
Assign to Assign to
.input .input
.pull-left .pull-left
= f.select(:assignee_id, @project.users.alphabetically.collect {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'}) = f.select(:assignee_id, @project.team.members.sort_by(&:name).map {|p| [ p.name, p.id ] }, { include_blank: "Select a user" }, {class: 'chosen'})
.pull-right .pull-right
&nbsp; &nbsp;
= link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link' = link_to 'Assign to me', '#', class: 'btn btn-small assign-to-me-link'
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
%span.update_issues_text Update selected issues with &nbsp; %span.update_issues_text Update selected issues with &nbsp;
.left .left
= select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status") = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status")
= select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") = select_tag('update[assignee_id]', options_from_collection_for_select(@project.team.members, "id", "name", params[:assignee_id]), prompt: "Assignee")
= select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
= hidden_field_tag 'update[issues_ids]', [] = hidden_field_tag 'update[issues_ids]', []
= hidden_field_tag :status, params[:status] = hidden_field_tag :status, params[:status]
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
Any Any
= link_to project_issues_with_filter_path(@project, assignee_id: 0) do = link_to project_issues_with_filter_path(@project, assignee_id: 0) do
Unassigned Unassigned
- @project.users.sort_by(&:name).each do |user| - @project.team.members.sort_by(&:name).each do |user|
%li %li
= link_to project_issues_with_filter_path(@project, assignee_id: user.id) do = link_to project_issues_with_filter_path(@project, assignee_id: user.id) do
= image_tag gravatar_icon(user.email), class: "avatar s16" = image_tag gravatar_icon(user.email), class: "avatar s16"
......
- user = member.user
- return unless user
%li
= image_tag gravatar_icon(user.email, 16), class: "avatar s16"
%strong= user.name
%span.cgray= user.username
%span.pull-right
- if @group.owners.include?(user)
%span.label.label-info Group Owner
- else
= member.human_access
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment