aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorwinter2025-01-01 17:41:22 +0000
committerwinter2025-01-01 17:41:22 +0000
commit02a6acd4cfddaecd9075b706fdbdc0396d76d8c3 (patch)
tree8b18236ba74c260774350a330798aaaced215882 /templates
parent4cd7017da9a37e5b9f38c3f50dd1c904ea41cbcb (diff)
stuff
Diffstat (limited to 'templates')
-rw-r--r--templates/navigation_links.php12
-rw-r--r--templates/skeleton.php19
2 files changed, 22 insertions, 9 deletions
diff --git a/templates/navigation_links.php b/templates/navigation_links.php
new file mode 100644
index 0000000..1540491
--- /dev/null
+++ b/templates/navigation_links.php
@@ -0,0 +1,12 @@
+<?php
+use Digitigrade\Router;
+?>
+<ul>
+ <?php foreach ($links as $href => $name): ?>
+ <?php if (Router::getInstance()->getCurrentPath() == $href): ?>
+ <li><span class="navlink disabled"><?= $name ?></span></li>
+ <?php else: ?>
+ <li><a class="navlink" href="<?= $href ?>"><?= $name ?></a></li>
+ <?php endif; ?>
+ <?php endforeach; ?>
+</ul> \ No newline at end of file
diff --git a/templates/skeleton.php b/templates/skeleton.php
index 94bc2f2..8ac1549 100644
--- a/templates/skeleton.php
+++ b/templates/skeleton.php
@@ -11,21 +11,22 @@ $user = Digitigrade\Model\UserAccount::findByCurrentSession();
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:FILL@0..1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://unpkg.com/htmx.org@2.0.4"></script>
+ <script src="/static/language-switch.js" defer></script>
</head>
<body hx-boost="true">
<header>
<nav>
- <ul>
- <li><a href="/feed/global"><?= __('timeline.global.shortName') ?></a></li>
- <li><a href="/feed/local"><?= __('timeline.local.shortName') ?></a></li>
- </ul>
+ <?php call_template('navigation_links', ['links' => [
+ '/feed/global' => __('timeline.global.shortName'),
+ '/feed/local' => __('timeline.local.shortName'),
+ ]]); ?>
<span id="siteTitle"><?= __('digitigrade') ?></span>
- <?php if ($user == null): ?>
- <ul>
- <li><a href="/login"><?= __('navigation.login') ?></a></li>
- </ul>
- <?php else: ?>
+ <?php if ($user == null):
+ call_template('navigation_links', ['links' => [
+ '/login' => __('navigation.login')
+ ]]);
+ else: ?>
<div>
<?php call_template('actor_avatar', ['actor' => $user->actor]) ?>
<?= $user->actor->displayName ?>