diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 16fc4fe77f9d6b63fb5e82a18700d126eda3c719..ffadcbe921a557082632e9ec6e7e90d3d9a8ce97 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -66,7 +66,7 @@ if ($_POST) <span id="user-name"><?php echo Format::htmlchars($user->getName()); ?></span> <<span id="user-email"><?php echo $user->getEmail(); ?></span>> </a> - <a class="action-button" style="overflow:inherit" href="#" + <a class="inline button" style="overflow:inherit" href="#" onclick="javascript: $.userLookup('ajax.php/users/select/'+$('input#uid').val(), function(user) { @@ -75,7 +75,7 @@ if ($_POST) $('#user-email').text('<'+user.email+'>'); }); return false; - "><i class="icon-edit"></i> <?php echo __('Change'); ?></a> + "><i class="icon-retweet"></i> <?php echo __('Change'); ?></a> </div> </td></tr> <?php @@ -84,9 +84,12 @@ if ($_POST) <tr> <td width="160" class="required"> <?php echo __('Email Address'); ?>: </td> <td> - <span style="display:inline-block;"> - <input type="text" size=45 name="email" id="user-email" + <div class="attached input"> + <input type="text" size=45 name="email" id="user-email" class="attached" autocomplete="off" autocorrect="off" value="<?php echo $info['email']; ?>" /> </span> + <a href="?a=open&uid={id}" data-dialog="ajax.php/users/lookup/form" + class="attached button"><i class="icon-search"></i></a> + </div> <span class="error">*</span> <div class="error"><?php echo $errors['email']; ?></div> </td> diff --git a/scp/css/scp.css b/scp/css/scp.css index f0624c0e7f3e4c9dbdaed4b78623b45b95e2d886..e802d1574404d9940cf7af9717daa295a3386ab8 100644 --- a/scp/css/scp.css +++ b/scp/css/scp.css @@ -1784,6 +1784,7 @@ select + .button { .button.attached { margin-left: -4px; + margin-right: -4px; box-shadow: none !important; border-top-left-radius: 0; border-bottom-left-radius: 0; @@ -1795,6 +1796,16 @@ select + .button { height: 24px; box-sizing: border-box; display: inline-block; + margin-right: 5px; +} +.input.attached.focus { + outline-offset: -2px; + outline-style: auto; + outline-width: 5px; + outline-color: -webkit-focus-ring-color; +} +.input.attached input:focus { + outline-style: none; } .input.attached input { height: 100%; diff --git a/scp/js/scp.js b/scp/js/scp.js index 07135b2ba6066a465dd23fe58e6e0ea980f01102..ca9639428617b80ddc4a0f08b81008fb0eb2b705 100644 --- a/scp/js/scp.js +++ b/scp/js/scp.js @@ -463,6 +463,11 @@ var scp_prep = function() { }); $('[data-toggle="tooltip"]').tooltip() + + $('.attached.input input[autofocus]').parent().addClass('focus') + $('.attached.input input') + .on('focus', function() { alert('hi'); $(this).parent().addClass('focus'); }) + .on('blur', function() { $(this).parent().removeClass('focus'); }) }; $(document).ready(scp_prep); @@ -674,8 +679,17 @@ $(document).on('click', 'a[data-dialog]', function(event) { event.preventDefault(); event.stopImmediatePropagation(); var link = $(this); - $.dialog($(this).data('dialog'), 201, function() { - if (link.attr('href').length > 1) $.pjax.click(event, '#pjax-container'); + $.dialog($(this).data('dialog'), 201, function(xhr, json) { + try { + json = JSON.parse(json); + } catch (e) {} + if (link.attr('href').length > 1) { + // Replace {xx} expressions with data from JSON + if (typeof json === 'object') + link.attr('href', + link.attr('href').replace(/\{([^}]+)\}/, function($0, $1) { return json[$1]; })); + $.pjax.click(event, '#pjax-container'); + } else $.pjax.reload('#pjax-container'); }); return false;