Commit 576ffef6 authored by Kushal Pandya's avatar Kushal Pandya

Fix project title validation, prevent clicking on disabled button

parent d4c99f64
...@@ -123,23 +123,16 @@ ...@@ -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("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').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(){ $('#new_project').submit(function(){
var $path = $('#project_path'); var $path = $('#project_path');
$path.val($path.val().trim()); $path.val($path.val().trim());
}); });
$('#project_path').keyup(function(){ $('#project_path').keyup(function(){
if($(this).val().length !=0) { if($(this).val().trim().length !== 0) {
$('.btn_import_gitlab_project').attr('disabled', false); $('.btn_import_gitlab_project').attr('disabled', false);
$('.import_gitlab_project').attr('title',''); $('.import_gitlab_project').attr('title','');
$(".flash-container").html("") $(".flash-container").html("")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment