Skip to content
Snippets Groups Projects
Commit 07a8c092 authored by Peter Rotich's avatar Peter Rotich
Browse files

Allow user edit via a dialog when in preview mode

The user preview tool tip and edit dialog use the same user template.
Editing on preview mode resulted in partially hidden edit form. This fix
adds ability to popup a dialog modal on edit while on preview mode.
parent 039ffb64
No related branches found
No related tags found
No related merge requests found
......@@ -87,8 +87,10 @@ class UsersAjaxAPI extends AjaxController {
elseif(!($user = User::lookup($id)))
Http::response(404, 'Unknown user');
$info = array('title' => '');
$info = array(
'title' => '',
'useredit' => sprintf('#users/%d/edit', $user->getId()),
);
ob_start();
echo sprintf('<div style="width:650px; padding: 2px 2px 0 5px;"
id="u%d">', $user->getId());
......
......@@ -48,7 +48,7 @@ if ($info['error']) {
<div class="tab_content" id="info-tab">
<div class="floating-options">
<a href="#" id="edituser" class="action" title="Edit"><i class="icon-edit"></i></a>
<a href="<?php echo $info['useredit'] ?: '#'; ?>" id="edituser" class="action" title="Edit"><i class="icon-edit"></i></a>
<a href="users.php?id=<?php echo $user->getId(); ?>" title="Manage User"
class="action"><i class="icon-share"></i></a>
</div>
......@@ -141,8 +141,18 @@ if ($ticket && $ticket->getOwnerId() == $user->getId())
$(function() {
$('a#edituser').click( function(e) {
e.preventDefault();
$('div#user-profile').hide();
$('div#user-form').fadeIn();
if ($(this).attr('href').length > 1) {
var url = 'ajax.php/'+$(this).attr('href').substr(1);
$.dialog(url, [201, 204], function (xhr) {
window.location.href = window.location.href;
}, {
onshow: function() { $('#user-search').focus(); }
});
} else {
$('div#user-profile').hide();
$('div#user-form').fadeIn();
}
return false;
});
......
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