Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
6c47bcef
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,发现更多精彩内容 >>
提交
6c47bcef
编写于
12月 13, 2011
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'refactor_merge_requests'
上级
713802fd
e8860594
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
258 addition
and
122 deletion
+258
-122
app/assets/images/.directory
app/assets/images/.directory
+1
-1
app/assets/javascripts/merge_requests.js
app/assets/javascripts/merge_requests.js
+59
-0
app/assets/stylesheets/projects.css.scss
app/assets/stylesheets/projects.css.scss
+79
-36
app/assets/stylesheets/style.scss
app/assets/stylesheets/style.scss
+1
-1
app/controllers/merge_requests_controller.rb
app/controllers/merge_requests_controller.rb
+0
-3
app/models/project.rb
app/models/project.rb
+4
-0
app/views/merge_requests/_form.html.haml
app/views/merge_requests/_form.html.haml
+45
-30
app/views/merge_requests/_merge_request.html.haml
app/views/merge_requests/_merge_request.html.haml
+1
-1
app/views/merge_requests/commits.js.haml
app/views/merge_requests/commits.js.haml
+4
-0
app/views/merge_requests/diffs.js.haml
app/views/merge_requests/diffs.js.haml
+4
-0
app/views/merge_requests/show.html.haml
app/views/merge_requests/show.html.haml
+56
-46
spec/requests/merge_requests_spec.rb
spec/requests/merge_requests_spec.rb
+3
-3
vendor/assets/stylesheets/jquery-ui/jquery-ui.css
vendor/assets/stylesheets/jquery-ui/jquery-ui.css
+1
-1
未找到文件。
app/assets/images/.directory
浏览文件 @
6c47bcef
[Dolphin]
ShowPreview=true
Timestamp=2011,1
0,28,13,16,25
Timestamp=2011,1
2,13,12,22,12
Version=2
app/assets/javascripts/merge_requests.js
浏览文件 @
6c47bcef
var
MergeRequest
=
{
diffs_loaded
:
false
,
commits_loaded
:
false
,
init
:
function
()
{
$
(
"
.merge-tabs a
"
).
live
(
"
click
"
,
function
()
{
$
(
"
.merge-tabs a
"
).
removeClass
(
"
active
"
);
$
(
this
).
addClass
(
"
active
"
);
});
$
(
"
.merge-tabs a.merge-notes-tab
"
).
live
(
"
click
"
,
function
()
{
$
(
"
.merge-request-commits, .merge-request-diffs
"
).
hide
();
$
(
"
.merge-request-notes
"
).
show
();
});
$
(
"
.merge-tabs a.merge-commits-tab
"
).
live
(
"
click
"
,
function
()
{
if
(
!
MergeRequest
.
commits_loaded
)
{
MergeRequest
.
loadCommits
();
}
$
(
"
.merge-request-notes, .merge-request-diffs
"
).
hide
();
$
(
"
.merge-request-commits
"
).
show
();
});
$
(
"
.merge-tabs a.merge-diffs-tab
"
).
live
(
"
click
"
,
function
()
{
if
(
!
MergeRequest
.
diffs_loaded
)
{
MergeRequest
.
loadDiff
();
}
$
(
"
.merge-request-notes, .merge-request-commits
"
).
hide
();
$
(
"
.merge-request-diffs
"
).
show
();
});
},
loadCommits
:
function
()
{
$
(
"
.dashboard-loader
"
).
show
();
$
.
ajax
({
type
:
"
GET
"
,
url
:
$
(
"
.merge-commits-tab
"
).
attr
(
"
data-url
"
),
complete
:
function
(){
MergeRequest
.
commits_loaded
=
true
;
$
(
"
.merge-request-notes, .merge-request-diffs
"
).
hide
();
$
(
"
.dashboard-loader
"
).
hide
()},
dataType
:
"
script
"
});
},
loadDiff
:
function
()
{
$
(
"
.dashboard-loader
"
).
show
();
$
.
ajax
({
type
:
"
GET
"
,
url
:
$
(
"
.merge-diffs-tab
"
).
attr
(
"
data-url
"
),
complete
:
function
(){
MergeRequest
.
diffs_loaded
=
true
;
$
(
"
.merge-request-notes, .merge-request-commits
"
).
hide
();
$
(
"
.dashboard-loader
"
).
hide
()},
dataType
:
"
script
"
});
}
}
app/assets/stylesheets/projects.css.scss
浏览文件 @
6c47bcef
...
...
@@ -438,42 +438,6 @@ body.project-page table.no-borders td{
border
:none
;
}
#gitlab-tabs
{
.ui-tabs-nav
{
border-bottom
:
1px
solid
#DEDFE1
;
li
{
background
:
none
;
border
:none
;
font-size
:
16px
;
margin
:
0
;
padding
:
0
;
a
{
margin
:
0
;
padding
:
10px
16px
;
width
:
150px
;
}
&
.ui-tabs-selected
{
background-image
:
-webkit-gradient
(
linear
,
0
0
,
0
26
,
color-stop
(
0
.076
,
#fefefe
)
,
to
(
#F6F7F8
));
background-image
:
-webkit-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
background-image
:
-moz-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
background-image
:
-o-linear-gradient
(
#fefefe
7
.6%
,
#F6F7F8
);
font-weight
:
bold
;
border
:
1px
solid
#DEDFE1
;
border-bottom
:
1px
solid
#DEDFE1
;
-webkit-border-top-left-radius
:
5px
;
-webkit-border-top-right-radius
:
5px
;
-moz-border-radius-topleft
:
5px
;
-moz-border-radius-topright
:
5px
;
border-top-left-radius
:
5px
;
border-top-right-radius
:
5px
;
}
}
}
}
.ajax-tab-loading
{
padding
:
40px
;
display
:none
;
...
...
@@ -587,3 +551,82 @@ h4.middle-panel {
margin-right
:
30px
;
display
:none
;
}
.merge-tabs
{
margin
:
0
;
border
:
1px
solid
#ccc
;
padding
:
5px
;
font-size
:
12px
;
background
:
#F7F7F7
;
margin-bottom
:
20px
;
height
:
26px
;
.tab
{
font-weight
:
bold
;
text-transform
:
uppercase
;
border-right
:
1px
solid
#ddd
;
background
:none
;
padding
:
10px
;
width
:
60px
;
float
:left
;
position
:relative
;
top
:
-5px
;
left
:
-5px
;
height
:
16px
;
padding-left
:
34px
;
span
{
width
:
20px
;
height
:
20px
;
display
:
inline-block
;
position
:
absolute
;
left
:
8px
;
top
:
8px
;
}
&
.active
{
background
:
#eaeaea
;
}
}
}
.merge-notes-tab
span
{
background
:
url("images.png")
no-repeat
-161px
-1px
;
}
.merge-commits-tab
span
{
background
:
url("images.png")
no-repeat
-86px
1px
;
}
.merge-diffs-tab
span
{
background
:
url("images.png")
no-repeat
-118px
1px
;
}
.merge-tabs
.dashboard-loader
{
padding
:
8px
;
}
.user-mention
{
color
:
#2FA0BB
;
font-weight
:
bold
;
}
.author
{
color
:
#999
;
}
.red-button
{
border-radius
:
5px
;
font-size
:
12px
;
font-weight
:
bold
;
padding
:
5px
17px
;
border
:
1px
solid
#999
;
color
:
#666
;
display
:
inline-block
;
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,.
3
);
background
:
#D12F19
;
color
:
white
;
}
.positive-button
{
border-radius
:
5px
;
font-size
:
12px
;
font-weight
:
bold
;
padding
:
5px
17px
;
border
:
1px
solid
#999
;
color
:
#666
;
display
:
inline-block
;
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,.
3
);
background
:
#4A2
;
color
:
white
;
}
app/assets/stylesheets/style.scss
浏览文件 @
6c47bcef
...
...
@@ -130,7 +130,7 @@ table tr:hover, .listed_items tr.odd:hover{background-color:#FFFFCF}
border-radius
:
5px
;
font-size
:
12px
;
font-weight
:
bold
;
padding
:
6px
20
px
;
padding
:
5px
17
px
;
border
:
1px
solid
#999
;
color
:
#666
;
display
:
inline-block
;
...
...
app/controllers/merge_requests_controller.rb
浏览文件 @
6c47bcef
...
...
@@ -30,14 +30,11 @@ class MergeRequestsController < ApplicationController
def
commits
@commits
=
@project
.
repo
.
commits_between
(
@merge_request
.
target_branch
,
@merge_request
.
source_branch
).
map
{
|
c
|
Commit
.
new
(
c
)}
render
:template
=>
"merge_requests/_commits"
,
:layout
=>
false
end
def
diffs
@diffs
=
@merge_request
.
diffs
@commit
=
@merge_request
.
last_commit
render
:template
=>
"merge_requests/_diffs"
,
:layout
=>
false
end
def
new
...
...
app/models/project.rb
浏览文件 @
6c47bcef
...
...
@@ -90,6 +90,10 @@ class Project < ActiveRecord::Base
users_projects
.
find_by_user_id
(
user
.
id
)
if
user
end
def
team_member_by_id
(
user_id
)
users_projects
.
find_by_user_id
(
user_id
)
end
def
fresh_issues
(
n
)
issues
.
includes
(
:project
,
:author
).
order
(
"created_at desc"
).
first
(
n
)
end
...
...
app/views/merge_requests/_form.html.haml
浏览文件 @
6c47bcef
%div
.merge-request-form-holder
.ui-box.width-100p
%h3
=
@merge_request
.
new_record?
?
"New Merge Request"
:
"Edit Merge Request #
#{
@merge_request
.
id
}
"
=
form_for
[
@project
,
@merge_request
]
do
|
f
|
.data
%table
.no-borders
-
if
@merge_request
.
errors
.
any?
%tr
%td
Errors
%td
#error_explanation
-
@merge_request
.
errors
.
full_messages
.
each
do
|
msg
|
%span
=
msg
%br
=
form_for
[
@project
,
@merge_request
]
do
|
f
|
%div
%span
.entity-info
-
if
@merge_request
.
new_record?
=
link_to
project_merge_requests_path
(
@project
)
do
.entity-button
Back
%i
-
else
=
link_to
project_merge_request_path
(
@project
,
@merge_request
)
do
.entity-button
Back
%i
%h2
=
@merge_request
.
new_record?
?
"New Merge Request"
:
"Edit Merge Request #
#{
@merge_request
.
id
}
"
%hr
%table
.no-borders
-
if
@merge_request
.
errors
.
any?
%tr
%td
{
:colspan
=>
2
}
#error_explanation
-
@merge_request
.
errors
.
full_messages
.
each
do
|
msg
|
%span
=
msg
%br
%tr
%td
=
f
.
label
:source_branch
,
"From"
%td
=
f
.
select
(
:source_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
},
:style
=>
"width:250px"
)
%tr
%td
=
f
.
label
:target_branch
,
"To"
%td
=
f
.
select
(
:target_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
},
:style
=>
"width:250px"
)
%tr
%td
=
f
.
label
:assignee_id
,
"Assign to"
%td
=
f
.
select
(
:assignee_id
,
@project
.
users
.
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
},
:style
=>
"width:250px"
)
=
f
.
text_area
:title
,
:style
=>
"width:718px; height:100px"
,
:maxlength
=>
255
%br
%br
.merge-tabs
=
f
.
submit
'Save'
,
:class
=>
"grey-button"
-
unless
@merge_request
.
new_record?
.right
=
link_to
'Remove'
,
[
@project
,
@merge_request
],
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
,
:class
=>
"red-button"
%tr
%td
=
f
.
label
:title
%td
=
f
.
text_field
:title
%tr
%td
=
f
.
label
:source_branch
,
"From"
%td
=
f
.
select
(
:source_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
})
%tr
%td
=
f
.
label
:target_branch
,
"To"
%td
=
f
.
select
(
:target_branch
,
@project
.
heads
.
map
(
&
:name
),
{
:include_blank
=>
"Select branch"
})
%tr
%td
=
f
.
label
:assignee_id
,
"Assign to"
%td
=
f
.
select
(
:assignee_id
,
@project
.
users
.
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
})
.buttons
=
f
.
submit
'Save'
,
:class
=>
"grey-button"
.right
=
link_to
'Back'
,
project_merge_requests_path
(
@project
),
:class
=>
"grey-button"
:javascript
$
(
function
(){
...
...
app/views/merge_requests/_merge_request.html.haml
浏览文件 @
6c47bcef
%a
.update-item
{
:href
=>
project_merge_request_path
(
merge_request
.
project
,
merge_request
)}
=
image_tag
gravatar_icon
(
merge_request
.
author_email
),
:class
=>
"left"
,
:width
=>
40
%span
.update-title
=
merge_request
.
title
=
truncate
(
merge_request
.
title
,
:length
=>
60
)
%span
.update-author
%strong
=
merge_request
.
author_name
authored
...
...
app/views/merge_requests/commits.js.haml
0 → 100644
浏览文件 @
6c47bcef
:plain
$(".merge-request-commits").html("
#{
escape_javascript
(
render
(
:partial
=>
"commits"
))
}
");
app/views/merge_requests/diffs.js.haml
0 → 100644
浏览文件 @
6c47bcef
:plain
$(".merge-request-diffs").html("
#{
escape_javascript
(
render
(
:partial
=>
"diffs"
))
}
");
app/views/merge_requests/show.html.haml
浏览文件 @
6c47bcef
.merge-request-show-holder.ui-box.width-100p
%h3
=
"Merge Request #
#{
@merge_request
.
id
}
:"
.tag.commit.inline
=
@merge_request
.
source_branch
→
.tag.commit.inline
=
@merge_request
.
target_branch
.right
-
if
@merge_request
.
closed
%span
.tag.high
Closed
-
else
%span
.tag.today
Open
.data
%p
=
@merge_request
.
title
-
if
@merge_request
.
author
==
@merge_request
.
assignee
=
image_tag
gravatar_icon
(
@merge_request
.
assignee_email
),
:width
=>
20
,
:style
=>
"padding:0 5px;"
=
@merge_request
.
assignee_name
-
else
=
image_tag
gravatar_icon
(
@merge_request
.
author_email
),
:width
=>
20
,
:style
=>
"padding:0 5px;"
=
@merge_request
.
author_name
%div
%span
.entity-info
-
if
can?
(
current_user
,
:admin_project
,
@project
)
||
@merge_request
.
author
==
current_user
=
link_to
edit_project_merge_request_path
(
@project
,
@merge_request
)
do
.entity-button
Edit Merge Request
%i
=
image_tag
gravatar_icon
(
@merge_request
.
author_email
),
:class
=>
"left"
,
:width
=>
40
,
:style
=>
"padding-right:5px;"
%span
.commit-title
%strong
=
"Merge Request #
#{
@merge_request
.
id
}
:"
.tag.commit.inline
=
@merge_request
.
source_branch
→
=
image_tag
gravatar_icon
(
@merge_request
.
assignee_email
),
:width
=>
20
,
:style
=>
"padding:0 5px;"
=
@merge_request
.
assignee_name
.right
%cite
.cgray
=
@merge_request
.
created_at
.
stamp
(
"21 Aug 2011, 11:15pm"
)
.clear
.tag.commit.inline
=
@merge_request
.
target_branch
%span
.commit-author
%strong
=
link_to
project_team_member_path
(
@project
,
@project
.
team_member_by_id
(
@merge_request
.
author
.
id
))
do
%span
.author
=
@merge_request
.
author_name
→
=
link_to
project_team_member_path
(
@project
,
@project
.
team_member_by_id
(
@merge_request
.
assignee
.
id
))
do
%span
.author
=
@merge_request
.
assignee_name
.buttons
-
if
can?
current_user
,
:write_project
,
@project
-
if
@merge_request
.
closed
=
link_to
'Reopen'
,
project_merge_request_path
(
@project
,
@merge_request
,
:merge_request
=>
{
:closed
=>
false
},
:status_only
=>
true
),
:method
=>
:put
,
:class
=>
"grey-button"
-
else
=
link_to
'Close'
,
project_merge_request_path
(
@project
,
@merge_request
,
:merge_request
=>
{
:closed
=>
true
},
:status_only
=>
true
),
:method
=>
:put
,
:class
=>
"grey-button"
.right
=
link_to
'Edit'
,
edit_project_merge_request_path
(
@project
,
@merge_request
),
:class
=>
"grey-button positive"
=
@merge_request
.
created_at
.
stamp
(
"Aug 21, 2011 9:23pm"
)
%hr
%br
%h3
=
simple_format
@merge_request
.
title
.clear
%br
%br
#gitlab-tabs
%ul
%li
=
link_to
"Notes"
,
"#merge-notes"
%li
=
link_to
"Commits"
,
commits_project_merge_request_path
(
@project
,
@merge_request
)
%li
=
link_to
"Diff"
,
diffs_project_merge_request_path
(
@project
,
@merge_request
)
.merge-tabs
=
link_to
"#notes"
,
:class
=>
"merge-notes-tab active tab"
do
%span
Notes
=
link_to
"#commits"
,
"data-url"
=>
commits_project_merge_request_path
(
@project
,
@merge_request
),
:class
=>
"merge-commits-tab tab"
do
%span
Commits
=
link_to
"#diffs"
,
"data-url"
=>
diffs_project_merge_request_path
(
@project
,
@merge_request
),
:class
=>
"merge-diffs-tab tab"
do
%span
Diff
-
if
can?
(
current_user
,
:admin_project
,
@project
)
||
@merge_request
.
author
==
current_user
.right
-
if
@merge_request
.
closed
=
link_to
'Reopen'
,
project_merge_request_path
(
@project
,
@merge_request
,
:merge_request
=>
{
:closed
=>
false
},
:status_only
=>
true
),
:method
=>
:put
,
:class
=>
"red-button"
-
else
=
link_to
'Close'
,
project_merge_request_path
(
@project
,
@merge_request
,
:merge_request
=>
{
:closed
=>
true
},
:status_only
=>
true
),
:method
=>
:put
,
:class
=>
"positive-button"
,
:title
=>
"Close merge request"
%img
{
:src
=>
"/assets/ajax-loader-facebook.gif"
,
:class
=>
"dashboard-loader"
}
.merge-request-notes
.issue_notes
=
render
"notes/notes"
.loading
{
:style
=>
"display:none;"
}
%center
=
image_tag
"ajax-loader.gif"
.clear
#merge-notes
.issue_notes
=
render
"notes/notes"
.loading
{
:style
=>
"display:none;"
}
%center
=
image_tag
"ajax-loader.gif"
.clear
.merge-request-commits
.merge-request-diffs
:javascript
$
(
function
(){
$
(
"
#gitlab-tabs
"
).
tabs
();
MergeRequest
.
init
();
})
spec/requests/merge_requests_spec.rb
浏览文件 @
6c47bcef
...
...
@@ -42,8 +42,8 @@ describe "MergeRequests" do
it
{
should
have_content
(
@merge_request
.
title
)
}
it
"Show page should inform user that merge request closed"
do
within
".merge-
request-show-holder h3
"
do
page
.
should
have_content
"
Closed
"
within
".merge-
tabs
"
do
page
.
should
have_content
"
Reopen
"
end
end
end
...
...
@@ -62,7 +62,7 @@ describe "MergeRequests" do
it
{
current_path
.
should
==
project_merge_request_path
(
project
,
project
.
merge_requests
.
last
)
}
it
"should create merge request"
do
page
.
should
have_content
"
Open
"
page
.
should
have_content
"
Close
"
page
.
should
have_content
@user
.
name
end
end
...
...
vendor/assets/stylesheets/jquery-ui/jquery-ui.css
浏览文件 @
6c47bcef
/*
* jQuery UI CSS Framework 1.8.16
* jQuery UI CSS Framework 1.8.16
Patched for GitLab HQ
*
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录