Commit 441d25618809c295349f7dae4e45bfbbc0fb7144
1 parent
f4f36f78
Exists in
master
and in
4 other branches
Rebuild team area
Showing
8 changed files
with
84 additions
and
119 deletions
Show diff stats
app/assets/stylesheets/gitlab_bootstrap/tables.scss
app/controllers/teams/projects_controller.rb
1 | 1 | class Teams::ProjectsController < Teams::ApplicationController |
2 | - | |
3 | - skip_before_filter :authorize_manage_user_team!, only: [:index] | |
4 | - | |
5 | - def index | |
6 | - @projects = user_team.projects | |
7 | - @avaliable_projects = current_user.admin? ? Project.without_team(user_team) : current_user.owned_projects.without_team(user_team) | |
8 | - end | |
9 | - | |
10 | - def new | |
11 | - user_team | |
12 | - @avaliable_projects = current_user.owned_projects.scoped | |
13 | - @avaliable_projects = @avaliable_projects.without_team(user_team) if user_team.projects.any? | |
14 | - | |
15 | - redirect_to team_projects_path(user_team), notice: "No avalible projects." unless @avaliable_projects.any? | |
16 | - end | |
17 | - | |
18 | 2 | def create |
19 | 3 | redirect_to :back if params[:project_ids].blank? |
20 | 4 | |
... | ... | @@ -28,7 +12,7 @@ class Teams::ProjectsController < Teams::ApplicationController |
28 | 12 | # Assign projects to team |
29 | 13 | user_team.assign_to_projects(project_ids, access) |
30 | 14 | |
31 | - redirect_to team_projects_path(user_team), notice: 'Team of users was successfully assigned to projects.' | |
15 | + redirect_to edit_team_path(user_team), notice: 'Team of users was successfully assigned to projects.' | |
32 | 16 | end |
33 | 17 | |
34 | 18 | def edit |
... | ... | @@ -37,7 +21,7 @@ class Teams::ProjectsController < Teams::ApplicationController |
37 | 21 | |
38 | 22 | def update |
39 | 23 | if user_team.update_project_access(team_project, params[:greatest_project_access]) |
40 | - redirect_to team_projects_path(user_team), notice: 'Access was successfully updated.' | |
24 | + redirect_to edit_team_path(user_team), notice: 'Access was successfully updated.' | |
41 | 25 | else |
42 | 26 | render :edit |
43 | 27 | end |
... | ... | @@ -53,5 +37,4 @@ class Teams::ProjectsController < Teams::ApplicationController |
53 | 37 | def team_project |
54 | 38 | @project ||= user_team.projects.find_with_namespace(params[:id]) |
55 | 39 | end |
56 | - | |
57 | 40 | end | ... | ... |
app/controllers/teams_controller.rb
app/views/layouts/user_team.html.haml
... | ... | @@ -26,14 +26,8 @@ |
26 | 26 | %span.count= @team.members.count |
27 | 27 | |
28 | 28 | - if can? current_user, :admin_user_team, @team |
29 | - = nav_link(controller: [:projects]) do | |
30 | - = link_to team_projects_path(@team), class: "team-tab tab" do | |
31 | - Projects | |
32 | - %span.count= @team.projects.count | |
33 | - | |
34 | 29 | = nav_link(path: 'teams#edit') do |
35 | 30 | = link_to edit_team_path(@team), class: "stat-tab tab " do |
36 | - %i.icon-edit | |
37 | - Edit Team | |
31 | + Settings | |
38 | 32 | |
39 | 33 | .content= yield | ... | ... |
app/views/teams/_projects.html.haml
... | ... | @@ -5,7 +5,7 @@ |
5 | 5 | (#{projects.count}) |
6 | 6 | - if can? current_user, :manage_user_team, @team |
7 | 7 | %span.pull-right |
8 | - = link_to new_team_project_path(@team), class: "btn btn-tiny info" do | |
8 | + = link_to edit_team_path(@team), class: "btn btn-tiny info" do | |
9 | 9 | %i.icon-plus |
10 | 10 | Assign Project |
11 | 11 | %ul.well-list | ... | ... |
app/views/teams/edit.html.haml
1 | -%h3.page_title= "Edit Team #{@team.name}" | |
2 | -%hr | |
3 | 1 | .row |
4 | - .span7 | |
5 | - = form_for @team, url: team_path(@team) do |f| | |
6 | - - if @team.errors.any? | |
7 | - .alert.alert-error | |
8 | - %span= @team.errors.full_messages.first | |
9 | - .clearfix | |
10 | - = f.label :name do | |
11 | - Team name is | |
12 | - .input | |
13 | - = f.text_field :name, placeholder: "Ex. OpenSource", class: "xlarge left" | |
14 | - | |
15 | - .clearfix.team-description-holder | |
16 | - = f.label :description, "Details" | |
17 | - .input | |
18 | - = f.text_area :description, maxlength: 250, class: "xlarge js-gfm-input", rows: 4 | |
19 | - | |
20 | - .clearfix | |
21 | - = f.label :path do | |
22 | - Team path is | |
23 | - .input | |
24 | - = f.text_field :path, placeholder: "opensource", class: "xlarge left" | |
25 | - | |
26 | - .form-actions | |
27 | - = f.submit 'Save team changes', class: "btn btn-primary" | |
28 | - .span5 | |
29 | - .ui-box | |
30 | - %h5.title Remove team | |
31 | - .padded.bgred | |
32 | - %p | |
33 | - Removed team can not be restored! | |
34 | - = link_to 'Remove team', team_path(@team), method: :delete, confirm: "You are sure?", class: "btn btn-remove btn-small" | |
2 | + .span3 | |
3 | + %ul.nav.nav-pills.nav-stacked | |
4 | + %li.active | |
5 | + = link_to 'Projects', '#tab-projects', 'data-toggle' => 'tab' | |
6 | + %li | |
7 | + = link_to 'Edit Team', '#tab-edit', 'data-toggle' => 'tab' | |
8 | + %li | |
9 | + = link_to 'Remove', '#tab-remove', 'data-toggle' => 'tab' | |
10 | + | |
11 | + .span9 | |
12 | + .tab-content | |
13 | + .tab-pane.active#tab-projects | |
14 | + .ui-box | |
15 | + %h5.title Projects | |
16 | + %ul.well-list | |
17 | + - @projects.each do |project| | |
18 | + %li | |
19 | + - if project.public | |
20 | + %i.icon-share | |
21 | + - else | |
22 | + %i.icon-lock.cgreen | |
23 | + = link_to project.name_with_namespace, project | |
24 | + .pull-right | |
25 | + = link_to 'Edit max access', edit_team_project_path(@team, project), class: "btn btn-small" | |
26 | + = link_to 'Relegate', team_project_path(@team, project), confirm: 'Remove project from team and move to global namespace. Are you sure?', method: :delete, class: "btn btn-remove small" | |
27 | + .form-holder | |
28 | + = form_tag team_projects_path(@team), id: "assign_projects", class: "bulk_import", method: :post do | |
29 | + %table.headless | |
30 | + %tr | |
31 | + %td= select_tag :project_ids, options_from_collection_for_select(@avaliable_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span4' | |
32 | + %td= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen" } | |
33 | + %td= submit_tag 'Add Project', class: "btn btn-create", id: :assign_projects_to_team | |
34 | + | |
35 | + | |
36 | + .tab-pane#tab-edit | |
37 | + .ui-box | |
38 | + %h5.title Edit Team | |
39 | + %div.form-holder | |
40 | + = form_for @team, url: team_path(@team) do |f| | |
41 | + - if @team.errors.any? | |
42 | + .alert.alert-error | |
43 | + %span= @team.errors.full_messages.first | |
44 | + .clearfix | |
45 | + = f.label :name do | |
46 | + Team name is | |
47 | + .input | |
48 | + = f.text_field :name, placeholder: "Ex. OpenSource", class: "xlarge left" | |
49 | + | |
50 | + .clearfix.team-description-holder | |
51 | + = f.label :description, "Details" | |
52 | + .input | |
53 | + = f.text_area :description, maxlength: 250, class: "xlarge js-gfm-input", rows: 4 | |
54 | + | |
55 | + .clearfix | |
56 | + = f.label :path do | |
57 | + Team path is | |
58 | + .input | |
59 | + = f.text_field :path, placeholder: "opensource", class: "xlarge left" | |
60 | + | |
61 | + .form-actions | |
62 | + = f.submit 'Save team changes', class: "btn btn-primary" | |
63 | + | |
64 | + .tab-pane#tab-remove | |
65 | + .ui-box.ui-box-danger | |
66 | + %h5.title Remove team | |
67 | + .ui-box-body | |
68 | + %p | |
69 | + Remove of team will cause removing members access to projects. | |
70 | + %p | |
71 | + %strong Removed team can not be restored! | |
72 | + | |
73 | + = link_to 'Remove team', team_path(@team), method: :delete, confirm: "You are sure?", class: "btn btn-remove btn-small" | ... | ... |
app/views/teams/projects/index.html.haml
... | ... | @@ -1,36 +0,0 @@ |
1 | -%h3.page_title | |
2 | - Assigned projects (#{@team.projects.count}) | |
3 | - %small | |
4 | - Read more about project permissions | |
5 | - %strong= link_to "here", help_permissions_path, class: "vlink" | |
6 | - | |
7 | - - if current_user.can?(:manage_user_team, @team) && @avaliable_projects.any? | |
8 | - %span.pull-right | |
9 | - = link_to new_team_project_path(@team), class: "btn btn-primary small grouped", title: "New Team Member" do | |
10 | - Assign project to Team | |
11 | - | |
12 | -%hr | |
13 | - | |
14 | -- if @team.projects.present? | |
15 | - %table.projects-table | |
16 | - %thead | |
17 | - %tr | |
18 | - %th Project name | |
19 | - %th Max access | |
20 | - - if current_user.can?(:admin_user_team, @team) | |
21 | - %th.span3 | |
22 | - | |
23 | - - @team.projects.each do |project| | |
24 | - %tr.project | |
25 | - %td | |
26 | - = link_to project.name_with_namespace, project_path(project) | |
27 | - %td | |
28 | - %span= @team.human_max_project_access(project) | |
29 | - | |
30 | - - if current_user.can?(:admin_user_team, @team) | |
31 | - %td.bgred | |
32 | - = link_to 'Edit max access', edit_team_project_path(@team, project), class: "btn btn-small" | |
33 | - = link_to 'Relegate', team_project_path(@team, project), confirm: 'Remove project from team and move to global namespace. Are you sure?', method: :delete, class: "btn btn-remove small" | |
34 | - | |
35 | -- else | |
36 | - %p.nothing_here_message This team has no projects yet |
app/views/teams/projects/new.html.haml
... | ... | @@ -1,23 +0,0 @@ |
1 | -%h3.page_title | |
2 | - Team: #{@team.name} | |
3 | - | |
4 | -%fieldset | |
5 | - %legend Projects (#{@team.projects.count}) | |
6 | - = form_tag team_projects_path(@team), id: "assign_projects", class: "bulk_import", method: :post do | |
7 | - %table#projects_list | |
8 | - %thead | |
9 | - %tr | |
10 | - %th Project name | |
11 | - %th Max access | |
12 | - %th | |
13 | - - @team.projects.each do |project| | |
14 | - %tr.project | |
15 | - %td | |
16 | - = link_to project.name_with_namespace, team_project_path(@team, project) | |
17 | - %td | |
18 | - %span= @team.human_max_project_access(project) | |
19 | - %td | |
20 | - %tr | |
21 | - %td= select_tag :project_ids, options_from_collection_for_select(@avaliable_projects , :id, :name_with_namespace), multiple: true, data: {placeholder: 'Select projects'}, class: 'chosen span5' | |
22 | - %td= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen span3" } | |
23 | - %td= submit_tag 'Add Project', class: "btn btn-create", id: :assign_projects_to_team |