aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates
diff options
context:
space:
mode:
authorwinter2025-01-20 20:10:54 +0000
committerwinter2025-01-20 20:10:54 +0000
commit1b60d5ca77a387122bcf900c2972edca63403155 (patch)
tree0c7357d42dcee447c55ce205c055e4482e766d25 /templates
parent6830e97c22f7e72c08567d2497c0319ab73e6922 (diff)
settings tweaks and "about instance" page
Diffstat (limited to 'templates')
-rw-r--r--templates/about_page.php24
-rw-r--r--templates/global_settings_page.php20
-rw-r--r--templates/left_side_navigation.php11
-rw-r--r--templates/settings_field.php9
4 files changed, 58 insertions, 6 deletions
diff --git a/templates/about_page.php b/templates/about_page.php
new file mode 100644
index 0000000..fdfaaa3
--- /dev/null
+++ b/templates/about_page.php
@@ -0,0 +1,24 @@
+<?php
+use Digitigrade\GlobalSettings;
+
+
+call_template('skeleton', ['pageTitle' => __('about.pageTitle')], function () {
+ $s = GlobalSettings::getInstance();
+ $desc = $s->get('about.description') ?? '';
+ $terms = $s->get('about.terms') ?? '';
+ ?>
+
+ <?php if ($desc == ''): ?>
+ <?php call_template('placeholder_text'); ?>
+ <?php else: ?>
+ <pre class="panel"><?= $desc ?></pre>
+ <?php endif; ?>
+
+ <h2><?= __('about.terms.heading') ?></h2>
+ <?php if ($terms == ''): ?>
+ <?php call_template('placeholder_text'); ?>
+ <?php else: ?>
+ <pre class="panel"><?= $terms ?></pre>
+ <?php endif; ?>
+
+<?php }); \ No newline at end of file
diff --git a/templates/global_settings_page.php b/templates/global_settings_page.php
index fcaf7ab..06c1470 100644
--- a/templates/global_settings_page.php
+++ b/templates/global_settings_page.php
@@ -1,6 +1,22 @@
-<?php call_template('skeleton', [
- 'pageTitle' => sprintf(__('globalSettings.pageTitle'), $prefix)
+<?php
+use Digitigrade\GlobalSettings;
+
+call_template('skeleton', [
+ 'pageTitle' => sprintf(__("globalSettings.pageTitle.$prefix"), $prefix)
], function () {
global $prefix;
+ $s = GlobalSettings::getInstance();
+ ?>
+ <div class="settingsCategories">
+ <span><?= __('globalSettings.categories') ?></span>
+ <ul>
+ <?php foreach ($s->getAllPrefixes() as $p): ?>
+ <?php if ($p == 'settings')
+ continue; ?>
+ <li><a href="/admin/settings/<?= $p ?>"><?= $p ?></a></li>
+ <?php endforeach; ?>
+ </ul>
+ </div>
+ <?php
call_template('settings_editor', ['prefix' => $prefix]);
}); \ No newline at end of file
diff --git a/templates/left_side_navigation.php b/templates/left_side_navigation.php
index 983aa07..f03ee23 100644
--- a/templates/left_side_navigation.php
+++ b/templates/left_side_navigation.php
@@ -15,12 +15,19 @@ if ($user != null) {
if ($user->isAdmin) {
$links[] = ['href' => '/admin/settings/instance', 'icon' => 'settings', 'label' => __('navigation.instanceSettings')];
}
+}
+$links[] = [
+ 'href' => '/about',
+ 'icon' => 'info',
+ 'label' => __('about.pageTitle')
+];
+if ($user != null) {
$links[] = [
'href' => '/logout',
'icon' => 'logout',
'label' => __('navigation.logout'),
'confirmation' => __('navigation.logout.confirmation')
];
-
- call_template('side_navigation', ['links' => $links]);
}
+
+call_template('side_navigation', ['links' => $links]);
diff --git a/templates/settings_field.php b/templates/settings_field.php
index c0f0f7d..1ebbfb3 100644
--- a/templates/settings_field.php
+++ b/templates/settings_field.php
@@ -1,7 +1,8 @@
<?php
$id = "setting-$key";
-$inputType = 'text';
-if (($type ?? null) == 'boolean') {
+$settingType = $type ?? 'text';
+$inputType = $settingType;
+if ($settingType == 'boolean') {
$inputType = 'select';
$options = ['true', 'false'];
}
@@ -23,6 +24,10 @@ $fieldName = str_replace('.', '<DOT>', $key);
<?php endforeach; ?>
</select>
+ <?php elseif ($inputType == 'longtext'): ?>
+
+ <textarea id="<?= $id ?>" name="<?= $fieldName ?>" autocomplete="off"><?= $value ?></textarea>
+
<?php else: ?>
<input id="<?= $id ?>" name="<?= $fieldName ?>" value="<?= $value ?>" type="<?= $inputType ?>" autocomplete="off">