Skip to content
Snippets Groups Projects
Commit 5ad16b30 authored by Jared Hancock's avatar Jared Hancock
Browse files

ui: Auto focus user lookup search box

parent 360f206d
No related branches found
No related tags found
No related merge requests found
......@@ -682,7 +682,7 @@ class TicketsAjaxAPI extends AjaxController {
'title' => sprintf('Change user for ticket #%s', $ticket->getNumber())
);
return self::_userlookup($user, $info);
return self::_userlookup($user, null, $info);
}
function _userlookup($user, $form, $info) {
......
......@@ -89,14 +89,14 @@ $(function() {
$('a#unselect-user').click( function(e) {
e.preventDefault();
$('div#selected-user-info').hide();
$('div#new-user-form').fadeIn();
$('div#new-user-form').fadeIn({start: function(){ $('#user-search').focus(); }});
return false;
});
$(document).on('click', 'form.user input.cancel', function (e) {
e.preventDefault();
$('div#new-user-form').hide();
$('div#selected-user-info').fadeIn();
$('div#selected-user-info').fadeIn({start: function(){ $('#user-search').focus(); }});
return false;
});
});
......
......@@ -419,11 +419,14 @@ $(document).ready(function(){
});
});
$.dialog = function (url, code, cb) {
$.dialog = function (url, code, cb, options) {
options = options||{};
$('.dialog#popup .body').load(url, function () {
$('#overlay').show();
$('.dialog#popup').show();
$('.dialog#popup').show({
duration: 0,
complete: function() { if (options.onshow) options.onshow(); }
});
$(document).off('.dialog');
$(document).on('submit.dialog', '.dialog#popup form', function(e) {
e.preventDefault();
......@@ -451,12 +454,15 @@ $(document).ready(function(){
return false;
});
});
if (options.onload) { options.onload(); }
};
$.userLookup = function (url, cb) {
$.dialog(url, 201, function (resp) {
var user = $.parseJSON(resp);
if(cb) cb(user);
}, {
onshow: function() { $('#user-search').focus(); }
});
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment