Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
2aacb7fb
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 搜索 >>
提交
2aacb7fb
编写于
2月 14, 2018
作者:
E
Eric Eastwood
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make import tab/form active when importing project by URL and validation fails
See
https://gitlab.com/gitlab-org/gitlab-ce/issues/43261
上级
088d03bf
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
28 addition
and
9 deletion
+28
-9
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/views/projects/new.html.haml
app/views/projects/new.html.haml
+8
-7
changelogs/unreleased/43261-fix-import-from-url-name-collision-active-tab.yml
...d/43261-fix-import-from-url-name-collision-active-tab.yml
+6
-0
spec/features/projects/new_project_spec.rb
spec/features/projects/new_project_spec.rb
+13
-1
未找到文件。
app/controllers/projects_controller.rb
浏览文件 @
2aacb7fb
...
...
@@ -45,7 +45,7 @@ class ProjectsController < Projects::ApplicationController
notice:
_
(
"Project '%{project_name}' was successfully created."
)
%
{
project_name:
@project
.
name
}
)
else
render
'new'
render
'new'
,
locals:
{
active_tab:
(
'import'
if
project_params
[
:import_url
].
present?
)
}
end
end
...
...
app/views/projects/new.html.haml
浏览文件 @
2aacb7fb
...
...
@@ -4,6 +4,7 @@
-
page_title
'New Project'
-
header_title
"Projects"
,
dashboard_projects_path
-
visibility_level
=
params
.
dig
(
:project
,
:visibility_level
)
||
default_project_visibility
-
active_tab
=
local_assigns
.
fetch
(
:active_tab
,
'blank'
)
.project-edit-container
.project-edit-errors
...
...
@@ -20,32 +21,32 @@
=
brand_new_project_guidelines
.col-lg-9.js-toggle-container
%ul
.nav-links.gitlab-tabs
{
role:
'tablist'
}
%li
.active
{
role:
'presentation'
}
%li
{
class:
(
'active'
if
active_tab
==
'blank'
),
role:
'presentation'
}
%a
{
href:
'#blank-project-pane'
,
id:
'blank-project-tab'
,
data:
{
toggle:
'tab'
},
role:
'tab'
}
%span
.hidden-xs
Blank project
%span
.visible-xs
Blank
%li
{
role:
'presentation'
}
%li
{
class:
(
'active'
if
active_tab
==
'template'
),
role:
'presentation'
}
%a
{
href:
'#create-from-template-pane'
,
id:
'create-from-template-tab'
,
data:
{
toggle:
'tab'
},
role:
'tab'
}
%span
.hidden-xs
Create from template
%span
.visible-xs
Template
%li
{
role:
'presentation'
}
%li
{
class:
(
'active'
if
active_tab
==
'import'
),
role:
'presentation'
}
%a
{
href:
'#import-project-pane'
,
id:
'import-project-tab'
,
data:
{
toggle:
'tab'
},
role:
'tab'
}
%span
.hidden-xs
Import project
%span
.visible-xs
Import
.tab-content.gitlab-tab-content
.tab-pane
.active
{
id:
'blank-project-pane'
,
role:
'tabpanel'
}
.tab-pane
{
id:
'blank-project-pane'
,
class:
(
'active'
if
active_tab
==
'blank'
)
,
role:
'tabpanel'
}
=
form_for
@project
,
html:
{
class:
'new_project'
}
do
|
f
|
=
render
'new_project_fields'
,
f:
f
,
project_name_id:
"blank-project-name"
.tab-pane.no-padding
{
id:
'create-from-template-pane'
,
role:
'tabpanel'
}
.tab-pane.no-padding
{
id:
'create-from-template-pane'
,
class:
(
'active'
if
active_tab
==
'template'
),
role:
'tabpanel'
}
=
form_for
@project
,
html:
{
class:
'new_project'
}
do
|
f
|
.project-template
.form-group
%div
=
render
'project_templates'
,
f:
f
.tab-pane.import-project-pane
{
id:
'import-project-pane'
,
role:
'tabpanel'
}
.tab-pane.import-project-pane
{
id:
'import-project-pane'
,
class:
(
'active'
if
active_tab
==
'import'
),
role:
'tabpanel'
}
=
form_for
@project
,
html:
{
class:
'new_project'
}
do
|
f
|
-
if
import_sources_enabled?
.project-import.row
...
...
@@ -92,7 +93,7 @@
%button
.btn.js-toggle-button.import_git
{
type:
"button"
}
=
icon
(
'git'
,
text:
'Repo by URL'
)
.col-lg-12
.js-toggle-content.
hide.toggle-import-form
.js-toggle-content.
toggle-import-form
{
class:
(
'hide'
if
active_tab
!=
'import'
)
}
%hr
=
render
"shared/import_form"
,
f:
f
=
render
'new_project_fields'
,
f:
f
,
project_name_id:
"import-url-name"
...
...
changelogs/unreleased/43261-fix-import-from-url-name-collision-active-tab.yml
0 → 100644
浏览文件 @
2aacb7fb
---
title
:
Keep "Import project" tab/form active when validation fails trying to import
"Repo by URL"
merge_request
:
17136
author
:
type
:
fixed
spec/features/projects/new_project_spec.rb
浏览文件 @
2aacb7fb
...
...
@@ -140,7 +140,7 @@ feature 'New project' do
find
(
'#import-project-tab'
).
click
end
context
'from git repository url'
do
context
'from git repository url
, "Repo by URL"
'
do
before
do
first
(
'.import_git'
).
click
end
...
...
@@ -157,6 +157,18 @@ feature 'New project' do
expect
(
git_import_instructions
).
to
be_visible
expect
(
git_import_instructions
).
to
have_content
'Git repository URL'
end
it
'keeps "Import project" tab open after form validation error'
do
collision_project
=
create
(
:project
,
name:
'test-name-collision'
,
namespace:
user
.
namespace
)
fill_in
'project_import_url'
,
with:
collision_project
.
http_url_to_repo
fill_in
'project_path'
,
with:
collision_project
.
path
click_on
'Create project'
expect
(
page
).
to
have_css
(
'#import-project-pane.active'
)
expect
(
page
).
not_to
have_css
(
'.toggle-import-form.hide'
)
end
end
context
'from GitHub'
do
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录