summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlfredo Sumaran <alfredo@gitlab.com>2017-04-04 18:17:06 +0000
committerAlfredo Sumaran <alfredo@gitlab.com>2017-04-04 18:17:06 +0000
commit81ac42bd5b1506b82628d7b07a886de4f2f38bfa (patch)
tree6fe9a139ed22c68fe78a7102820c1916f438dc8c /app
parent0a4b853f2ceb0ad6c7394d1056f9139e53b38688 (diff)
parente71a6c90d7e3b7a32bd2535b570d949d6abac61d (diff)
downloadgitlab-ce-81ac42bd5b1506b82628d7b07a886de4f2f38bfa.tar.gz
Merge branch '29432-prevent-click-disabled-btn' into 'master'
Prevent clicking on disabled button Closes #29432 See merge request !9931
Diffstat (limited to 'app')
-rw-r--r--app/assets/stylesheets/pages/projects.scss11
-rw-r--r--app/views/projects/new.html.haml24
2 files changed, 12 insertions, 23 deletions
diff --git a/app/assets/stylesheets/pages/projects.scss b/app/assets/stylesheets/pages/projects.scss
index c2c2f371b87..0fa1f68e034 100644
--- a/app/assets/stylesheets/pages/projects.scss
+++ b/app/assets/stylesheets/pages/projects.scss
@@ -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;
- }
- }
}
}
}
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index 09ac1fd6794..0c7b53e5a9a 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -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');
}
});