Commit ca752e64fbf1cd03ff3eff1ada80a1cfbcd9b2b4
1 parent
ca105d04
Exists in
master
and in
4 other branches
Fix mispelling and ambiguous id in UserTeam.without_project
Showing
9 changed files
with
28 additions
and
35 deletions
Show diff stats
app/controllers/projects/teams_controller.rb
1 | class Projects::TeamsController < Projects::ApplicationController | 1 | class Projects::TeamsController < Projects::ApplicationController |
2 | 2 | ||
3 | - def avaliable | 3 | + def available |
4 | @teams = current_user.is_admin? ? UserTeam.scoped : current_user.user_teams | 4 | @teams = current_user.is_admin? ? UserTeam.scoped : current_user.user_teams |
5 | @teams = @teams.without_project(project) | 5 | @teams = @teams.without_project(project) |
6 | unless @teams.any? | 6 | unless @teams.any? |
app/models/user_team.rb
@@ -17,7 +17,7 @@ class UserTeam < ActiveRecord::Base | @@ -17,7 +17,7 @@ class UserTeam < ActiveRecord::Base | ||
17 | 17 | ||
18 | scope :with_member, ->(user){ joins(:user_team_user_relationships).where(user_team_user_relationships: {user_id: user.id}) } | 18 | scope :with_member, ->(user){ joins(:user_team_user_relationships).where(user_team_user_relationships: {user_id: user.id}) } |
19 | scope :with_project, ->(project){ joins(:user_team_project_relationships).where(user_team_project_relationships: {project_id: project})} | 19 | scope :with_project, ->(project){ joins(:user_team_project_relationships).where(user_team_project_relationships: {project_id: project})} |
20 | - scope :without_project, ->(project){ where("id NOT IN (:ids)", ids: (a = with_project(project); a.blank? ? 0 : a))} | 20 | + scope :without_project, ->(project){ where("user_teams.id NOT IN (:ids)", ids: (a = with_project(project); a.blank? ? 0 : a))} |
21 | scope :created_by, ->(user){ where(owner_id: user) } | 21 | scope :created_by, ->(user){ where(owner_id: user) } |
22 | 22 | ||
23 | class << self | 23 | class << self |
app/views/dashboard/_teams.html.haml
1 | .teams_box | 1 | .teams_box |
2 | %h5.title | 2 | %h5.title |
3 | - My Teams | 3 | + Teams |
4 | %small | 4 | %small |
5 | (#{@teams.count}) | 5 | (#{@teams.count}) |
6 | %span.right | 6 | %span.right |
7 | = link_to new_team_path, class: "btn very_small info" do | 7 | = link_to new_team_path, class: "btn very_small info" do |
8 | %i.icon-plus | 8 | %i.icon-plus |
9 | New Team | 9 | New Team |
10 | - %span.right | ||
11 | - = link_to teams_path, class: "btn very_small info" do | ||
12 | - %i.icon-user | ||
13 | - All Teams | ||
14 | %ul.well-list | 10 | %ul.well-list |
15 | - @teams.each do |team| | 11 | - @teams.each do |team| |
16 | %li | 12 | %li |
app/views/layouts/_head_panel.html.haml
@@ -8,9 +8,6 @@ | @@ -8,9 +8,6 @@ | ||
8 | %span.separator | 8 | %span.separator |
9 | %h1.project_name= title | 9 | %h1.project_name= title |
10 | %ul.nav | 10 | %ul.nav |
11 | - %li | ||
12 | - = link_to teams_path, title: "Teams of users", class: 'has_bottom_tooltip', 'data-original-title' => 'Teams list' do | ||
13 | - %i.icon-group | ||
14 | - if current_user.is_admin? | 11 | - if current_user.is_admin? |
15 | %li | 12 | %li |
16 | = link_to admin_root_path, title: "Admin area", class: 'has_bottom_tooltip', 'data-original-title' => 'Admin area' do | 13 | = link_to admin_root_path, title: "Admin area", class: 'has_bottom_tooltip', 'data-original-title' => 'Admin area' do |
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
1 | += render "projects/project_head" | ||
2 | + | ||
3 | +%h3.page_title | ||
4 | + = "Assign project to team of users" | ||
5 | +%hr | ||
6 | +%p.slead | ||
7 | + Read more about assign to team of users #{link_to "here", '#', class: 'vlink'}. | ||
8 | += form_tag assign_project_teams_path(@project), method: 'post' do | ||
9 | + %p.slead Choose Team of users you want to assign: | ||
10 | + .padded | ||
11 | + = label_tag :team_id, "Team" | ||
12 | + .input= select_tag(:team_id, options_from_collection_for_select(@teams, :id, :name), prompt: "Select team", class: "chosen xxlarge", required: true) | ||
13 | + %p.slead Choose greatest user acces in team you want to assign: | ||
14 | + .padded | ||
15 | + = label_tag :team_ids, "Permission" | ||
16 | + .input= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen span3" } | ||
17 | + | ||
18 | + | ||
19 | + .actions | ||
20 | + = submit_tag 'Assign', class: "btn save-btn" | ||
21 | + = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn" | ||
22 | + |
app/views/projects/teams/avaliable.html.haml
@@ -1,22 +0,0 @@ | @@ -1,22 +0,0 @@ | ||
1 | -= render "projects/project_head" | ||
2 | - | ||
3 | -%h3.page_title | ||
4 | - = "Assign project to team of users" | ||
5 | -%hr | ||
6 | -%p.slead | ||
7 | - Read more about assign to team of users #{link_to "here", '#', class: 'vlink'}. | ||
8 | -= form_tag assign_project_teams_path(@project), method: 'post' do | ||
9 | - %p.slead Choose Team of users you want to assign: | ||
10 | - .padded | ||
11 | - = label_tag :team_id, "Team" | ||
12 | - .input= select_tag(:team_id, options_from_collection_for_select(@teams, :id, :name), prompt: "Select team", class: "chosen xxlarge", required: true) | ||
13 | - %p.slead Choose greatest user acces in team you want to assign: | ||
14 | - .padded | ||
15 | - = label_tag :team_ids, "Permission" | ||
16 | - .input= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen span3" } | ||
17 | - | ||
18 | - | ||
19 | - .actions | ||
20 | - = submit_tag 'Assign', class: "btn save-btn" | ||
21 | - = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn" | ||
22 | - |
app/views/team_members/index.html.haml
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | %span.right | 10 | %span.right |
11 | = link_to import_project_team_members_path(@project), class: "btn small grouped", title: "Import team from another project" do | 11 | = link_to import_project_team_members_path(@project), class: "btn small grouped", title: "Import team from another project" do |
12 | Import team from another project | 12 | Import team from another project |
13 | - = link_to avaliable_project_teams_path(@project), class: "btn small grouped", title: "Assign project to team of users" do | 13 | + = link_to available_project_teams_path(@project), class: "btn small grouped", title: "Assign project to team of users" do |
14 | Assign project to Team of users | 14 | Assign project to Team of users |
15 | = link_to new_project_team_member_path(@project), class: "btn success small grouped", title: "New Team Member" do | 15 | = link_to new_project_team_member_path(@project), class: "btn success small grouped", title: "New Team Member" do |
16 | New Team Member | 16 | New Team Member |
app/views/teams/new.html.haml
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | = f.label :name do | 8 | = f.label :name do |
9 | Team name is | 9 | Team name is |
10 | .input | 10 | .input |
11 | - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xxlarge left" | 11 | + = f.text_field :name, placeholder: "Ex. Ruby Developers", class: "xxlarge left" |
12 | | 12 | |
13 | = f.submit 'Create team', class: "btn primary" | 13 | = f.submit 'Create team', class: "btn primary" |
14 | %hr | 14 | %hr |
config/routes.rb
@@ -272,7 +272,7 @@ Gitlab::Application.routes.draw do | @@ -272,7 +272,7 @@ Gitlab::Application.routes.draw do | ||
272 | scope module: :projects do | 272 | scope module: :projects do |
273 | resources :teams, only: [] do | 273 | resources :teams, only: [] do |
274 | collection do | 274 | collection do |
275 | - get :avaliable | 275 | + get :available |
276 | post :assign | 276 | post :assign |
277 | end | 277 | end |
278 | member do | 278 | member do |