Translation keys

pull/1/head
yflory 5 years ago
parent 75e0b68f51
commit f70396a0f8

@ -240,10 +240,10 @@ define([
var error = h('div.cp-admin-support-error'); var error = h('div.cp-admin-support-error');
var input = h('input.cp-admin-add-private-key'); var input = h('input.cp-admin-add-private-key');
var button = h('button.btn.btn-primary', Messages.admin_supportAddKey || 'add key'); // XXX var button = h('button.btn.btn-primary', Messages.admin_supportAddKey);
if (APP.privateKey && !checkAdminKey(APP.privateKey)) { if (APP.privateKey && !checkAdminKey(APP.privateKey)) {
$(error).text(Messages.admin_supportAddError || 'invalid'); // XXX $(error).text(Messages.admin_supportAddError);
} }
$div.append(h('div', [ $div.append(h('div', [
@ -256,15 +256,12 @@ define([
var key = $(input).val(); var key = $(input).val();
if (!checkAdminKey(key)) { if (!checkAdminKey(key)) {
$(input).val(''); $(input).val('');
return void $(error).text(Messages.admin_supportAddError || 'invalid'); // XXX return void $(error).text(Messages.admin_supportAddError);
} }
sFrameChan.query("Q_ADMIN_MAILBOX", key, function () { sFrameChan.query("Q_ADMIN_MAILBOX", key, function () {
console.log(key);
console.log(arguments);
APP.privateKey = key; APP.privateKey = key;
console.log('ok');
$('.cp-admin-support-init').hide(); $('.cp-admin-support-init').hide();
APP.$rightside.append(create['support-list']()); // TODO: check? APP.$rightside.append(create['support-list']());
}); });
}); });
return $div; return $div;

@ -162,7 +162,6 @@ define([
create['disabled'] = function () { create['disabled'] = function () {
var key = 'disabled'; var key = 'disabled';
var $div = makeBlock(key); var $div = makeBlock(key);
// XXX add text
return $div; return $div;
}; };
@ -219,7 +218,7 @@ define([
displayed: displayed, displayed: displayed,
sfCommon: common, sfCommon: common,
$container: APP.$toolbar, $container: APP.$toolbar,
pageTitle: Messages.supportPage || 'Support', // XXX pageTitle: Messages.supportPage || 'Support',
metadataMgr: common.getMetadataMgr(), metadataMgr: common.getMetadataMgr(),
}; };
APP.toolbar = Toolbar.create(configTb); APP.toolbar = Toolbar.create(configTb);

@ -49,11 +49,11 @@ define([
var title = $title.val(); var title = $title.val();
if (!title) { if (!title) {
return void showError(form, Messages.support_formTitleError || 'title error'); // XXX return void showError(form, Messages.support_formTitleError);
} }
var content = $content.val(); var content = $content.val();
if (!content) { if (!content) {
return void showError(form, Messages.support_formContentError || 'content error'); // XXX return void showError(form, Messages.support_formContentError);
} }
// Success: hide any error // Success: hide any error
showError(form, null); showError(form, null);
@ -72,7 +72,7 @@ define([
var button; var button;
if (typeof(cb) === "function") { if (typeof(cb) === "function") {
button = h('button.btn.btn-primary.cp-support-list-send', Messages.support_send || 'Send'); // XXX button = h('button.btn.btn-primary.cp-support-list-send', Messages.contacts_send);
$(button).click(cb); $(button).click(cb);
} }
@ -81,16 +81,13 @@ define([
var content = [ var content = [
h('hr'), h('hr'),
h('div.cp-support-form-error'), h('div.cp-support-form-error'),
h('label' + (title ? '.cp-hidden' : ''), Messages.support_formTitle || 'title...'), // XXX h('label' + (title ? '.cp-hidden' : ''), Messages.support_formTitle),
h('input.cp-support-form-title' + (title ? '.cp-hidden' : ''), { h('input.cp-support-form-title' + (title ? '.cp-hidden' : ''), {
placeholder: Messages.support_formTitlePlaceholder || 'title here...', // XXX
value: title || '' value: title || ''
}), }),
cb ? undefined : h('br'), cb ? undefined : h('br'),
h('label', Messages.support_formMessage || 'content...'), // XXX h('label', Messages.support_formMessage),
h('textarea.cp-support-form-msg', { h('textarea.cp-support-form-msg', { }),
placeholder: Messages.support_formMessagePlaceholder || 'describe your problem here...' // XXX
}),
h('hr'), h('hr'),
button, button,
cancel cancel
@ -108,9 +105,9 @@ define([
var makeTicket = function ($div, common, content, onHide) { var makeTicket = function ($div, common, content, onHide) {
var ticketTitle = content.id + ' - ' + content.title; var ticketTitle = content.id + ' - ' + content.title;
var answer = h('button.btn.btn-primary.cp-support-answer', Messages.support_answer || 'Answer'); // XXX var answer = h('button.btn.btn-primary.cp-support-answer', Messages.support_answer);
var close = h('button.btn.btn-danger.cp-support-close', Messages.support_close || 'Close'); // XXX var close = h('button.btn.btn-danger.cp-support-close', Messages.support_close);
var hide = h('button.btn.btn-danger.cp-support-hide', Messages.support_remove || 'Remove'); // XXX var hide = h('button.btn.btn-danger.cp-support-hide', Messages.support_remove);
var actions = h('div.cp-support-list-actions', [ var actions = h('div.cp-support-list-actions', [
answer, answer,
@ -156,11 +153,10 @@ define([
var privateData = metadataMgr.getPrivateData(); var privateData = metadataMgr.getPrivateData();
// Check content.sender to see if it comes from us or from an admin // Check content.sender to see if it comes from us or from an admin
// XXX admins should send their personal public key?
var fromMe = content.sender && content.sender.edPublic === privateData.edPublic; var fromMe = content.sender && content.sender.edPublic === privateData.edPublic;
var userData = h('div.cp-support-showdata', [ var userData = h('div.cp-support-showdata', [
Messages.support_showData || 'Show/hide data', // XXX Messages.support_showData,
h('pre.cp-support-message-data', JSON.stringify(content.sender, 0, 2)) h('pre.cp-support-message-data', JSON.stringify(content.sender, 0, 2))
]); ]);
$(userData).click(function () { $(userData).click(function () {
@ -170,9 +166,10 @@ define([
return h('div.cp-support-list-message', { return h('div.cp-support-list-message', {
'data-hash': hash 'data-hash': hash
}, [ }, [
h('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), h('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), [
//Messages._getKey('support_from', [content.sender.name, new Date(content.time)])), // XXX h('span', Messages._getKey('support_from', [content.sender.name])),
[h('b', 'From: '), content.sender.name, h('span.cp-support-message-time', content.time ? new Date(content.time).toLocaleString() : '')]), h('span.cp-support-message-time', content.time ? new Date(content.time).toLocaleString() : '')
]),
h('pre.cp-support-message-content', content.message), h('pre.cp-support-message-content', content.message),
isAdmin ? userData : undefined, isAdmin ? userData : undefined,
]); ]);
@ -186,10 +183,11 @@ define([
return h('div.cp-support-list-message', { return h('div.cp-support-list-message', {
'data-hash': hash 'data-hash': hash
}, [ }, [
h('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), h('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), [
//Messages._getKey('support_from', [content.sender.name, new Date(content.time)])), // XXX h('span', Messages._getKey('support_from', [content.sender.name])),
[h('b', 'From: '), content.sender.name, h('span.cp-support-message-time', content.time ? new Date(content.time).toLocaleString() : '')]), h('span.cp-support-message-time', content.time ? new Date(content.time).toLocaleString() : '')
h('pre.cp-support-message-content', Messages.support_closed || 'Ticket closed...') // XXX ]),
h('pre.cp-support-message-content', Messages.support_closed)
]); ]);
}; };

Loading…
Cancel
Save