Add translation keys

pull/1/head
yflory 6 years ago
parent 65d76a9241
commit 9b45f0dd79

@ -1,4 +1,5 @@
@import (reference) "./colortheme-all.less";
@import (reference) "./avatar.less";
.notifications_main() {
--LessLoader_require: LessLoader_currentFile();
@ -53,6 +54,19 @@
}
}
}
.cp-notifications-requestedit-verified {
display: flex;
align-items: center;
&> span.cp-avatar {
.avatar_main(50px);
}
&> span {
margin-right: 10px;
}
&> p {
margin: 0;
}
}
}

@ -115,18 +115,48 @@ define([
// Display the notification
content.getFormatText = function () {
return 'Edit access request: ' + msg.content.title + ' - ' + msg.content.user.displayName;
}; // XXX
return Messages._getKey('requestEdit_request', [msg.content.title, msg.content.displayName]);
};
// if not archived, add handlers
content.handler = function () {
UI.confirm("Give edit rights?", function (yes) {
var metadataMgr = common.getMetadataMgr();
var priv = metadataMgr.getPrivateData();
var link = h('a', {
href: '#'
}, Messages.requestEdit_viewPad);
var verified = h('p.cp-notifications-requestedit-verified');
if (priv.friends && priv.friends[msg.author]) {
var f = priv.friends[msg.author];
var $verified = $(verified);
$verified.append(h('span.fa.fa-certificate'));
var $avatar = $(h('span.cp-avatar')).appendTo($verified);
$verified.append(h('p', Messages._getKey('requestEdit_verified', [f.displayName])));
common.displayAvatar($avatar, f.avatar, f.displayName);
}
var div = h('div', [
h('p', Messages._getKey('requestEdit_confirm', [msg.content.title, msg.content.displayName])),
verified,
link
]);
$(link).click(function (e) {
e.preventDefault();
e.stopPropagation();
common.openURL(msg.content.href);
});
UI.confirm(div, function (yes) {
if (!yes) { return; }
common.getSframeChannel().event('EV_GIVE_ACCESS', {
channel: msg.content.channel,
user: msg.content.user
});
defaultDismiss(common, data)();
}, {
ok: Messages.friendRequest_accept,
cancel: Messages.friendRequest_decline
});
};
@ -146,8 +176,8 @@ define([
// Display the notification
content.getFormatText = function () {
return 'Edit access received: ' + msg.content.title + ' from ' + msg.content.user.displayName;
}; // XXX
return Messages._getKey('requestEdit_accepted', [msg.content.title, msg.content.displayName]);
};
// if not archived, add handlers
content.handler = function () {

@ -222,17 +222,19 @@ define([
if (!res.length) { return void cb(true); }
var edPublic = ctx.store.proxy.edPublic;
var title;
var title, href;
if (!res.some(function (obj) {
if (obj.data &&
Array.isArray(obj.data.owners) && obj.data.owners.indexOf(edPublic) !== -1 &&
obj.data.href) {
href = obj.data.href;
title = obj.data.filename || obj.data.title;
return true;
}
})) { return void cb(true); }
content.title = title;
content.href = href;
cb(false);
};

@ -585,7 +585,7 @@ MessengerUI, Messages) {
var $requestBlock = $('<button>', {
'class': 'fa fa-lock cp-toolbar-share-button',
title: 'REQUEST ACCESS' // XXX
title: Messages.requestEdit_button
}).hide();
// If we have access to the owner's mailbox, display the button and enable it
@ -593,10 +593,16 @@ MessengerUI, Messages) {
// true ==> send the request
Common.getSframeChannel().query('Q_REQUEST_ACCESS', false, function (err, obj) {
if (obj && obj.state) {
var locked = false;
$requestBlock.show().click(function () {
if (locked) { return; }
locked = true;
Common.getSframeChannel().query('Q_REQUEST_ACCESS', true, function (err, obj) {
if (obj && obj.state) {
UI.log('sent'); // XXX
UI.log(Messages.requestEdit_sent);
$requestBlock.hide();
} else {
locked = false;
}
});
});

Loading…
Cancel
Save