diff options
| author | winter | 2025-02-14 22:47:05 +0000 |
|---|---|---|
| committer | winter | 2025-02-14 22:47:05 +0000 |
| commit | 65dfe7aff06dfd3b044a5deb47b03d643c651ec1 (patch) | |
| tree | d86894a978336edaeb269a25944c1ed2dacc80e3 | |
| parent | 5af36fccc0904cf743e3d598813d246e3fa52634 (diff) | |
add pronouns to profiles and notes
| -rw-r--r-- | locale/en_GB.json | 1 | ||||
| -rw-r--r-- | routes/actor_profile_fragment.php | 1 | ||||
| -rw-r--r-- | static/form.css | 8 | ||||
| -rw-r--r-- | static/profile.css | 1 | ||||
| -rw-r--r-- | templates/actor_profile.php | 1 | ||||
| -rw-r--r-- | templates/actor_profile_editable.php | 13 | ||||
| -rw-r--r-- | templates/note.php | 7 |
7 files changed, 28 insertions, 4 deletions
diff --git a/locale/en_GB.json b/locale/en_GB.json index 081ae87..d734f85 100644 --- a/locale/en_GB.json +++ b/locale/en_GB.json @@ -15,6 +15,7 @@ "user.profile.unblock": "Unblock", "user.profile.unblock.confirm": "Are you sure you want to unblock this user?", "user.profile.displayName": "Display name", + "user.profile.pronouns": "Pronouns", "user.profile.changeAvatar": "Choose a new avatar image", "user.profile.resetAvatar": "Reset avatar", "user.profile.avatarReset": "Avatar reset!", diff --git a/routes/actor_profile_fragment.php b/routes/actor_profile_fragment.php index 45f4487..f2d0004 100644 --- a/routes/actor_profile_fragment.php +++ b/routes/actor_profile_fragment.php @@ -69,6 +69,7 @@ Router::getInstance()->mount('/fragment/profile', function (array $args) { if (strlen($actor->displayName) <= 0) { $actor->displayName = $actor->handle; } + $actor->pronouns = trim($_POST['pronouns'] ?? '') ?: null; $actor->bio = trim($_POST['bio'] ?? ''); if (isset($_FILES['avatar'])) { diff --git a/static/form.css b/static/form.css index e293b59..7b38860 100644 --- a/static/form.css +++ b/static/form.css @@ -9,6 +9,13 @@ form:not(.nopanel) { gap: var(--spacing-single); max-width: max-content; + .row:has(> .column) { + display: grid; + grid-auto-flow: column; + grid-auto-columns: 1fr; + gap: var(--spacing-single); + } + label:has(+ input, + textarea, + select), label.standalone, .hint { @@ -41,6 +48,7 @@ form:not(.nopanel) { } textarea { resize: vertical; + height: 5lh; } button:not(.inline) { width: 100%; diff --git a/static/profile.css b/static/profile.css index c2e48ed..a46a9a3 100644 --- a/static/profile.css +++ b/static/profile.css @@ -9,6 +9,7 @@ display: grid; grid-template-columns: max-content 1fr max-content; gap: var(--spacing-double); + line-height: 1.5; > * { overflow: hidden; diff --git a/templates/actor_profile.php b/templates/actor_profile.php index 4692a53..ca19978 100644 --- a/templates/actor_profile.php +++ b/templates/actor_profile.php @@ -16,6 +16,7 @@ $user = UserAccount::findByCurrentSession(); <div> <div class="displayName"><?= htmlspecialchars($actor->displayName) ?></div> + <div class="pronouns"><?= htmlspecialchars($actor->pronouns) ?></div> <div class="handle">@<?= $actor->getFullHandle() ?></div> <div class="joinedDate"><?= sprintf(__('user.profile.createdAt'), $actor->created->format('Y-m-d')) ?> </div> diff --git a/templates/actor_profile_editable.php b/templates/actor_profile_editable.php index 1370e53..6ff5d8c 100644 --- a/templates/actor_profile_editable.php +++ b/templates/actor_profile_editable.php @@ -3,9 +3,16 @@ <?php call_template('actor_avatar', ['actor' => $actor]); ?> <div> <div class="row"> - <label for="profileDisplayName"><?= __('user.profile.displayName') ?></label> - <input id="profileDisplayName" name="displayName" type="text" required - value="<?= $actor->displayName ?>"> + <div class="column"> + <label for="profileDisplayName"><?= __('user.profile.displayName') ?></label> + <input id="profileDisplayName" name="displayName" type="text" required + value="<?= htmlspecialchars($actor->displayName) ?>"> + </div> + <div class="column"> + <label for="profilePronouns"><?= __('user.profile.pronouns') ?></label> + <input id="profilePronouns" name="pronouns" type="text" + value="<?= htmlspecialchars($actor->pronouns) ?>"> + </div> </div> <div class="handle">@<?= $actor->getFullHandle() ?></div> <div class="joinedDate"><?= sprintf(__('user.profile.createdAt'), $actor->created->format('Y-m-d')) ?></div> diff --git a/templates/note.php b/templates/note.php index 736d5f9..81f7e38 100644 --- a/templates/note.php +++ b/templates/note.php @@ -25,7 +25,12 @@ if ($user != null) { <div class="infoLine"> <a class="authorName" href="/@/<?= htmlspecialchars($note->author->getFullHandle()) ?>"><?= htmlspecialchars($note->author->displayName) ?></a> - <span class="authorHandle">@<?= htmlspecialchars($note->author->getFullHandle()) ?></span> + <span class="authorHandle"> + <?php if (isset($note->author->pronouns) && trim($note->author->pronouns) != ''): ?> + <?= htmlspecialchars($note->author->pronouns) ?> • + <?php endif; ?> + @<?= htmlspecialchars($note->author->getFullHandle()) ?> + </span> <a class="timestamp" href="/@/<?= htmlspecialchars($note->author->getFullHandle()) ?>/note/<?= $note->id ?>"> <?= format_datetime($note->created, $prefs?->get('locale.timezone')) |
