From 85894654ae5dfa004fd29d876b49e32cab03b7c2 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 19 Jun 2014 14:30:22 +0200 Subject: [PATCH] Make sure last seen tooltip always appears even after searching and filtering --- settings/css/settings.css | 1 + settings/js/users/users.js | 16 +++++++++++++--- settings/templates/users/part.userlist.php | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/settings/css/settings.css b/settings/css/settings.css index 906712a56b..ef8428bd3e 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -83,6 +83,7 @@ td.name, td.password { padding-left:.8em; } td.password>img,td.displayName>img, td.remove>a, td.quota>img { visibility:hidden; } td.password, td.quota, td.displayName { width:12em; cursor:pointer; } td.password>span, td.quota>span, rd.displayName>span { margin-right: 1.2em; color: #C7C7C7; } +span.usersLastLoginTooltip { white-space: nowrap; } td.remove { width:1em; padding-right:1em; } tr:hover>td.password>span, tr:hover>td.displayName>span { margin:0; cursor:pointer; } diff --git a/settings/js/users/users.js b/settings/js/users/users.js index a911225c5c..1c0f3eef84 100644 --- a/settings/js/users/users.js +++ b/settings/js/users/users.js @@ -80,13 +80,23 @@ var UserList = { } } $tr.find('td.storageLocation').text(storageLocation); + if(lastLogin === 0) { - lastLogin = t('settings', 'never'); + var lastLoginRel = t('settings', 'never'); + var lastLoginAbs = lastLoginRel; } else { lastLogin = new Date(lastLogin * 1000); - lastLogin = relative_modified_date(lastLogin.getTime() / 1000); + var lastLoginRel = relative_modified_date(lastLogin.getTime() / 1000); + var lastLoginAbs = formatDate(lastLogin.getTime()); } - $tr.find('td.lastLogin').text(lastLogin); + $tdLastLogin = $tr.find('td.lastLogin'); + $tdLastLogin.text(lastLoginRel); + //tooltip makes it complicated … to not insert new HTML, we adjust the + //original title. We use a temporary div to get back the html that we + //can pass later. It is also required to initialise tipsy. + var tooltip = $('
').html($($tdLastLogin.attr('original-title')).text(lastLoginAbs)).html(); + $tdLastLogin.tipsy({gravity:'s', fade:true, html:true}); + $tdLastLogin.attr('title', tooltip); $tr.appendTo($userList); if(UserList.isEmpty === true) { //when the list was emptied, one row was left, necessary to keep diff --git a/settings/templates/users/part.userlist.php b/settings/templates/users/part.userlist.php index c74fdcc9ef..25b1727585 100644 --- a/settings/templates/users/part.userlist.php +++ b/settings/templates/users/part.userlist.php @@ -96,13 +96,13 @@ t('never'); - $lastLoginDate = ''; + $lastLoginDate = $lastLogin; } else { $lastLogin = relative_modified_date($user["lastLogin"]); $lastLoginDate = \OC_Util::formatDate($user["lastLogin"]); } ?> - '.$lastLoginDate.''); ?>"> + '.$lastLoginDate.''); ?>">