aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/preferences_form.php
diff options
context:
space:
mode:
authorwinter2025-02-07 18:26:05 +0000
committerwinter2025-02-07 18:26:05 +0000
commitd18ec187847893f94418b29bc6a087d6b2dd9a2d (patch)
tree8ea4451cb1f62f8041eae71ca60ec2b64fafe8b2 /templates/preferences_form.php
parent43f0b9f41a582925838b2ba686110b2f07576be3 (diff)
localise note timestamps and stuff
Diffstat (limited to 'templates/preferences_form.php')
-rw-r--r--templates/preferences_form.php31
1 files changed, 15 insertions, 16 deletions
diff --git a/templates/preferences_form.php b/templates/preferences_form.php
index 8c8f203..33418f6 100644
--- a/templates/preferences_form.php
+++ b/templates/preferences_form.php
@@ -2,27 +2,26 @@
use Digitigrade\UserSettings;
$settings = new UserSettings($user);
+
+function _user_pref(string $id, mixed $value, string $type) {
+ call_template('settings_field', [
+ 'id' => "pref-$id",
+ 'fieldName' => $id,
+ 'name' => __("preferences.$id.name"),
+ 'description' => __("preferences.$id.description"),
+ 'value' => $value,
+ 'type' => $type
+ ]);
+}
+
?>
<form class="settings" method="post" action="/todo" hx-post="/fragment/preferences" hx-disabled-elt="find button"
hx-swap="outerHTML">
<?php
- call_template('settings_field', [
- 'id' => 'pref-requestToFollow',
- 'fieldName' => 'requestToFollow',
- 'name' => __('preferences.requestToFollow.name'),
- 'description' => __('preferences.requestToFollow.description'),
- 'value' => $user->actor->requestToFollow,
- 'type' => 'boolean'
- ]);
- call_template('settings_field', [
- 'id' => 'pref-smallIndicators',
- 'fieldName' => 'smallIndicators',
- 'name' => __('preferences.smallIndicators.name'),
- 'description' => __('preferences.smallIndicators.description'),
- 'value' => $settings->getBool('interface.smallUnreadIndicators'),
- 'type' => 'boolean'
- ]);
+ _user_pref('requestToFollow', $user->actor->requestToFollow, 'boolean');
+ _user_pref('smallIndicators', $settings->getBool('interface.smallUnreadIndicators'), 'boolean');
+ _user_pref('timezone', $settings->get('locale.timezone'), 'timezone');
?>
<div class="row">