BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
81ac42bd
Commit
81ac42bd
authored
Apr 04, 2017
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '29432-prevent-click-disabled-btn' into 'master'
Prevent clicking on disabled button Closes #29432 See merge request !9931
parents
0a4b853f
e71a6c90
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
29 deletions
+18
-29
projects.scss
app/assets/stylesheets/pages/projects.scss
+2
-9
new.html.haml
app/views/projects/new.html.haml
+10
-14
29432-prevent-click-disabled-btn.yml
changelogs/unreleased/29432-prevent-click-disabled-btn.yml
+4
-0
import_file_spec.rb
spec/features/projects/import_export/import_file_spec.rb
+2
-6
No files found.
app/assets/stylesheets/pages/projects.scss
View file @
81ac42bd
...
...
@@ -459,20 +459,13 @@ a.deploy-project-label {
flex-wrap
:
wrap
;
.btn
{
margin
:
0
10px
10px
0
;
padding
:
8px
;
margin-left
:
10px
;
}
>
div
{
margin-bottom
:
10px
;
padding-left
:
0
;
&
:last-child
{
margin-bottom
:
0
;
.btn
{
margin-right
:
0
;
}
}
}
}
}
...
...
app/views/projects/new.html.haml
View file @
81ac42bd
...
...
@@ -78,7 +78,7 @@
-
if
git_import_enabled?
%button
.btn.js-toggle-button.import_git
{
type:
"button"
}
=
icon
(
'git'
,
text:
'Repo by URL'
)
.import_gitlab_project
.import_gitlab_project
.has-tooltip
{
data:
{
container:
'body'
}
}
-
if
gitlab_project_import_enabled?
=
link_to
new_import_gitlab_project_path
,
class:
'btn btn_import_gitlab_project project-submit'
do
=
icon
(
'gitlab'
,
text:
'GitLab export'
)
...
...
@@ -109,6 +109,9 @@
%p
Please wait a moment, this page will automatically refresh when ready.
:javascript
var
importBtnTooltip
=
"Please enter a valid project name."
;
var
$importBtnWrapper
=
$
(
'.import_gitlab_project'
);
$
(
'.how_to_import_link'
).
bind
(
'click'
,
function
(
e
)
{
e
.
preventDefault
();
var
import_modal
=
$
(
this
).
next
(
".modal"
).
show
();
...
...
@@ -123,15 +126,8 @@
$
(
".btn_import_gitlab_project"
).
attr
(
"href"
,
_href
+
'?namespace_id='
+
$
(
"#project_namespace_id"
).
val
()
+
'&path='
+
$
(
"#project_path"
).
val
());
});
$
(
'.btn_import_gitlab_project'
).
attr
(
'disabled'
,
true
)
$
(
'.import_gitlab_project'
).
attr
(
'title'
,
'Project path and name required.'
);
$
(
'.import_gitlab_project'
).
click
(
function
(
event
)
{
if
(
$
(
'.btn_import_gitlab_project'
).
attr
(
'disabled'
))
{
event
.
preventDefault
();
new
Flash
(
"Please enter path and name for the project to be imported to."
);
}
});
$
(
'.btn_import_gitlab_project'
).
attr
(
'disabled'
,
$
(
'#project_path'
).
val
().
trim
().
length
===
0
);
$importBtnWrapper
.
attr
(
'title'
,
importBtnTooltip
);
$
(
'#new_project'
).
submit
(
function
(){
var
$path
=
$
(
'#project_path'
);
...
...
@@ -139,13 +135,13 @@
});
$
(
'#project_path'
).
keyup
(
function
(){
if
(
$
(
this
).
val
().
length
!=
0
)
{
if
(
$
(
this
).
val
().
trim
().
length
!==
0
)
{
$
(
'.btn_import_gitlab_project'
).
attr
(
'disabled'
,
false
);
$
(
'.import_gitlab_project'
)
.
attr
(
'title'
,
''
);
$
(
".flash-container"
).
html
(
""
)
$
importBtnWrapper
.
attr
(
'title'
,
''
);
$
importBtnWrapper
.
removeClass
(
'has-tooltip'
);
}
else
{
$
(
'.btn_import_gitlab_project'
).
attr
(
'disabled'
,
true
);
$
(
'.import_gitlab_project'
).
attr
(
'title'
,
'Project path and name required.
'
);
$
importBtnWrapper
.
addClass
(
'has-tooltip
'
);
}
});
...
...
changelogs/unreleased/29432-prevent-click-disabled-btn.yml
0 → 100644
View file @
81ac42bd
---
title
:
Fix project title validation, prevent clicking on disabled button
merge_request
:
9931
author
:
spec/features/projects/import_export/import_file_spec.rb
View file @
81ac42bd
...
...
@@ -69,12 +69,8 @@ feature 'Import/Export - project import integration test', feature: true, js: tr
select2
(
namespace
.
id
,
from:
'#project_namespace_id'
)
# click on disabled element
find
(
:link
,
'GitLab export'
).
trigger
(
'click'
)
page
.
within
(
'.flash-container'
)
do
expect
(
page
).
to
have_content
(
'Please enter path and name'
)
end
# Check for tooltip disabled import button
expect
(
find
(
'.import_gitlab_project'
)[
'title'
]).
to
eq
(
'Please enter a valid project name.'
)
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment