Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
cbe9f56a
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,体验更适合开发者的 AI 搜索 >>
提交
cbe9f56a
编写于
7月 17, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ability to create new branch via UI
上级
d65eb22e
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
47 addition
and
4 deletion
+47
-4
app/controllers/projects/branches_controller.rb
app/controllers/projects/branches_controller.rb
+4
-2
app/models/repository.rb
app/models/repository.rb
+10
-0
app/views/projects/branches/new.html.haml
app/views/projects/branches/new.html.haml
+24
-0
app/views/projects/repositories/_filter.html.haml
app/views/projects/repositories/_filter.html.haml
+7
-0
config/routes.rb
config/routes.rb
+2
-2
未找到文件。
app/controllers/projects/branches_controller.rb
浏览文件 @
cbe9f56a
...
...
@@ -10,7 +10,9 @@ class Projects::BranchesController < Projects::ApplicationController
end
def
create
# TODO: implement
@project
.
repository
.
add_branch
(
params
[
:branch_name
],
params
[
:ref
])
redirect_to
project_branches_path
(
@project
)
end
def
destroy
...
...
@@ -21,7 +23,7 @@ class Projects::BranchesController < Projects::ApplicationController
end
respond_to
do
|
format
|
format
.
html
{
redirect_to
project_branches_path
}
format
.
html
{
redirect_to
project_branches_path
(
@project
)
}
format
.
js
{
render
nothing:
true
}
end
end
...
...
app/models/repository.rb
浏览文件 @
cbe9f56a
...
...
@@ -35,11 +35,21 @@ class Repository
commits
end
def
add_branch
(
branch_name
,
ref
)
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
gitlab_shell
.
add_branch
(
path_with_namespace
,
branch_name
,
ref
)
end
def
rm_branch
(
branch_name
)
Rails
.
cache
.
delete
(
cache_key
(
:branch_names
))
gitlab_shell
.
rm_branch
(
path_with_namespace
,
branch_name
)
end
def
rm_tag
(
tag_name
)
Rails
.
cache
.
delete
(
cache_key
(
:tag_names
))
gitlab_shell
.
rm_tag
(
path_with_namespace
,
tag_name
)
end
...
...
app/views/projects/branches/new.html.haml
0 → 100644
浏览文件 @
cbe9f56a
%h3
.page-title
%i
.icon-code-fork
New branch
=
form_tag
project_branches_path
,
method: :post
do
.control-group
=
label_tag
:branch_name
,
'Name for new branch'
,
class:
'control-label'
.controls
=
text_field_tag
:branch_name
,
nil
,
placeholder:
'feature/dashboard'
.control-group
=
label_tag
:ref
,
'Create from'
,
class:
'control-label'
.controls
=
text_field_tag
:ref
,
nil
,
placeholder:
'master'
.light
branch name or commit SHA
.form-actions
=
submit_tag
'Create branch'
,
class:
'btn btn-create'
=
link_to
'Cancel'
,
project_branches_path
(
@project
),
class:
'btn btn-cancel'
:javascript
var
availableTags
=
#{
@project
.
repository
.
ref_names
.
to_json
}
;
$
(
"
#ref
"
).
autocomplete
({
source
:
availableTags
,
minLength
:
1
});
app/views/projects/repositories/_filter.html.haml
浏览文件 @
cbe9f56a
...
...
@@ -7,3 +7,10 @@
%i
.icon-lock
=
nav_link
(
path:
'branches#index'
)
do
=
link_to
'All branches'
,
project_branches_path
(
@project
)
%hr
=
link_to
new_project_branch_path
(
@project
),
class:
'btn btn-create'
do
%i
.icon-add-sign
New branch
config/routes.rb
浏览文件 @
cbe9f56a
...
...
@@ -223,8 +223,8 @@ Gitlab::Application.routes.draw do
end
end
resources
:tags
,
only:
[
:index
,
:create
,
:destroy
]
resources
:branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:tags
,
only:
[
:index
,
:
new
,
:
create
,
:destroy
]
resources
:branches
,
only:
[
:index
,
:
new
,
:
create
,
:destroy
]
resources
:protected_branches
,
only:
[
:index
,
:create
,
:destroy
]
resources
:refs
,
only:
[]
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录