From b7d68ac5d5eb287a5b57694fa6ddf8fddb1b033c Mon Sep 17 00:00:00 2001 From: olgasmola Date: Fri, 27 Jul 2012 16:27:59 +0300 Subject: [PATCH] CS-15325: Fix selected name of user from the drop down list overlay. --- ui/css/cloudstack3.css | 2 ++ ui/scripts/ui-custom/login.js | 19 +++++++++++++------ ui/scripts/ui/core.js | 2 +- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index a60e4807ca2..876d6633530 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -280,6 +280,8 @@ body.login { .login .fields .field label.error { color: #FF0000; float: right; + left: 204px; + top: 0; } .login .fields input { diff --git a/ui/scripts/ui-custom/login.js b/ui/scripts/ui-custom/login.js index 20e6abff2b2..c092b82ec0e 100644 --- a/ui/scripts/ui-custom/login.js +++ b/ui/scripts/ui-custom/login.js @@ -53,7 +53,7 @@ $form.validate(); // Form label behavior - $inputs.bind('keydown keyup focus blur', function(event) { + $inputs.bind('keydown focus click blur', function(event) { var $target = $(event.target); var $label = $form.find('label').filter(function() { return $(this).attr('for') == $target.attr('name'); @@ -63,11 +63,16 @@ $label.hide(); return true; - } else { - if (!$target.val()) { + } else if (event.type == 'blur') { + if ($target.hasClass('first-input')) { + $target.removeClass('first-input'); + } + if (!$(this).val()) { $label.show(); - } else { - $label.hide(); + } + } else { + if (!$target.hasClass('first-input')) { + $label.hide(); } } @@ -79,11 +84,13 @@ // Labels cause related input to be focused $login.find('label').click(function() { var $input = $inputs.filter('[name=' + $(this).attr('for') + ']'); + var $label = $(this); $input.focus(); + $label.hide(); }); - $inputs.filter(':first').focus(); + $inputs.filter(':first').addClass('first-input').focus(); // Login action $login.find('input[type=submit]').click(function() { diff --git a/ui/scripts/ui/core.js b/ui/scripts/ui/core.js index b7ffdba2328..0c6b4e744c7 100644 --- a/ui/scripts/ui/core.js +++ b/ui/scripts/ui/core.js @@ -352,7 +352,7 @@ // Check if target should be hovered function checkHoveredLabel($target) { var $multiWizard = $('div.ui-dialog div.multi-wizard'); - if ($target.is('label[for]') || + if (($target.is('label[for]') && !$target.parents('body.login')) || ($multiWizard.size() && ($target.is('.multi-wizard label') && $target.prev('input[type="radio"],input[type="checkbox"]').size()) || ($target.is('.multi-wizard .select-desc div.name') && $target.parent('div.select-desc').prev('input[type="radio"],input[type="checkbox"]').size())