Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
e940fbc7
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e940fbc7
编写于
6月 17, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add UsersGroup relation to be respected by abilities and Project#team
上级
fa877b63
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
55 addition
and
27 deletion
+55
-27
app/controllers/groups_controller.rb
app/controllers/groups_controller.rb
+2
-2
app/models/ability.rb
app/models/ability.rb
+4
-0
app/models/project_team.rb
app/models/project_team.rb
+19
-5
app/models/users_group.rb
app/models/users_group.rb
+1
-1
app/models/users_project.rb
app/models/users_project.rb
+1
-3
app/services/system_hooks_service.rb
app/services/system_hooks_service.rb
+1
-1
app/views/groups/_new_group_member.html.haml
app/views/groups/_new_group_member.html.haml
+2
-2
app/views/groups/_new_member.html.haml
app/views/groups/_new_member.html.haml
+3
-3
app/views/groups/_people_filter.html.haml
app/views/groups/_people_filter.html.haml
+10
-4
app/views/groups/people.html.haml
app/views/groups/people.html.haml
+12
-6
未找到文件。
app/controllers/groups_controller.rb
浏览文件 @
e940fbc7
...
...
@@ -64,11 +64,11 @@ class GroupsController < ApplicationController
def
people
@project
=
group
.
projects
.
find
(
params
[
:project_id
])
if
params
[
:project_id
]
@users_groups
=
group
.
users_groups
if
@project
@members
=
@project
.
users_projects
@team_member
=
@project
.
users_projects
.
new
else
@members
=
group
.
users_groups
@team_member
=
UsersGroup
.
new
end
end
...
...
app/models/ability.rb
浏览文件 @
e940fbc7
...
...
@@ -50,6 +50,10 @@ class Ability
rules
<<
project_admin_rules
end
if
project
.
group
&&
project
.
group
.
owners
.
include?
(
user
)
rules
<<
project_admin_rules
end
rules
.
flatten
end
...
...
app/models/project_team.rb
浏览文件 @
e940fbc7
...
...
@@ -47,23 +47,23 @@ class ProjectTeam
end
def
members
project
.
users_project
s
fetch_member
s
end
def
guests
members
.
guests
.
map
(
&
:user
)
@guests
||=
fetch_members
(
:guests
)
end
def
reporters
members
.
reporters
.
map
(
&
:user
)
@reporters
||=
fetch_members
(
:reporters
)
end
def
developers
members
.
developers
.
map
(
&
:user
)
@developers
||=
fetch_members
(
:developers
)
end
def
masters
members
.
masters
.
map
(
&
:user
)
@masters
||=
fetch_members
(
:masters
)
end
def
import
(
source_project
)
...
...
@@ -96,4 +96,18 @@ class ProjectTeam
rescue
false
end
private
def
fetch_members
(
level
=
nil
)
project_members
=
project
.
users_projects
group_members
=
project
.
group
.
users_groups
if
level
project_members
=
project_members
.
send
(
level
)
group_members
=
group_members
.
send
(
level
)
end
(
project_members
+
group_members
).
map
(
&
:user
).
uniq
end
end
app/models/users_group.rb
浏览文件 @
e940fbc7
...
...
@@ -35,7 +35,7 @@ class UsersGroup < ActiveRecord::Base
delegate
:name
,
:username
,
:email
,
to: :user
,
prefix:
true
def
human_
group_
access
def
human_access
UsersGroup
.
group_access_roles
.
index
(
self
.
group_access
)
end
end
app/models/users_project.rb
浏览文件 @
e940fbc7
...
...
@@ -129,9 +129,7 @@ class UsersProject < ActiveRecord::Base
Project
.
access_options
.
key
(
self
.
project_access
)
end
def
repo_access_human
self
.
class
.
access_roles
.
invert
[
self
.
project_access
]
end
alias_method
:human_access
,
:project_access_human
def
skip_git?
!!
@skip_git
...
...
app/services/system_hooks_service.rb
浏览文件 @
e940fbc7
...
...
@@ -43,7 +43,7 @@ class SystemHooksService
project_id:
model
.
project_id
,
user_name:
model
.
user
.
name
,
user_email:
model
.
user
.
email
,
project_access:
model
.
repo
_access_human
project_access:
model
.
project
_access_human
})
end
end
...
...
app/views/groups/_new_group_member.html.haml
浏览文件 @
e940fbc7
=
form_for
@team_member
,
as: :team_member
,
url:
team_members_group_path
(
@group
)
do
|
f
|
%fieldset
%legend
=
"New
Team member(s) for projects in
#{
@group
.
name
}
"
%legend
=
"New
Group member(s) for
#{
@group
.
name
}
"
%h6
1. Choose people you want in the
team
%h6
1. Choose people you want in the
group
.clearfix
=
f
.
label
:user_ids
,
"People"
.input
=
users_select_tag
(
:user_ids
,
multiple:
true
)
...
...
app/views/groups/_new_member.html.haml
浏览文件 @
e940fbc7
=
form_for
@team_member
,
as: :team_member
,
url:
project_team_members_path
(
@project
,
@team_member
)
do
|
f
|
%fieldset
%legend
=
"New
Team
member(s) for
#{
@project
.
name
}
"
%legend
=
"New
Project
member(s) for
#{
@project
.
name
}
"
%h6
1. Choose people you want in the
team
%h6
1. Choose people you want in the
project
.clearfix
=
f
.
label
:user_ids
,
"People"
.input
=
users_select_tag
(
:user_ids
,
multiple:
true
)
...
...
@@ -14,5 +14,5 @@
.form-actions
=
hidden_field_tag
:redirect_to
,
people_group_path
(
@group
,
project_id:
@project
.
id
)
=
f
.
submit
'Add
'
,
class:
"btn btn-sav
e"
=
f
.
submit
'Add
users into project'
,
class:
"btn btn-creat
e"
app/views/groups/_people_filter.html.haml
浏览文件 @
e940fbc7
%fieldset
%legend
Group members:
%ul
.nav.nav-pills.nav-stacked
%li
{
class:
(
"active"
if
params
[
:project_id
].
blank?
)}
=
link_to
people_group_path
(
@group
)
do
#{
@group
.
name
}
Group
%small
.pull-right
=
@group
.
users
.
count
=
form_tag
people_group_path
(
@group
),
method:
'get'
do
%fieldset
%legend
Projects:
%legend
Project
member
s:
%ul
.nav.nav-pills.nav-stacked
-
@projects
.
each
do
|
project
|
%li
{
class:
(
"active"
if
params
[
:project_id
]
==
project
.
id
.
to_s
)}
...
...
@@ -10,7 +19,4 @@
-
if
@projects
.
blank?
%p
.nothing_here_message
This group has no projects yet
%fieldset
%hr
=
link_to
"Reset"
,
people_group_path
(
@group
),
class:
'btn pull-right'
app/views/groups/people.html.haml
浏览文件 @
e940fbc7
...
...
@@ -6,12 +6,18 @@
=
render
(
@project
?
"new_member"
:
"new_group_member"
)
.ui-box
%h5
.title
#{
@group
.
name
}
Team
-
if
@project
#{
@project
.
name
}
Project Members
%small
(
#{
@users_groups
.
count
}
)
(
#{
@members
.
count
}
)
-
else
#{
@group
.
name
}
Group Members
%small
(
#{
@members
.
count
}
)
%ul
.well-list
-
@users_groups
.
each
do
|
users_group
|
-
user
=
users_group
.
user
-
@members
.
each
do
|
member
|
-
user
=
member
.
user
-
next
unless
user
%li
=
image_tag
gravatar_icon
(
user
.
email
,
16
),
class:
"avatar s16"
%strong
=
user
.
name
...
...
@@ -21,5 +27,5 @@
-
if
@group
.
owners
.
include?
(
user
)
%span
.label.label-info
Group Owner
-
else
=
users_group
.
human_group
_access
=
member
.
human
_access
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录