Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
84a8b29f
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,发现更多精彩内容 >>
提交
84a8b29f
编写于
4月 06, 2014
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'jacob-carlborg-remove_source_branch_button'
上级
2ceef769
1a17289b
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
48 addition
and
5 deletion
+48
-5
app/assets/javascripts/merge_request.js.coffee
app/assets/javascripts/merge_request.js.coffee
+12
-0
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+16
-5
app/views/projects/merge_requests/_show.html.haml
app/views/projects/merge_requests/_show.html.haml
+1
-0
app/views/projects/merge_requests/show/_remove_source_branch.html.haml
...jects/merge_requests/show/_remove_source_branch.html.haml
+19
-0
未找到文件。
app/assets/javascripts/merge_request.js.coffee
浏览文件 @
84a8b29f
...
...
@@ -58,6 +58,18 @@ class MergeRequest
$
(
'.automerge_widget.can_be_merged'
).
hide
()
$
(
'.merge-in-progress'
).
show
()
this
.
$
(
'.remove_source_branch'
).
on
'click'
,
->
$
(
'.remove_source_branch_widget'
).
hide
()
$
(
'.remove_source_branch_in_progress'
).
show
()
this
.
$
(
".remove_source_branch"
).
on
"ajax:success"
,
(
e
,
data
,
status
,
xhr
)
->
location
.
reload
()
this
.
$
(
".remove_source_branch"
).
on
"ajax:error"
,
(
e
,
data
,
status
,
xhr
)
=>
this
.
$
(
'.remove_source_branch_widget'
).
hide
()
this
.
$
(
'.remove_source_branch_in_progress'
).
hide
()
this
.
$
(
'.remove_source_branch_widget.failed'
).
show
()
activateTab
:
(
action
)
->
this
.
$
(
'.nav-tabs li'
).
removeClass
'active'
this
.
$
(
'.tab-content'
).
hide
()
...
...
app/controllers/projects/merge_requests_controller.rb
浏览文件 @
84a8b29f
...
...
@@ -211,9 +211,25 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request_diff
=
@merge_request
.
merge_request_diff
@allowed_to_merge
=
allowed_to_merge?
@show_merge_controls
=
@merge_request
.
open?
&&
@commits
.
any?
&&
@allowed_to_merge
@allowed_to_remove_source_branch
=
allowed_to_remove_source_branch?
@source_branch
=
@merge_request
.
source_project
.
repository
.
find_branch
(
@merge_request
.
source_branch
).
try
(
:name
)
end
def
allowed_to_merge?
allowed_to_push_code?
(
project
)
end
def
invalid_mr
# Render special view for MR with removed source or target branch
render
'invalid'
end
def
allowed_to_remove_source_branch?
allowed_to_push_code?
(
@merge_request
.
source_project
)
&&
!
@merge_request
.
disallow_source_branch_removal?
end
def
allowed_to_push_code?
(
project
)
action
=
if
project
.
protected_branch?
(
@merge_request
.
target_branch
)
:push_code_to_protected_branches
else
...
...
@@ -222,9 +238,4 @@ class Projects::MergeRequestsController < Projects::ApplicationController
can?
(
current_user
,
action
,
@project
)
end
def
invalid_mr
# Render special view for MR with removed source or target branch
render
'invalid'
end
end
app/views/projects/merge_requests/_show.html.haml
浏览文件 @
84a8b29f
...
...
@@ -7,6 +7,7 @@
=
render
"projects/merge_requests/show/mr_accept"
-
else
=
render
"projects/merge_requests/show/no_accept"
=
render
"projects/merge_requests/show/remove_source_branch"
-
if
@merge_request
.
source_project
.
gitlab_ci?
=
render
"projects/merge_requests/show/mr_ci"
=
render
"projects/merge_requests/show/commits"
...
...
app/views/projects/merge_requests/show/_remove_source_branch.html.haml
0 → 100644
浏览文件 @
84a8b29f
-
if
@source_branch
.
blank?
.bs-callout.bs-callout-info
Source branch has been removed
-
elsif
@allowed_to_remove_source_branch
&&
@merge_request
.
merged?
.remove_source_branch_widget
.alert.alert-info
=
link_to
project_branch_path
(
@merge_request
.
source_project
,
@source_branch
),
remote:
true
,
method: :delete
,
class:
"btn btn-primary remove_source_branch"
do
%i
.icon-remove
Remove Source Branch
.remove_source_branch_widget.failed.hide
.alert.alert-error
Failed to remove source branch '
#{
@merge_request
.
source_branch
}
'
.remove_source_branch_in_progress.hide
.bs-callout.bs-callout-info
%i
.icon-refresh.icon-spin
Removing source branch '
#{
@merge_request
.
source_branch
}
'. Please wait. Page will be automatically reloaded.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录