aboutsummaryrefslogtreecommitdiffhomepage
path: root/templates/admin
diff options
context:
space:
mode:
Diffstat (limited to 'templates/admin')
-rw-r--r--templates/admin/overview_page.php13
-rw-r--r--templates/admin/plugin_card.php30
-rw-r--r--templates/admin/plugin_download_form.php16
-rw-r--r--templates/admin/plugins_page.php18
4 files changed, 77 insertions, 0 deletions
diff --git a/templates/admin/overview_page.php b/templates/admin/overview_page.php
new file mode 100644
index 0000000..d3325ef
--- /dev/null
+++ b/templates/admin/overview_page.php
@@ -0,0 +1,13 @@
+<?php call_template('skeleton', ['pageTitle' => __('admin.pageTitle')], function () {
+ call_template('navigation/side_links', ['links' => [
+ [
+ 'icon' => 'settings-outline',
+ 'label' => __('globalSettings.category.instance'),
+ 'href' => '/admin/settings/instance'
+ ], [
+ 'icon' => 'extension-outline',
+ 'label' => __('admin.plugins.pageTitle'),
+ 'href' => '/admin/plugins'
+ ]
+ ]]);
+}); \ No newline at end of file
diff --git a/templates/admin/plugin_card.php b/templates/admin/plugin_card.php
new file mode 100644
index 0000000..4a32e07
--- /dev/null
+++ b/templates/admin/plugin_card.php
@@ -0,0 +1,30 @@
+<?php
+/** @var \Digitigrade\PluginMetadata $meta */
+/** @var string $filename */
+?>
+
+<?php if (isset($meta->homepage)): ?>
+ <a href="<?= htmlspecialchars($meta->homepage) ?>" target="_blank">
+ <?php endif; ?>
+
+ <div class="pluginCard">
+ <div class="pluginInfo">
+ <div class="name"><?= $meta->name ?></div>
+ <div class="version"><?= __f('admin.plugins.version', htmlspecialchars($meta->version)) ?></div>
+ <div class="author"><?= __f('admin.plugins.author', htmlspecialchars($meta->author)) ?></div>
+ <div class="filename"><?= htmlspecialchars($filename) ?></div>
+ </div>
+
+ <div class="actionButtons">
+ <button type="button" class="secondary" hx-delete="/fragment/admin/plugins/<?= urlencode($filename) ?>"
+ hx-confirm="<?= __('admin.plugins.delete.confirm') ?>" hx-target="closest .pluginCard" hx-swap="delete"
+ hx-disabled-elt="this">
+ <span class="material-symbols delete-outline"></span>
+ <span><?= __('admin.plugins.delete.action') ?></span>
+ </button>
+ </div>
+ </div>
+
+ <?php if (isset($meta->homepage)): ?>
+ </a>
+<?php endif; ?> \ No newline at end of file
diff --git a/templates/admin/plugin_download_form.php b/templates/admin/plugin_download_form.php
new file mode 100644
index 0000000..2e9b2a8
--- /dev/null
+++ b/templates/admin/plugin_download_form.php
@@ -0,0 +1,16 @@
+<form class="pluginDownloadForm" hx-post="/fragment/admin/plugins/download" hx-target="this" hx-swap="outerHTML"
+ hx-disabled-elt="find button">
+ <div class="row">
+ <div class="column">
+ <label for="pluginUrl"><?= __('admin.plugins.download.url.label') ?></label>
+ <input type="url" id="pluginUrl" name="url" required autocomplete="off"
+ placeholder="<?= __('admin.plugins.download.url.placeholder') ?>">
+ </div>
+ <div class="column">
+ <button type="submit" class="primary"><?= __('admin.plugins.download.action') ?></button>
+ </div>
+ </div>
+ <?php if ($success ?? false): ?>
+ <span hidden _="on load js location.reload() end"></span>
+ <?php endif; ?>
+</form> \ No newline at end of file
diff --git a/templates/admin/plugins_page.php b/templates/admin/plugins_page.php
new file mode 100644
index 0000000..e32536b
--- /dev/null
+++ b/templates/admin/plugins_page.php
@@ -0,0 +1,18 @@
+<?php
+
+use Digitigrade\PluginLoader;
+
+call_template('skeleton', ['pageTitle' => __('admin.plugins.pageTitle')], function () { ?>
+ <?php call_template('alertbox', ['variety' => 'info', 'message' => __('admin.plugins.info')]); ?>
+
+ <h2><?= __('admin.plugins.loaded') ?></h2>
+ <?php foreach (PluginLoader::$loadedPlugins as $filename => $metadata) {
+ call_template('admin/plugin_card', ['meta' => $metadata, 'filename' => basename($filename)]);
+ }
+ if (count(PluginLoader::$loadedPlugins) == 0) {
+ call_template('placeholder_text');
+ } ?>
+
+ <h2><?= __('admin.plugins.download.heading') ?></h2>
+ <?php call_template('admin/plugin_download_form'); ?>
+<?php }); \ No newline at end of file