From e60cfc15db6b1b0c38e6d762d953ad32799f5aa5 Mon Sep 17 00:00:00 2001 From: Niko Date: Wed, 16 Feb 2022 21:41:14 +0100 Subject: [PATCH] Improved defaults for templates in pages.meet --- web/src/app/css/app.css | 4 ++++ web/src/app/js/pages/meet.js | 19 +++++++++++++------ web/src/config/lang/en.php | 1 + web/src/config/lang/es.php | 1 + 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/web/src/app/css/app.css b/web/src/app/css/app.css index 7777f0f..bf71566 100644 --- a/web/src/app/css/app.css +++ b/web/src/app/css/app.css @@ -138,6 +138,10 @@ main { .meet.item .status-content .text p { margin: 0 !important; } +.meet.item .status-content .text a { + color: #fdc4ff; + text-decoration: none; +} .meet.item .status .profile { padding: 1em 2em; } .meet.item .status .date { width: max-content; diff --git a/web/src/app/js/pages/meet.js b/web/src/app/js/pages/meet.js index 80aa90d..a0b0a15 100644 --- a/web/src/app/js/pages/meet.js +++ b/web/src/app/js/pages/meet.js @@ -20,17 +20,24 @@ app.pages.meet = { const dom = document.querySelector('#page-meet #content'); dom.innerHTML = ''; for (var i = 0; i < json.length; i++) { - var tpl = app.template.fill(json[i], app.template.get('meet.item'), + var item = json[i]; + if (item.props === undefined) + item.props = { pcolors: {} } + if (item.account.props.age === undefined) + item.account.props.age = '??'; + if (item.account.props.gender === undefined) + item.account.props.gender = 'unspecified'; + if (item.account.props.place === undefined) + item.account.props.place = app.strings.app.the_fediverse; + if (item.account.props.pcolors === undefined) + item.account.props.pcolors = {}; + + var tpl = app.template.fill(item, app.template.get('meet.item'), function (k,v) { if (k === 'text') return html2text(v); if (k === 'account.name') return capitalize(v); if (k === 'date') return dayjs(v).fromNow(true); }); - var item = json[i]; - if (item.props === undefined) - item.props = { pcolors: {} } - if (item.account.props.pcolors === undefined) - item.account.props.pcolors = {}; var postFgColor = item.account.props.pcolors.fg || app.vars.defaults.meet.item_pcolors.fg; diff --git a/web/src/config/lang/en.php b/web/src/config/lang/en.php index 3c00489..c64644d 100644 --- a/web/src/config/lang/en.php +++ b/web/src/config/lang/en.php @@ -12,5 +12,6 @@ $strings = [ ], 'app' => [ 'years_old' => 'y/o', + 'the_fediverse' => 'The Fediverse', ], ]; diff --git a/web/src/config/lang/es.php b/web/src/config/lang/es.php index cd44b1e..5a3edf3 100644 --- a/web/src/config/lang/es.php +++ b/web/src/config/lang/es.php @@ -12,5 +12,6 @@ $strings = [ ], 'app' => [ 'years_old' => 'AƱos', + 'the_fediverse' => 'El Fediverso', ], ];