diff options
| author | winter | 2025-03-16 01:49:15 +0000 |
|---|---|---|
| committer | winter | 2025-03-16 01:49:15 +0000 |
| commit | 23ddb01a20788da2c98c4d5bb9bd271ceff532c8 (patch) | |
| tree | 50846f7741fcfb2ed37d1103405366d630281255 /templates | |
| parent | 145b5db9474e32ca3430fe35eaa7498d7f26ff95 (diff) | |
avoid loading whole page every time
but also problem introduced: mobilepanes are now no longer boosted (it was causing trouble)
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/mobilepane_left.php | 2 | ||||
| -rw-r--r-- | templates/mobilepane_right.php | 2 | ||||
| -rw-r--r-- | templates/skeleton.php | 29 |
3 files changed, 24 insertions, 9 deletions
diff --git a/templates/mobilepane_left.php b/templates/mobilepane_left.php index 29be318..83e9e4a 100644 --- a/templates/mobilepane_left.php +++ b/templates/mobilepane_left.php @@ -13,7 +13,7 @@ $settings = GlobalSettings::getInstance(); <?php call_template('head_tags'); ?> </head> -<body hx-boost="true"> +<body> <header> <nav> <a id="leftPaneActivator" class="inlineIcon material-symbols close" _="on click go back"></a> diff --git a/templates/mobilepane_right.php b/templates/mobilepane_right.php index 2a72c6e..02749ac 100644 --- a/templates/mobilepane_right.php +++ b/templates/mobilepane_right.php @@ -12,7 +12,7 @@ $settings = GlobalSettings::getInstance(); <?php call_template('head_tags'); ?> </head> -<body hx-boost="true"> +<body> <header> <nav> <span> diff --git a/templates/skeleton.php b/templates/skeleton.php index 62090bd..c9e28c5 100644 --- a/templates/skeleton.php +++ b/templates/skeleton.php @@ -1,16 +1,23 @@ <?php use Digitigrade\GlobalSettings; -use Digitigrade\Model\FollowRelation; use Digitigrade\Model\UserAccount; $user = UserAccount::findByCurrentSession(); $settings = GlobalSettings::getInstance(); + +$fullTitle = $pageTitle . ' — ' . $settings->get('instance.name'); + +$loadPartialPage = isset($_SERVER['HTTP_HX_REQUEST']); +if ($loadPartialPage) { + echo '<title>' . htmlspecialchars($fullTitle) . '</title>'; + goto skipStart; +} ?> <!DOCTYPE html> <html lang="<?= get_ui_language() ?>"> <head> - <title><?= $pageTitle ?> — <?= $settings->get('instance.name') ?></title> + <title><?= htmlspecialchars($fullTitle) ?></title> <!-- metadata for link previews --> <meta property="og:type" content="<?= $ogType ?? 'website' ?>"> <meta name="twitter:card" content="summary"> @@ -38,11 +45,13 @@ $settings = GlobalSettings::getInstance(); <?php call_template('head_tags'); ?> </head> -<body hx-boost="true" hx-indicator="#loadingIndicator"> +<body hx-boost="true" hx-indicator="#loadingIndicator" hx-target="#centrePane" hx-swap="outerHTML show:window:top"> <header> - <nav> + <?php skipStart: ?> + <nav id="nav" <?= $loadPartialPage ? 'hx-swap-oob="true"' : '' ?>> <?php if ($user != null): ?> - <a id="leftPaneActivator" href="/mobilepane/left" class="inlineIcon material-symbols menu"></a> + <a id="leftPaneActivator" href="/mobilepane/left" class="inlineIcon material-symbols menu" + hx-boost="false"></a> <?php else: ?> <span id="leftPaneActivator"></span> <?php endif; ?> @@ -59,7 +68,8 @@ $settings = GlobalSettings::getInstance(); <img id="loadingIndicator" class="htmx-indicator" src="/static/tail-spin.svg"> <?php if ($user != null): ?> - <a id="rightPaneActivator" href="/mobilepane/right" class="inlineIcon material-symbols notifications"></a> + <a id="rightPaneActivator" href="/mobilepane/right" class="inlineIcon material-symbols notifications" + hx-boost="false"></a> <?php endif; ?> <?php if ($user == null): @@ -73,6 +83,8 @@ $settings = GlobalSettings::getInstance(); </a> <?php endif; ?> </nav> + <?php if ($loadPartialPage) + goto skipToMainContent; ?> </header> <main> <div> @@ -83,16 +95,19 @@ $settings = GlobalSettings::getInstance(); } call_template('navigation/left_side'); ?> - <p class="versionInfo"><?= sprintf(__('version'), get_version()) ?></p> + <p class="versionInfo"><?= __f('version', get_version()) ?></p> </section> </div> <div> + <?php skipToMainContent: ?> <section id="centrePane"> <?php if (!isset($renderTitleHeading) || $renderTitleHeading): ?> <h1><?= $pageTitle ?></h1> <?php endif; ?> <?php slot(); ?> </section> + <?php if ($loadPartialPage) + exit; ?> </div> <div> <section id="rightPane"> |
