mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
feat: student name popover preview on /repertoire via htmx
This commit is contained in:
@@ -1,28 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Partial: student popover preview.
|
||||
* Partial: student popover preview card(s).
|
||||
*
|
||||
* Expected variables:
|
||||
* $theses array rows of [id => int, title => string]
|
||||
* $theses array rows from Database::getThesesByAuthorName()
|
||||
* $name string student name
|
||||
*/
|
||||
|
||||
foreach ($theses as $t):
|
||||
$synopsis = $t['synopsis'] ?? '';
|
||||
// Truncate synopsis to ~160 chars
|
||||
if (mb_strlen($synopsis) > 160) {
|
||||
$synopsis = mb_substr($synopsis, 0, 157) . '…';
|
||||
}
|
||||
$meta = array_filter([
|
||||
$t['year'] ?? null,
|
||||
$t['orientation'] ?? null,
|
||||
$t['finality_type'] ?? null,
|
||||
]);
|
||||
?>
|
||||
<?php if (count($theses) === 1): ?>
|
||||
<iframe
|
||||
src="/tfe?id=<?= (int)$theses[0]['id'] ?>"
|
||||
class="student-preview__iframe"
|
||||
loading="lazy"
|
||||
title="Aperçu — <?= htmlspecialchars($name) ?>"
|
||||
></iframe>
|
||||
<?php else: ?>
|
||||
<p class="student-preview__name"><?= htmlspecialchars($name) ?></p>
|
||||
<ul class="student-preview__list">
|
||||
<?php foreach ($theses as $t): ?>
|
||||
<li>
|
||||
<a href="/tfe?id=<?= (int)$t['id'] ?>" class="student-preview__link">
|
||||
<?= htmlspecialchars($t['title']) ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<a href="/tfe?id=<?= (int)$t['id'] ?>" class="student-card">
|
||||
<?php if (!empty($t['banner_path'])): ?>
|
||||
<div class="student-card__banner" style="background-image:url('<?= htmlspecialchars($t['banner_path']) ?>')"></div>
|
||||
<?php else: ?>
|
||||
<div class="student-card__banner student-card__banner--gradient">
|
||||
<span class="student-card__gradient-author"><?= htmlspecialchars($t['authors'] ?? '') ?></span>
|
||||
<span class="student-card__gradient-title"><?= htmlspecialchars($t['title']) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="student-card__body">
|
||||
<p class="student-card__meta"><?= htmlspecialchars(implode(' · ', $meta)) ?></p>
|
||||
<h3 class="student-card__title"><?= htmlspecialchars($t['title']) ?></h3>
|
||||
<?php if (!empty($t['subtitle'])): ?>
|
||||
<p class="student-card__subtitle"><?= htmlspecialchars($t['subtitle']) ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ($synopsis !== ''): ?>
|
||||
<p class="student-card__synopsis"><?= htmlspecialchars($synopsis) ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
|
||||
Reference in New Issue
Block a user