ux: bio et URL externe déplacées dans un bloc à droite sur /profile

This commit is contained in:
Cedric Abonnel
2026-05-12 23:54:38 +02:00
parent d5bf3072f4
commit 03177dc732
+74 -55
View File
@@ -4,57 +4,73 @@
<h1 class="h4 mb-0">Mon profil</h1>
</div>
<div class="row">
<div class="col-md-6 col-lg-4">
<div class="card">
<div class="card-body">
<?php if ($profileSuccess): ?>
<div class="alert alert-success py-2 small mb-3">Profil mis à jour.</div>
<?php endif; ?>
<?php if ($profileError !== ''): ?>
<div class="alert alert-danger py-2 small mb-3"><?= htmlspecialchars($profileError) ?></div>
<?php endif; ?>
<?php if ($profileSuccess): ?>
<div class="alert alert-success py-2 small mb-3">Profil mis à jour.</div>
<?php endif; ?>
<?php if ($profileError !== ''): ?>
<div class="alert alert-danger py-2 small mb-3"><?= htmlspecialchars($profileError) ?></div>
<?php endif; ?>
<form method="post" action="/profile">
<div class="mb-3">
<label class="form-label fw-semibold" for="display_name">Nom affiché</label>
<input type="text" id="display_name" name="display_name"
class="form-control"
value="<?= htmlspecialchars($profileCurrentName) ?>"
placeholder="Prénom Nom" required>
<div class="form-text">
Affiché comme auteur sur vos articles.
<?php if (($profileCurrentSlug ?? '') !== ''): ?>
Page publique : <a href="/profil/<?= rawurlencode($profileCurrentSlug) ?>">/profil/<?= htmlspecialchars($profileCurrentSlug) ?></a>
<?php endif; ?>
</div>
</div>
<div class="mb-3">
<label class="form-label fw-semibold" for="bio">Biographie</label>
<textarea id="bio" name="bio" class="form-control" rows="4"
placeholder="Quelques mots sur vous…"><?= htmlspecialchars($profileCurrentBio ?? '') ?></textarea>
<div class="form-text">Affichée sur votre page de profil public.</div>
</div>
<div class="mb-3">
<label class="form-label fw-semibold" for="profile_url">URL de profil externe</label>
<input type="url" id="profile_url" name="profile_url"
class="form-control"
value="<?= htmlspecialchars($profileCurrentUrl ?? '') ?>"
placeholder="https://example.com/~vous">
<div class="form-text">Lien vers un site ou profil externe (utilisé dans les métadonnées article:author, JSON-LD).</div>
</div>
<div class="mb-3">
<label class="form-label fw-semibold text-muted">Email</label>
<input type="text" class="form-control" value="<?= htmlspecialchars(currentUserEmail() ?? '') ?>" disabled>
<form method="post" action="/profile">
<div class="row g-4">
<!-- Colonne gauche : identité -->
<div class="col-md-4">
<div class="card h-100">
<div class="card-header small fw-semibold">Identité</div>
<div class="card-body d-flex flex-column gap-3">
<div>
<label class="form-label fw-semibold" for="display_name">Nom affiché</label>
<input type="text" id="display_name" name="display_name"
class="form-control"
value="<?= htmlspecialchars($profileCurrentName) ?>"
placeholder="Prénom Nom" required>
<div class="form-text">
Affiché comme auteur sur vos articles.
<?php if (($profileCurrentSlug ?? '') !== ''): ?>
<br>Page publique : <a href="/profil/<?= rawurlencode($profileCurrentSlug) ?>">/profil/<?= htmlspecialchars($profileCurrentSlug) ?></a>
<?php endif; ?>
</div>
</div>
<div>
<label class="form-label fw-semibold text-muted">Email</label>
<input type="text" class="form-control" value="<?= htmlspecialchars(currentUserEmail() ?? '') ?>" disabled>
</div>
<div class="mt-auto">
<button type="submit" class="btn btn-primary w-100">Enregistrer</button>
</form>
</div>
</div>
</div>
</div>
<?php
$pdo = dbPdo();
<!-- Colonne droite : page publique -->
<div class="col-md-8">
<div class="card h-100">
<div class="card-header small fw-semibold">Page publique</div>
<div class="card-body d-flex flex-column gap-3">
<div>
<label class="form-label fw-semibold" for="bio">Biographie</label>
<textarea id="bio" name="bio" class="form-control" rows="5"
placeholder="Quelques mots sur vous…"><?= htmlspecialchars($profileCurrentBio ?? '') ?></textarea>
<div class="form-text">Affichée sur votre page de profil public.</div>
</div>
<div>
<label class="form-label fw-semibold" for="profile_url">URL externe</label>
<input type="url" id="profile_url" name="profile_url"
class="form-control"
value="<?= htmlspecialchars($profileCurrentUrl ?? '') ?>"
placeholder="https://example.com/~vous">
<div class="form-text">Lien vers un site ou profil externe (utilisé dans les métadonnées article:author, JSON-LD).</div>
</div>
</div>
</div>
</div>
</div>
</form>
<?php
$pdo = dbPdo();
$_profileRoles = [];
if ($pdo) {
$st = $pdo->prepare(
@@ -70,15 +86,17 @@ if ($pdo) {
$_profileRoles = $st->fetchAll(PDO::FETCH_ASSOC);
}
if (!empty($_profileRoles)): ?>
<div class="col-md-6 col-lg-8 mt-4 mt-md-0">
<h2 class="h6 text-muted mb-3">Rôles &amp; droits</h2>
<?php foreach ($_profileRoles as $_role):
$_caps = array_filter(
explode(',', trim((string)$_role['caps'], '{}')),
static fn ($c) => $c !== ''
);
?>
<div class="card mb-3">
<div class="mt-4">
<h2 class="h6 text-muted mb-3">Rôles &amp; droits</h2>
<div class="row g-3">
<?php foreach ($_profileRoles as $_role):
$_caps = array_filter(
explode(',', trim((string)$_role['caps'], '{}')),
static fn ($c) => $c !== ''
);
?>
<div class="col-md-4">
<div class="card">
<div class="card-header d-flex align-items-center gap-2 py-2">
<strong><?= htmlspecialchars($_role['label']) ?></strong>
<code class="text-muted small"><?= htmlspecialchars($_role['name']) ?></code>
@@ -94,10 +112,11 @@ if (!empty($_profileRoles)): ?>
<div class="card-body py-2 small text-muted">Aucun droit associé à ce rôle.</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
<?php
$content = ob_get_clean();