Add translation keys
This commit is contained in:
parent
65d76a9241
commit
9b45f0dd79
@ -1,4 +1,5 @@
|
|||||||
@import (reference) "./colortheme-all.less";
|
@import (reference) "./colortheme-all.less";
|
||||||
|
@import (reference) "./avatar.less";
|
||||||
|
|
||||||
.notifications_main() {
|
.notifications_main() {
|
||||||
--LessLoader_require: LessLoader_currentFile();
|
--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
|
// Display the notification
|
||||||
content.getFormatText = function () {
|
content.getFormatText = function () {
|
||||||
return 'Edit access request: ' + msg.content.title + ' - ' + msg.content.user.displayName;
|
return Messages._getKey('requestEdit_request', [msg.content.title, msg.content.displayName]);
|
||||||
}; // XXX
|
};
|
||||||
|
|
||||||
// if not archived, add handlers
|
// if not archived, add handlers
|
||||||
content.handler = function () {
|
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; }
|
if (!yes) { return; }
|
||||||
common.getSframeChannel().event('EV_GIVE_ACCESS', {
|
common.getSframeChannel().event('EV_GIVE_ACCESS', {
|
||||||
channel: msg.content.channel,
|
channel: msg.content.channel,
|
||||||
user: msg.content.user
|
user: msg.content.user
|
||||||
});
|
});
|
||||||
defaultDismiss(common, data)();
|
defaultDismiss(common, data)();
|
||||||
|
}, {
|
||||||
|
ok: Messages.friendRequest_accept,
|
||||||
|
cancel: Messages.friendRequest_decline
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -146,8 +176,8 @@ define([
|
|||||||
|
|
||||||
// Display the notification
|
// Display the notification
|
||||||
content.getFormatText = function () {
|
content.getFormatText = function () {
|
||||||
return 'Edit access received: ' + msg.content.title + ' from ' + msg.content.user.displayName;
|
return Messages._getKey('requestEdit_accepted', [msg.content.title, msg.content.displayName]);
|
||||||
}; // XXX
|
};
|
||||||
|
|
||||||
// if not archived, add handlers
|
// if not archived, add handlers
|
||||||
content.handler = function () {
|
content.handler = function () {
|
||||||
|
|||||||
@ -222,17 +222,19 @@ define([
|
|||||||
if (!res.length) { return void cb(true); }
|
if (!res.length) { return void cb(true); }
|
||||||
|
|
||||||
var edPublic = ctx.store.proxy.edPublic;
|
var edPublic = ctx.store.proxy.edPublic;
|
||||||
var title;
|
var title, href;
|
||||||
if (!res.some(function (obj) {
|
if (!res.some(function (obj) {
|
||||||
if (obj.data &&
|
if (obj.data &&
|
||||||
Array.isArray(obj.data.owners) && obj.data.owners.indexOf(edPublic) !== -1 &&
|
Array.isArray(obj.data.owners) && obj.data.owners.indexOf(edPublic) !== -1 &&
|
||||||
obj.data.href) {
|
obj.data.href) {
|
||||||
|
href = obj.data.href;
|
||||||
title = obj.data.filename || obj.data.title;
|
title = obj.data.filename || obj.data.title;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
})) { return void cb(true); }
|
})) { return void cb(true); }
|
||||||
|
|
||||||
content.title = title;
|
content.title = title;
|
||||||
|
content.href = href;
|
||||||
cb(false);
|
cb(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -585,7 +585,7 @@ MessengerUI, Messages) {
|
|||||||
|
|
||||||
var $requestBlock = $('<button>', {
|
var $requestBlock = $('<button>', {
|
||||||
'class': 'fa fa-lock cp-toolbar-share-button',
|
'class': 'fa fa-lock cp-toolbar-share-button',
|
||||||
title: 'REQUEST ACCESS' // XXX
|
title: Messages.requestEdit_button
|
||||||
}).hide();
|
}).hide();
|
||||||
|
|
||||||
// If we have access to the owner's mailbox, display the button and enable it
|
// 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
|
// true ==> send the request
|
||||||
Common.getSframeChannel().query('Q_REQUEST_ACCESS', false, function (err, obj) {
|
Common.getSframeChannel().query('Q_REQUEST_ACCESS', false, function (err, obj) {
|
||||||
if (obj && obj.state) {
|
if (obj && obj.state) {
|
||||||
|
var locked = false;
|
||||||
$requestBlock.show().click(function () {
|
$requestBlock.show().click(function () {
|
||||||
|
if (locked) { return; }
|
||||||
|
locked = true;
|
||||||
Common.getSframeChannel().query('Q_REQUEST_ACCESS', true, function (err, obj) {
|
Common.getSframeChannel().query('Q_REQUEST_ACCESS', true, function (err, obj) {
|
||||||
if (obj && obj.state) {
|
if (obj && obj.state) {
|
||||||
UI.log('sent'); // XXX
|
UI.log(Messages.requestEdit_sent);
|
||||||
|
$requestBlock.hide();
|
||||||
|
} else {
|
||||||
|
locked = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user