Skip to content
Snippets Groups Projects
Commit 18bd1c9d authored by Andrey Kumanyaev's avatar Andrey Kumanyaev Committed by Dmitriy Zaporozhets
Browse files

update all teams code. refactoring and some corrections

parent 7658f8c1
No related branches found
No related tags found
2 merge requests!2940Expanding repos and hooks paths in settings,!2746New feature: Teams
Showing
with 152 additions and 75 deletions
- 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
Loading
Loading
@@ -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
Loading
Loading
@@ -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
- 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
Loading
Loading
%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'
= 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"
= render "teams/team_head"
%h3.page_title
Team Members
(#{@members.count})
Loading
Loading
@@ -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}
= 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
= render "teams/team_head"
- allow_admin = can? current_user, :admin_project, @project
- user = @team_member.user
 
Loading
Loading
= render "team_head"
%h3.page_title
Merge Requests
%small (authored by or assigned to Team members)
Loading
Loading
Loading
Loading
@@ -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
= 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"
= 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'
= 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"
= 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
= render "teams/team_head"
%h1 Teams::Projects#edit
%p Find me in app/views/teams/projects/edit.html.haml
= 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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment