|
|
|
@ -105,7 +105,7 @@ define([
|
|
|
|
|
if (err) { return void console.error(err); }
|
|
|
|
|
Cryptpad.whenRealtimeSyncs(realtime, function () {
|
|
|
|
|
lastVal = newVal;
|
|
|
|
|
Cryptpad.log('TODO: '+name+' saved');
|
|
|
|
|
Cryptpad.log(Messages._getKey('profile_fieldSaved', [newVal]));
|
|
|
|
|
editing = false;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -196,7 +196,7 @@ define([
|
|
|
|
|
cb();
|
|
|
|
|
};
|
|
|
|
|
var rt = APP.lm.realtime;
|
|
|
|
|
var placeholder = "URL"; //XXX
|
|
|
|
|
var placeholder = Messages.profile_urlPlaceholder;
|
|
|
|
|
createEditableInput($block, LINK_ID, placeholder, getValue, setValue, rt);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -209,7 +209,7 @@ define([
|
|
|
|
|
if (!APP.lm.proxy.avatar) {
|
|
|
|
|
$('<img>', {
|
|
|
|
|
src: '/customize/images/avatar.png',
|
|
|
|
|
title: 'Avatar', // XXX
|
|
|
|
|
title: Messages.profile_avatar,
|
|
|
|
|
alt: 'Avatar'
|
|
|
|
|
}).appendTo($span);
|
|
|
|
|
return;
|
|
|
|
@ -218,21 +218,20 @@ define([
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
$delButton.click(function () {
|
|
|
|
|
console.log('clicked');
|
|
|
|
|
var oldChanId = Cryptpad.hrefToHexChannelId(APP.lm.proxy.avatar);
|
|
|
|
|
Cryptpad.unpinPads([oldChanId], function (e) {
|
|
|
|
|
if (e) { Cryptpad.log(e); }
|
|
|
|
|
console.log('unpinned');
|
|
|
|
|
delete APP.lm.proxy.avatar;
|
|
|
|
|
delete Cryptpad.getProxy().profile.avatar;
|
|
|
|
|
Cryptpad.whenRealtimeSyncs(APP.lm.realtime, function () {
|
|
|
|
|
console.log('synced1');
|
|
|
|
|
var driveRt = Cryptpad.getStore().getProxy().info.realtime;
|
|
|
|
|
Cryptpad.whenRealtimeSyncs(driveRt, function () {
|
|
|
|
|
console.log('synced2');
|
|
|
|
|
displayAvatar();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -258,6 +257,7 @@ define([
|
|
|
|
|
Cryptpad.whenRealtimeSyncs(APP.lm.realtime, function () {
|
|
|
|
|
var driveRt = Cryptpad.getStore().getProxy().info.realtime;
|
|
|
|
|
Cryptpad.whenRealtimeSyncs(driveRt, function () {
|
|
|
|
|
Cryptpad.changeDisplayName();
|
|
|
|
|
displayAvatar();
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
@ -285,7 +285,7 @@ define([
|
|
|
|
|
accept: ".gif,.jpg,.jpeg,.png"
|
|
|
|
|
};
|
|
|
|
|
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'}));
|
|
|
|
|
$block.append($upButton);
|
|
|
|
|
};
|
|
|
|
@ -300,6 +300,7 @@ define([
|
|
|
|
|
$div.html(val);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$('<h3>').text(Messages.profile_description).insertBefore($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);
|
|
|
|
@ -388,17 +389,18 @@ define([
|
|
|
|
|
if (e === 'E_OVER_LIMIT') {
|
|
|
|
|
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.view = Cryptpad.getViewHashFromKeys(channel, secret.keys);
|
|
|
|
|
obj.profile.name = APP.rt.proxy[Cryptpad.displayNameKey] || '';
|
|
|
|
|
Cryptpad.changeDisplayName();
|
|
|
|
|
andThen(obj.profile.edit);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!Cryptpad.isLoggedIn()) { // XXX
|
|
|
|
|
var $p = $('<p>').text('TODO: You have to register to create a profile');
|
|
|
|
|
if (!Cryptpad.isLoggedIn()) {
|
|
|
|
|
var $p = $('<p>').text(Messages.error_register);
|
|
|
|
|
var $a = $('<a>', {
|
|
|
|
|
href: '/register/'
|
|
|
|
|
});
|
|
|
|
@ -411,7 +413,7 @@ define([
|
|
|
|
|
}
|
|
|
|
|
var $create = $('<div>', {id: CREATE_ID});
|
|
|
|
|
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);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|