summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKushal Pandya <kushal@gitlab.com>2017-03-14 16:51:24 +0530
committerKushal Pandya <kushal@gitlab.com>2017-03-28 10:51:56 +0530
commit576ffef6c1ddff3493099f088a21c867477d9160 (patch)
treefeb496589cbc268c09fd6130ee66817fc4cbaf57
parentd4c99f644a2da2aa340aee8bc10c1dcf7c9e0d18 (diff)
downloadgitlab-ce-576ffef6c1ddff3493099f088a21c867477d9160.tar.gz
Fix project title validation, prevent clicking on disabled button
-rw-r--r--app/views/projects/new.html.haml11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/views/projects/new.html.haml b/app/views/projects/new.html.haml
index 34a1214a350..252929cdb9f 100644
--- a/app/views/projects/new.html.haml
+++ b/app/views/projects/new.html.haml
@@ -123,23 +123,16 @@
$(".btn_import_gitlab_project").attr("href", _href + '?namespace_id=' + $("#project_namespace_id").val() + '&path=' + $("#project_path").val());
});
- $('.btn_import_gitlab_project').attr('disabled',true)
+ $('.btn_import_gitlab_project').attr('disabled', $('#project_path').val().trim().length === 0);
$('.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.");
- }
- });
-
$('#new_project').submit(function(){
var $path = $('#project_path');
$path.val($path.val().trim());
});
$('#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("")