From f70396a0f8df58a8cac7567d9e753b30f3af801c Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 28 Jun 2019 17:05:26 +0200 Subject: [PATCH] Translation keys --- www/admin/inner.js | 11 ++++------- www/support/inner.js | 3 +-- www/support/ui.js | 40 +++++++++++++++++++--------------------- 3 files changed, 24 insertions(+), 30 deletions(-) diff --git a/www/admin/inner.js b/www/admin/inner.js index 96b4e5bba..e83efd491 100644 --- a/www/admin/inner.js +++ b/www/admin/inner.js @@ -240,10 +240,10 @@ define([ var error = h('div.cp-admin-support-error'); 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)) { - $(error).text(Messages.admin_supportAddError || 'invalid'); // XXX + $(error).text(Messages.admin_supportAddError); } $div.append(h('div', [ @@ -256,15 +256,12 @@ define([ var key = $(input).val(); if (!checkAdminKey(key)) { $(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 () { - console.log(key); - console.log(arguments); APP.privateKey = key; - console.log('ok'); $('.cp-admin-support-init').hide(); - APP.$rightside.append(create['support-list']()); // TODO: check? + APP.$rightside.append(create['support-list']()); }); }); return $div; diff --git a/www/support/inner.js b/www/support/inner.js index 7b4d78bc9..202ecc0a6 100644 --- a/www/support/inner.js +++ b/www/support/inner.js @@ -162,7 +162,6 @@ define([ create['disabled'] = function () { var key = 'disabled'; var $div = makeBlock(key); - // XXX add text return $div; }; @@ -219,7 +218,7 @@ define([ displayed: displayed, sfCommon: common, $container: APP.$toolbar, - pageTitle: Messages.supportPage || 'Support', // XXX + pageTitle: Messages.supportPage || 'Support', metadataMgr: common.getMetadataMgr(), }; APP.toolbar = Toolbar.create(configTb); diff --git a/www/support/ui.js b/www/support/ui.js index 590712ff7..0a5af8ebe 100644 --- a/www/support/ui.js +++ b/www/support/ui.js @@ -49,11 +49,11 @@ define([ var title = $title.val(); if (!title) { - return void showError(form, Messages.support_formTitleError || 'title error'); // XXX + return void showError(form, Messages.support_formTitleError); } var content = $content.val(); if (!content) { - return void showError(form, Messages.support_formContentError || 'content error'); // XXX + return void showError(form, Messages.support_formContentError); } // Success: hide any error showError(form, null); @@ -72,7 +72,7 @@ define([ var button; 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); } @@ -81,16 +81,13 @@ define([ var content = [ h('hr'), 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' : ''), { - placeholder: Messages.support_formTitlePlaceholder || 'title here...', // XXX value: title || '' }), cb ? undefined : h('br'), - h('label', Messages.support_formMessage || 'content...'), // XXX - h('textarea.cp-support-form-msg', { - placeholder: Messages.support_formMessagePlaceholder || 'describe your problem here...' // XXX - }), + h('label', Messages.support_formMessage), + h('textarea.cp-support-form-msg', { }), h('hr'), button, cancel @@ -108,9 +105,9 @@ define([ var makeTicket = function ($div, common, content, onHide) { var ticketTitle = content.id + ' - ' + content.title; - var answer = h('button.btn.btn-primary.cp-support-answer', Messages.support_answer || 'Answer'); // XXX - var close = h('button.btn.btn-danger.cp-support-close', Messages.support_close || 'Close'); // XXX - var hide = h('button.btn.btn-danger.cp-support-hide', Messages.support_remove || 'Remove'); // 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); + var hide = h('button.btn.btn-danger.cp-support-hide', Messages.support_remove); var actions = h('div.cp-support-list-actions', [ answer, @@ -156,11 +153,10 @@ define([ var privateData = metadataMgr.getPrivateData(); // 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 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)) ]); $(userData).click(function () { @@ -170,9 +166,10 @@ define([ return h('div.cp-support-list-message', { 'data-hash': hash }, [ - h('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), - //Messages._getKey('support_from', [content.sender.name, new Date(content.time)])), // XXX - [h('b', 'From: '), content.sender.name, h('span.cp-support-message-time', content.time ? new Date(content.time).toLocaleString() : '')]), + h('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), [ + h('span', Messages._getKey('support_from', [content.sender.name])), + h('span.cp-support-message-time', content.time ? new Date(content.time).toLocaleString() : '') + ]), h('pre.cp-support-message-content', content.message), isAdmin ? userData : undefined, ]); @@ -186,10 +183,11 @@ define([ return h('div.cp-support-list-message', { 'data-hash': hash }, [ - h('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), - //Messages._getKey('support_from', [content.sender.name, new Date(content.time)])), // XXX - [h('b', 'From: '), content.sender.name, 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('div.cp-support-message-from' + (fromMe ? '.cp-support-fromme' : ''), [ + h('span', Messages._getKey('support_from', [content.sender.name])), + h('span.cp-support-message-time', content.time ? new Date(content.time).toLocaleString() : '') + ]), + h('pre.cp-support-message-content', Messages.support_closed) ]); };