Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kumanyaev <me@zzet.org>2013-01-23 02:20:27 +0400
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-01-25 00:31:25 +0400
commit18bd1c9d30e16783d750c7786cbcc7d350f4d0aa (patch)
tree6218758f723e827cf90ea61f7bc4ed639ad6cc54 /app/views/teams
parent7658f8c151b22680cf594d028e180a8a859fc9b8 (diff)
update all teams code. refactoring and some corrections
Diffstat (limited to 'app/views/teams')
-rw-r--r--app/views/teams/_team_head.html.haml12
-rw-r--r--app/views/teams/edit.html.haml18
-rw-r--r--app/views/teams/index.html.haml5
-rw-r--r--app/views/teams/members/_form.html.haml27
-rw-r--r--app/views/teams/members/_show.html.haml14
-rw-r--r--app/views/teams/members/_team.html.haml2
-rw-r--r--app/views/teams/members/edit.html.haml20
-rw-r--r--app/views/teams/members/import.html.haml17
-rw-r--r--app/views/teams/members/index.html.haml7
-rw-r--r--app/views/teams/members/new.html.haml32
-rw-r--r--app/views/teams/members/show.html.haml2
-rw-r--r--app/views/teams/merge_requests.html.haml2
-rw-r--r--app/views/teams/new.html.haml6
-rw-r--r--app/views/teams/projects/_form.html.haml16
-rw-r--r--app/views/teams/projects/edit.html.haml18
-rw-r--r--app/views/teams/projects/index.html.haml60
-rw-r--r--app/views/teams/projects/new.html.haml25
-rw-r--r--app/views/teams/projects/show.html.haml4
-rw-r--r--app/views/teams/search.html.haml2
19 files changed, 178 insertions, 111 deletions
diff --git a/app/views/teams/_team_head.html.haml b/app/views/teams/_team_head.html.haml
index 53796623de1..cb5c9567ba6 100644
--- a/app/views/teams/_team_head.html.haml
+++ b/app/views/teams/_team_head.html.haml
@@ -1,19 +1,19 @@
%ul.nav.nav-tabs
= nav_link(path: 'teams#show') do
- = link_to team_path(@user_team), class: "activities-tab tab" do
+ = link_to team_path(@team), class: "activities-tab tab" do
%i.icon-home
Show
= nav_link(controller: [:members]) do
- = link_to team_members_path(@user_team), class: "team-tab tab" do
+ = link_to team_members_path(@team), class: "team-tab tab" do
%i.icon-user
Members
= nav_link(controller: [:projects]) do
- = link_to team_projects_path(@user_team), class: "team-tab tab" do
+ = link_to team_projects_path(@team), class: "team-tab tab" do
%i.icon-briefcase
Projects
- - if can? current_user, :manage_user_team, @user_team
+ - if can? current_user, :admin_user_team, @team
= nav_link(path: 'teams#edit', html_options: {class: 'right'}) do
- = link_to edit_team_path(@user_team), class: "stat-tab tab " do
+ = link_to edit_team_path(@team), class: "stat-tab tab " do
%i.icon-edit
- Edit
+ Edit Team
diff --git a/app/views/teams/edit.html.haml b/app/views/teams/edit.html.haml
index 4c239e8fa41..b2ceb2bdb21 100644
--- a/app/views/teams/edit.html.haml
+++ b/app/views/teams/edit.html.haml
@@ -1,11 +1,11 @@
= render "team_head"
-%h3.page_title= "Edit Team #{@user_team.name}"
+%h3.page_title= "Edit Team #{@team.name}"
%hr
-= form_for @user_team, url: teams_path do |f|
- - if @user_team.errors.any?
+= form_for @team, url: teams_path do |f|
+ - if @team.errors.any?
.alert-message.block-message.error
- %span= @user_team.errors.full_messages.first
+ %span= @team.errors.full_messages.first
.clearfix
= f.label :name do
Team name is
@@ -21,12 +21,4 @@
.input.span3.center
= f.submit 'Save team changes', class: "btn primary"
.input.span3.center
- = link_to 'Delete team', team_path(@user_team), method: :delete, confirm: "You are shure?", class: "btn danger"
- %hr
- .padded
- %ul
- %li Team is kind of directory for several projects
- %li All created teams are private
- %li People within a team see only projects they have access to
- %li All projects of team will be stored in team directory
- %li You will be able to move existing projects into team
+ = link_to 'Delete team', team_path(@team), method: :delete, confirm: "You are shure?", class: "btn danger"
diff --git a/app/views/teams/index.html.haml b/app/views/teams/index.html.haml
index 9ac54594521..8f8874328fc 100644
--- a/app/views/teams/index.html.haml
+++ b/app/views/teams/index.html.haml
@@ -3,7 +3,7 @@
%small
list of all teams
- = link_to 'New Team', new_team_path, class: "btn small right"
+ = link_to 'New Team', new_team_path, class: "btn success small right"
%br
= form_tag search_teams_path, method: :get, class: 'form-inline' do
@@ -32,6 +32,7 @@
%td= link_to team.owner.name, team_member_path(team, team.owner)
%td
- if current_user.can?(:manage_user_team, team)
- - if team.owner == current_user
+ - if current_user.can?(:admin_user_team, team)
= link_to "Destroy", team_path(team), method: :delete, confirm: "You are shure?", class: "danger btn small right"
+ &nbsp;
= link_to "Edit", edit_team_path(team), class: "btn small right"
diff --git a/app/views/teams/members/_form.html.haml b/app/views/teams/members/_form.html.haml
index a963e462a78..b75d788a94a 100644
--- a/app/views/teams/members/_form.html.haml
+++ b/app/views/teams/members/_form.html.haml
@@ -1,23 +1,20 @@
-%h3.page_title
- = "New Team member(s)"
-%hr
-= form_for @team_member, as: :team_member, url: project_team_members_path(@project, @team_member) do |f|
- -if @team_member.errors.any?
+= form_tag admin_team_member_path(@team, @member), method: :put do
+ -if @member.errors.any?
.alert-message.block-message.error
%ul
- - @team_member.errors.full_messages.each do |msg|
+ - @member.errors.full_messages.each do |msg|
%li= msg
- %h6 1. Choose people you want in the team
.clearfix
- = f.label :user_ids, "People"
- .input= select_tag(:user_ids, options_from_collection_for_select(User.active.not_in_project(@project).alphabetically, :id, :name), {data: {placeholder: "Select users"}, class: "chosen xxlarge", multiple: true})
-
- %h6 2. Set access level for them
+ %label Default access for Team projects:
+ .input
+ = select_tag :default_project_access, options_for_select(UserTeam.access_roles, @team.default_projects_access(@member)), class: "project-access-select chosen span3"
.clearfix
- = f.label :project_access, "Project Access"
- .input= select_tag :project_access, options_for_select(Project.access_options, @team_member.project_access), class: "project-access-select chosen"
+ %label Team admin?
+ .input
+ = check_box_tag :group_admin, true, @team.admin?(@member)
+ %br
.actions
- = f.submit 'Save', class: "btn save-btn"
- = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn"
+ = submit_tag 'Save', class: "btn primary"
+ = link_to 'Cancel', :back, class: "btn"
diff --git a/app/views/teams/members/_show.html.haml b/app/views/teams/members/_show.html.haml
index a06d269ac00..ec4728787cf 100644
--- a/app/views/teams/members/_show.html.haml
+++ b/app/views/teams/members/_show.html.haml
@@ -1,11 +1,11 @@
- user = member.user
-- allow_admin = can? current_user, :manage_user_team, @user_team
+- allow_admin = can? current_user, :manage_user_team, @team
%li{id: dom_id(member), class: "team_member_row user_#{user.id}"}
.row
.span5
- = link_to team_member_path(@user_team, user), title: user.name, class: "dark" do
+ = link_to team_member_path(@team, user), title: user.name, class: "dark" do
= image_tag gravatar_icon(user.email, 40), class: "avatar s32"
- = link_to team_member_path(@user_team, user), title: user.name, class: "dark" do
+ = link_to team_member_path(@team, user), title: user.name, class: "dark" do
%strong= truncate(user.name, lenght: 40)
%br
%small.cgray= user.email
@@ -13,8 +13,8 @@
.span6.right
- if allow_admin
.left.span2
- = form_for(member, as: :team_member, url: team_member_path(@user_team, user)) do |f|
- = f.select :permission, options_for_select(UsersProject.access_roles, @user_team.default_projects_access(user)), {}, class: "medium project-access-select span2"
+ = form_for(member, as: :team_member, url: team_member_path(@team, user)) do |f|
+ = f.select :permission, options_for_select(UsersProject.access_roles, @team.default_projects_access(user)), {}, class: "medium project-access-select span2"
.left.span2
%span
Admin access
@@ -22,10 +22,10 @@
.right
- if current_user == user
%span.btn.disabled This is you!
- - if @user_team.owner == user
+ - if @team.owner == user
%span.btn.disabled.success Owner
- elsif user.blocked
%span.btn.disabled.blocked Blocked
- elsif allow_admin
- = link_to team_member_path(@user_team, user), confirm: remove_from_user_team_message(@user_team, user), method: :delete, class: "very_small btn danger" do
+ = link_to team_member_path(@team, user), confirm: remove_from_user_team_message(@team, user), method: :delete, class: "very_small btn danger" do
%i.icon-minus.icon-white
diff --git a/app/views/teams/members/_team.html.haml b/app/views/teams/members/_team.html.haml
index e1fbf6d1e75..d8afc1fa371 100644
--- a/app/views/teams/members/_team.html.haml
+++ b/app/views/teams/members/_team.html.haml
@@ -1,4 +1,4 @@
-- grouped_user_team_members(@user_team).each do |access, members|
+- grouped_user_team_members(@team).each do |access, members|
.ui-box
%h5.title
= Project.access_options.key(access).pluralize
diff --git a/app/views/teams/members/edit.html.haml b/app/views/teams/members/edit.html.haml
index a2742977717..9caff799552 100644
--- a/app/views/teams/members/edit.html.haml
+++ b/app/views/teams/members/edit.html.haml
@@ -1,2 +1,18 @@
-%h1 Teams::Members#edit
-%p Find me in app/views/teams/members/edit.html.haml \ No newline at end of file
+= render "teams/team_head"
+
+%h3
+ Edit access #{@member.name} in #{@team.name} team
+
+%hr
+%table.zebra-striped
+ %tr
+ %td User:
+ %td= @member.name
+ %tr
+ %td Team:
+ %td= @team.name
+ %tr
+ %td Since:
+ %td= member_since(@team, @member).stamp("Nov 11, 2010")
+
+= render 'form'
diff --git a/app/views/teams/members/import.html.haml b/app/views/teams/members/import.html.haml
deleted file mode 100644
index de82f416248..00000000000
--- a/app/views/teams/members/import.html.haml
+++ /dev/null
@@ -1,17 +0,0 @@
-= render "projects/project_head"
-
-%h3.page_title
- = "Import team from another project"
-%hr
-%p.slead
- Read more about team import #{link_to "here", '#', class: 'vlink'}.
-= form_tag apply_import_project_team_members_path(@project), method: 'post' do
- %p.slead Choose project you want to use as team source:
- .padded
- = label_tag :source_project_id, "Project"
- .input= select_tag(:source_project_id, options_from_collection_for_select(current_user.authorized_projects, :id, :name_with_namespace), prompt: "Select project", class: "chosen xxlarge", required: true)
-
- .actions
- = submit_tag 'Import', class: "btn save-btn"
- = link_to "Cancel", project_team_index_path(@project), class: "btn cancel-btn"
-
diff --git a/app/views/teams/members/index.html.haml b/app/views/teams/members/index.html.haml
index 5b125b32769..1628237ede0 100644
--- a/app/views/teams/members/index.html.haml
+++ b/app/views/teams/members/index.html.haml
@@ -1,4 +1,5 @@
= render "teams/team_head"
+
%h3.page_title
Team Members
(#{@members.count})
@@ -6,13 +7,13 @@
Read more about project permissions
%strong= link_to "here", help_permissions_path, class: "vlink"
- - if can? current_user, :manage_user_team, @user_team
+ - if can? current_user, :manage_user_team, @team
%span.right
- = link_to new_team_member_path(@user_team), class: "btn success small grouped", title: "New Team Member" do
+ = link_to new_team_member_path(@team), class: "btn success small grouped", title: "New Team Member" do
New Team Member
%hr
.clearfix
%div.team-table
- = render partial: "teams/members/team", locals: {project: @user_team}
+ = render partial: "teams/members/team", locals: {project: @team}
diff --git a/app/views/teams/members/new.html.haml b/app/views/teams/members/new.html.haml
index 40eb4cebf08..43f7c5d7b6f 100644
--- a/app/views/teams/members/new.html.haml
+++ b/app/views/teams/members/new.html.haml
@@ -1,2 +1,30 @@
-= render "projects/project_head"
-= render "team_members/form"
+= render "teams/team_head"
+
+%h3.page_title
+ Team: #{@team.name}
+
+%fieldset
+ %legend Members (#{@team.members.count})
+ = form_tag team_members_path(@team), id: "team_members", class: "bulk_import", method: :post do
+ %table#members_list
+ %thead
+ %tr
+ %th User name
+ %th Default project access
+ %th Team access
+ %th
+ - @team.members.each do |member|
+ %tr.member
+ %td
+ = member.name
+ %small= "(#{member.email})"
+ %td= @team.human_default_projects_access(member)
+ %td= @team.admin?(member) ? "Admin" : "Member"
+ %td
+ %tr
+ %td= select_tag :user_ids, options_from_collection_for_select(@users , :id, :name_with_email), multiple: true, data: {placeholder: 'Select users'}, class: 'chosen span5'
+ %td= select_tag :default_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" }
+ %td
+ %span= check_box_tag :group_admin
+ %span Admin?
+ %td= submit_tag 'Add', class: "btn primary", id: :add_members_to_team
diff --git a/app/views/teams/members/show.html.haml b/app/views/teams/members/show.html.haml
index 4008e8bd23e..03ef21be7a6 100644
--- a/app/views/teams/members/show.html.haml
+++ b/app/views/teams/members/show.html.haml
@@ -1,3 +1,5 @@
+= render "teams/team_head"
+
- allow_admin = can? current_user, :admin_project, @project
- user = @team_member.user
diff --git a/app/views/teams/merge_requests.html.haml b/app/views/teams/merge_requests.html.haml
index c9af529e113..f16331e1cdd 100644
--- a/app/views/teams/merge_requests.html.haml
+++ b/app/views/teams/merge_requests.html.haml
@@ -1,3 +1,5 @@
+= render "team_head"
+
%h3.page_title
Merge Requests
%small (authored by or assigned to Team members)
diff --git a/app/views/teams/new.html.haml b/app/views/teams/new.html.haml
index d8312e0e913..a068c51e6ab 100644
--- a/app/views/teams/new.html.haml
+++ b/app/views/teams/new.html.haml
@@ -14,8 +14,6 @@
%hr
.padded
%ul
- %li Team is kind of directory for several projects
- %li All created teams are private
+ %li All created teams are public (users can view who enter into team and which project are assigned for this team)
%li People within a team see only projects they have access to
- %li All projects of team will be stored in team directory
- %li You will be able to move existing projects into team
+ %li You will be able to assign existing projects for team
diff --git a/app/views/teams/projects/_form.html.haml b/app/views/teams/projects/_form.html.haml
new file mode 100644
index 00000000000..3749dbc4f99
--- /dev/null
+++ b/app/views/teams/projects/_form.html.haml
@@ -0,0 +1,16 @@
+= form_tag team_project_path(@team, @project), method: :put do
+ -if @project.errors.any?
+ .alert-message.block-message.error
+ %ul
+ - @project.errors.full_messages.each do |msg|
+ %li= msg
+
+ .clearfix
+ %label Max access for Team members:
+ .input
+ = select_tag :greatest_project_access, options_for_select(UserTeam.access_roles, @team.max_project_access(@project)), class: "project-access-select chosen span3"
+
+ %br
+ .actions
+ = submit_tag 'Save', class: "btn primary"
+ = link_to 'Cancel', :back, class: "btn"
diff --git a/app/views/teams/projects/edit.html.haml b/app/views/teams/projects/edit.html.haml
index 66c9f0671ff..056ee6852c1 100644
--- a/app/views/teams/projects/edit.html.haml
+++ b/app/views/teams/projects/edit.html.haml
@@ -1,4 +1,18 @@
= render "teams/team_head"
-%h1 Teams::Projects#edit
-%p Find me in app/views/teams/projects/edit.html.haml
+%h3
+ Edit max access in #{@project.name} for #{@team.name} team
+
+%hr
+%table.zebra-striped
+ %tr
+ %td Project:
+ %td= @project.name
+ %tr
+ %td Team:
+ %td= @team.name
+ %tr
+ %td Since:
+ %td= assigned_since(@team, @project).stamp("Nov 11, 2010")
+
+= render 'form'
diff --git a/app/views/teams/projects/index.html.haml b/app/views/teams/projects/index.html.haml
index 66cb12a8421..b0a50e594cf 100644
--- a/app/views/teams/projects/index.html.haml
+++ b/app/views/teams/projects/index.html.haml
@@ -1,34 +1,34 @@
= render "teams/team_head"
-%fieldset
- %legend Projects (#{@user_team.projects.count})
- = form_tag delegate_projects_team_path(@user_team), id: "team_projects", class: "bulk_import", method: :post do
- %table
- %thead
- %tr
- %th Project name
- %th Max access
- %th
- - @user_team.projects.each do |project|
- %tr.project
- %td
- = link_to project.name_with_namespace, project
- %td
- %span= @user_team.human_max_project_access(project)
- -# if current_user.can?(:manage_user_team, @user_team)
- - relation = project.user_team_project_relationships.find_by_user_team_id(@user_team)
- = form_for(relation, as: :project, url: team_project_path(@user_team, project)) do |f|
- = f.select :greatest_access, options_for_select(UsersProject.access_roles, @user_team.max_project_access(project)), {}, class: "medium project-access-select span2"
+%h3.page_title
+ Assigned projects (#{@team.projects.count})
+ %small
+ Read more about project permissions
+ %strong= link_to "here", help_permissions_path, class: "vlink"
- - if current_user.can?(:admin_user_team, @user_team)
- %td.bgred
- -#= link_to 'Edit max access', edit_project_team_path(@user_team, project), class: "btn small"
- = link_to 'Relegate', relegate_project_team_path(@user_team, project_id: project.id), confirm: 'Remove project from team and move to global namespace. Are you sure?', method: :delete, class: "btn danger small"
- - else
- %td
+ - if current_user.can?(:manage_user_team, @team) && @avaliable_projects.any?
+ %span.right
+ = link_to new_team_project_path(@team), class: "btn success small grouped", title: "New Team Member" do
+ Assign project to Team
- - if @avaliable_projects.any?
- %tr
- %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'
- %td= select_tag :greatest_project_access, options_for_select(Project.access_options), {class: "project-access-select chosen span3" }
- %td= submit_tag 'Add', class: "btn primary"
+%hr
+
+%table
+ %thead
+ %tr
+ %th Project name
+ %th Max access
+ - if current_user.can?(:admin_user_team, @team)
+ %th.span3
+
+ - @team.projects.each do |project|
+ %tr.project
+ %td
+ = link_to project.name_with_namespace, project_path(project)
+ %td
+ %span= @team.human_max_project_access(project)
+
+ - if current_user.can?(:admin_user_team, @team)
+ %td.bgred
+ = link_to 'Edit max access', edit_team_project_path(@team, project), class: "btn small"
+ = 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 danger small"
diff --git a/app/views/teams/projects/new.html.haml b/app/views/teams/projects/new.html.haml
index 24d2d4c34ca..000f62bb643 100644
--- a/app/views/teams/projects/new.html.haml
+++ b/app/views/teams/projects/new.html.haml
@@ -1,4 +1,25 @@
= render "teams/team_head"
-%h1 Teams::Projects#new
-%p Find me in app/views/teams/projects/new.html.haml
+%h3.page_title
+ Team: #{@team.name}
+
+%fieldset
+ %legend Projects (#{@team.projects.count})
+ = form_tag team_projects_path(@team), id: "assign_projects", class: "bulk_import", method: :post do
+ %table#projects_list
+ %thead
+ %tr
+ %th Project name
+ %th Max access
+ %th
+ - @team.projects.each do |project|
+ %tr.project
+ %td
+ = link_to project.name_with_namespace, team_project_path(@team, project)
+ %td
+ %span= @team.human_max_project_access(project)
+ %td
+ %tr
+ %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'
+ %td= select_tag :greatest_project_access, options_for_select(UserTeam.access_roles), {class: "project-access-select chosen span3" }
+ %td= submit_tag 'Add', class: "btn primary", id: :assign_projects_to_team
diff --git a/app/views/teams/projects/show.html.haml b/app/views/teams/projects/show.html.haml
deleted file mode 100644
index 66c9f0671ff..00000000000
--- a/app/views/teams/projects/show.html.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-= render "teams/team_head"
-
-%h1 Teams::Projects#edit
-%p Find me in app/views/teams/projects/edit.html.haml
diff --git a/app/views/teams/search.html.haml b/app/views/teams/search.html.haml
index 601f2d57c8b..5c357c5cfcb 100644
--- a/app/views/teams/search.html.haml
+++ b/app/views/teams/search.html.haml
@@ -1,6 +1,6 @@
= render "team_head"
-= form_tag search_team_path(@user_team), method: :get, class: 'form-inline' do |f|
+= form_tag search_team_path(@team), method: :get, class: 'form-inline' do |f|
.padded
= label_tag :search do
%strong Looking for