Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
8bf8c70c
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,发现更多精彩内容 >>
提交
8bf8c70c
编写于
2月 11, 2013
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Import repo feature
上级
ab0cfc00
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
5 deletion
+40
-5
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+4
-0
app/assets/stylesheets/common.scss
app/assets/stylesheets/common.scss
+4
-0
app/contexts/projects/create_context.rb
app/contexts/projects/create_context.rb
+12
-2
app/models/project.rb
app/models/project.rb
+6
-3
app/views/projects/_new_form.html.haml
app/views/projects/_new_form.html.haml
+14
-0
未找到文件。
app/assets/javascripts/main.js.coffee
浏览文件 @
8bf8c70c
...
...
@@ -36,6 +36,10 @@ $ ->
# Click a .one_click_select field, select the contents
$
(
".one_click_select"
).
on
'click'
,
->
$
(
@
).
select
()
# Click a .appear-link, appear-data fadeout
$
(
".appear-link"
).
on
'click'
,
->
$
(
'.appear-data'
).
fadeIn
()
# Initialize chosen selects
$
(
'select.chosen'
).
chosen
()
...
...
app/assets/stylesheets/common.scss
浏览文件 @
8bf8c70c
...
...
@@ -564,3 +564,7 @@ img.emoji {
vertical-align
:
middle
;
width
:
20px
;
}
.appear-data
{
display
:
none
;
}
app/contexts/projects/create_context.rb
浏览文件 @
8bf8c70c
...
...
@@ -34,13 +34,23 @@ module Projects
@project
.
creator
=
current_user
# Import project from cloneable resource
if
@project
.
valid?
&&
@project
.
import_url
.
present?
shell
=
Gitlab
::
Shell
.
new
if
shell
.
import_repository
(
@project
.
path_with_namespace
,
@project
.
import_url
)
true
else
@project
.
errors
.
add
(
:import_url
,
'cannot clone repo'
)
end
end
if
@project
.
save
@project
.
users_projects
.
create
(
project_access:
UsersProject
::
MASTER
,
user:
current_user
)
end
@project
rescue
=>
ex
@project
.
errors
.
add
(
:base
,
"Can't save project. Please try again later"
)
#
rescue => ex
#
@project.errors.add(:base, "Can't save project. Please try again later")
@project
end
...
...
app/models/project.rb
浏览文件 @
8bf8c70c
...
...
@@ -25,12 +25,13 @@ class Project < ActiveRecord::Base
class
TransferError
<
StandardError
;
end
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
:public
,
as:
[
:default
,
:admin
]
attr_accessible
:name
,
:path
,
:description
,
:default_branch
,
:issues_enabled
,
:wall_enabled
,
:merge_requests_enabled
,
:wiki_enabled
,
:public
,
:import_url
,
as:
[
:default
,
:admin
]
attr_accessible
:namespace_id
,
:creator_id
,
as: :admin
attr_accessor
:
error_code
attr_accessor
:
import_url
# Relations
belongs_to
:creator
,
foreign_key:
"creator_id"
,
class_name:
"User"
...
...
@@ -75,6 +76,8 @@ class Project < ActiveRecord::Base
validates_uniqueness_of
:name
,
scope: :namespace_id
validates_uniqueness_of
:path
,
scope: :namespace_id
validates
:import_url
,
format:
{
with:
URI
::
regexp
(
%w(http https)
),
message:
"should be a valid url"
}
validate
:check_limit
,
:repo_name
# Scopes
...
...
app/views/projects/_new_form.html.haml
浏览文件 @
8bf8c70c
...
...
@@ -16,6 +16,20 @@
.input
=
f
.
select
:namespace_id
,
namespaces_options
(
params
[
:namespace_id
]
||
:current_user
),
{},
{
class:
'chosen'
}
.clearfix
.input
=
link_to
"#"
,
class:
'appear-link'
do
%i
.icon-upload-alt
%span
Import existing repository?
.clearfix.appear-data
=
f
.
label
:import_url
do
%span
Import existing repo
.input
=
f
.
text_field
:import_url
,
class:
'xlarge'
.light
URL should be clonable
%p
.padded
New projects are private by default. You choose who can see the project and commit to repository.
%hr
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录