summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/users.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/settings/js/users.js b/settings/js/users.js
index 9f0c1ffd111..424d00b51a7 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -69,7 +69,9 @@ var UserList = {
add:function (username, groups, subadmin, quota, sort) {
var tr = $('tbody tr').first().clone();
tr.attr('data-uid', username);
+ tr.attr('data-displayName', username);
tr.find('td.name').text(username);
+ tr.find('td.displayName').text(username);
var groupsSelect = $('<select multiple="multiple" class="groupsselect" data-placehoder="Groups" title="' + t('settings', 'Groups') + '"></select>').attr('data-username', username).attr('data-user-groups', groups);
tr.find('td.groups').empty();
if (tr.find('td.subadmins').length > 0) {
@@ -299,6 +301,40 @@ $(document).ready(function () {
$('td.password').live('click', function (event) {
$(this).children('img').click();
});
+
+ $('td.displayName>img').live('click', function (event) {
+ event.stopPropagation();
+ var img = $(this);
+ var uid = img.parent().parent().attr('data-uid');
+ var displayName = img.parent().parent().attr('data-displayName');
+ var input = $('<input type="text" value="'+displayName+'">');
+ img.css('display', 'none');
+ img.parent().children('span').replaceWith(input);
+ input.focus();
+ input.keypress(function (event) {
+ if (event.keyCode == 13) {
+ if ($(this).val().length > 0) {
+ $.post(
+ OC.filePath('settings', 'ajax', 'changedisplayname.php'),
+ {username:uid, displayName:$(this).val()},
+ function (result) {
+ }
+ );
+ input.blur();
+ } else {
+ input.blur();
+ }
+ }
+ });
+ input.blur(function () {
+ $(this).replaceWith($(this).val());
+ img.css('display', '');
+ });
+ });
+ $('td.displayName').live('click', function (event) {
+ $(this).children('img').click();
+ });
+
$('select.quota, select.quota-user').live('change', function () {
var select = $(this);