|
|
@ -105,7 +105,7 @@ define([
|
|
|
|
if (err) { return void console.error(err); }
|
|
|
|
if (err) { return void console.error(err); }
|
|
|
|
Cryptpad.whenRealtimeSyncs(realtime, function () {
|
|
|
|
Cryptpad.whenRealtimeSyncs(realtime, function () {
|
|
|
|
lastVal = newVal;
|
|
|
|
lastVal = newVal;
|
|
|
|
Cryptpad.log('TODO: '+name+' saved');
|
|
|
|
Cryptpad.log(Messages._getKey('profile_fieldSaved', [newVal]));
|
|
|
|
editing = false;
|
|
|
|
editing = false;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -196,7 +196,7 @@ define([
|
|
|
|
cb();
|
|
|
|
cb();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var rt = APP.lm.realtime;
|
|
|
|
var rt = APP.lm.realtime;
|
|
|
|
var placeholder = "URL"; //XXX
|
|
|
|
var placeholder = Messages.profile_urlPlaceholder;
|
|
|
|
createEditableInput($block, LINK_ID, placeholder, getValue, setValue, rt);
|
|
|
|
createEditableInput($block, LINK_ID, placeholder, getValue, setValue, rt);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -209,7 +209,7 @@ define([
|
|
|
|
if (!APP.lm.proxy.avatar) {
|
|
|
|
if (!APP.lm.proxy.avatar) {
|
|
|
|
$('<img>', {
|
|
|
|
$('<img>', {
|
|
|
|
src: '/customize/images/avatar.png',
|
|
|
|
src: '/customize/images/avatar.png',
|
|
|
|
title: 'Avatar', // XXX
|
|
|
|
title: Messages.profile_avatar,
|
|
|
|
alt: 'Avatar'
|
|
|
|
alt: 'Avatar'
|
|
|
|
}).appendTo($span);
|
|
|
|
}).appendTo($span);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -218,21 +218,20 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
if (APP.readOnly) { return; }
|
|
|
|
if (APP.readOnly) { return; }
|
|
|
|
|
|
|
|
|
|
|
|
var $delButton = $('<button>', {'class': 'delete btn btn-danger fa fa-times'}); //XXX
|
|
|
|
var $delButton = $('<button>', {
|
|
|
|
|
|
|
|
'class': 'delete btn btn-danger fa fa-times',
|
|
|
|
|
|
|
|
title: Messages.fc_delete
|
|
|
|
|
|
|
|
});
|
|
|
|
$span.append($delButton);
|
|
|
|
$span.append($delButton);
|
|
|
|
$delButton.click(function () {
|
|
|
|
$delButton.click(function () {
|
|
|
|
console.log('clicked');
|
|
|
|
|
|
|
|
var oldChanId = Cryptpad.hrefToHexChannelId(APP.lm.proxy.avatar);
|
|
|
|
var oldChanId = Cryptpad.hrefToHexChannelId(APP.lm.proxy.avatar);
|
|
|
|
Cryptpad.unpinPads([oldChanId], function (e) {
|
|
|
|
Cryptpad.unpinPads([oldChanId], function (e) {
|
|
|
|
if (e) { Cryptpad.log(e); }
|
|
|
|
if (e) { Cryptpad.log(e); }
|
|
|
|
console.log('unpinned');
|
|
|
|
|
|
|
|
delete APP.lm.proxy.avatar;
|
|
|
|
delete APP.lm.proxy.avatar;
|
|
|
|
delete Cryptpad.getProxy().profile.avatar;
|
|
|
|
delete Cryptpad.getProxy().profile.avatar;
|
|
|
|
Cryptpad.whenRealtimeSyncs(APP.lm.realtime, function () {
|
|
|
|
Cryptpad.whenRealtimeSyncs(APP.lm.realtime, function () {
|
|
|
|
console.log('synced1');
|
|
|
|
|
|
|
|
var driveRt = Cryptpad.getStore().getProxy().info.realtime;
|
|
|
|
var driveRt = Cryptpad.getStore().getProxy().info.realtime;
|
|
|
|
Cryptpad.whenRealtimeSyncs(driveRt, function () {
|
|
|
|
Cryptpad.whenRealtimeSyncs(driveRt, function () {
|
|
|
|
console.log('synced2');
|
|
|
|
|
|
|
|
displayAvatar();
|
|
|
|
displayAvatar();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -258,6 +257,7 @@ define([
|
|
|
|
Cryptpad.whenRealtimeSyncs(APP.lm.realtime, function () {
|
|
|
|
Cryptpad.whenRealtimeSyncs(APP.lm.realtime, function () {
|
|
|
|
var driveRt = Cryptpad.getStore().getProxy().info.realtime;
|
|
|
|
var driveRt = Cryptpad.getStore().getProxy().info.realtime;
|
|
|
|
Cryptpad.whenRealtimeSyncs(driveRt, function () {
|
|
|
|
Cryptpad.whenRealtimeSyncs(driveRt, function () {
|
|
|
|
|
|
|
|
Cryptpad.changeDisplayName();
|
|
|
|
displayAvatar();
|
|
|
|
displayAvatar();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -285,7 +285,7 @@ define([
|
|
|
|
accept: ".gif,.jpg,.jpeg,.png"
|
|
|
|
accept: ".gif,.jpg,.jpeg,.png"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
var $upButton = Cryptpad.createButton('upload', false, data);
|
|
|
|
var $upButton = Cryptpad.createButton('upload', false, data);
|
|
|
|
$upButton.text(" Upload a new avatar");
|
|
|
|
$upButton.text(Messages.profile_upload);
|
|
|
|
$upButton.prepend($('<span>', {'class': 'fa fa-upload'}));
|
|
|
|
$upButton.prepend($('<span>', {'class': 'fa fa-upload'}));
|
|
|
|
$block.append($upButton);
|
|
|
|
$block.append($upButton);
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -300,6 +300,7 @@ define([
|
|
|
|
$div.html(val);
|
|
|
|
$div.html(val);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$('<h3>').text(Messages.profile_description).insertBefore($block);
|
|
|
|
|
|
|
|
|
|
|
|
var $ok = $('<span>', {'class': 'ok fa fa-check', title: Messages.saved}).appendTo($block);
|
|
|
|
var $ok = $('<span>', {'class': 'ok fa fa-check', title: Messages.saved}).appendTo($block);
|
|
|
|
var $spinner = $('<span>', {'class': 'spin fa fa-spinner fa-pulse'}).appendTo($block);
|
|
|
|
var $spinner = $('<span>', {'class': 'spin fa fa-spinner fa-pulse'}).appendTo($block);
|
|
|
@ -388,17 +389,18 @@ define([
|
|
|
|
if (e === 'E_OVER_LIMIT') {
|
|
|
|
if (e === 'E_OVER_LIMIT') {
|
|
|
|
Cryptpad.alert(Messages.pinLimitNotPinned, null, true);
|
|
|
|
Cryptpad.alert(Messages.pinLimitNotPinned, null, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return void Cryptpad.log('Error while creating your profile: ' + e); // XXX
|
|
|
|
return void Cryptpad.log(Messages._getKey('profile_error', [e]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
obj.profile.edit = Cryptpad.getEditHashFromKeys(channel, secret.keys);
|
|
|
|
obj.profile.edit = Cryptpad.getEditHashFromKeys(channel, secret.keys);
|
|
|
|
obj.profile.view = Cryptpad.getViewHashFromKeys(channel, secret.keys);
|
|
|
|
obj.profile.view = Cryptpad.getViewHashFromKeys(channel, secret.keys);
|
|
|
|
obj.profile.name = APP.rt.proxy[Cryptpad.displayNameKey] || '';
|
|
|
|
obj.profile.name = APP.rt.proxy[Cryptpad.displayNameKey] || '';
|
|
|
|
|
|
|
|
Cryptpad.changeDisplayName();
|
|
|
|
andThen(obj.profile.edit);
|
|
|
|
andThen(obj.profile.edit);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (!Cryptpad.isLoggedIn()) { // XXX
|
|
|
|
if (!Cryptpad.isLoggedIn()) {
|
|
|
|
var $p = $('<p>').text('TODO: You have to register to create a profile');
|
|
|
|
var $p = $('<p>').text(Messages.error_register);
|
|
|
|
var $a = $('<a>', {
|
|
|
|
var $a = $('<a>', {
|
|
|
|
href: '/register/'
|
|
|
|
href: '/register/'
|
|
|
|
});
|
|
|
|
});
|
|
|
@ -411,7 +413,7 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var $create = $('<div>', {id: CREATE_ID});
|
|
|
|
var $create = $('<div>', {id: CREATE_ID});
|
|
|
|
var $button = $('<button>', {'class': 'btn btn-success'});
|
|
|
|
var $button = $('<button>', {'class': 'btn btn-success'});
|
|
|
|
$button.text('TODO: create a profile?').click(todo).appendTo($create); // XXX
|
|
|
|
$button.text(Messages.profile_create).click(todo).appendTo($create);
|
|
|
|
APP.$container.append($create);
|
|
|
|
APP.$container.append($create);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|