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> <h1 class="h4 mb-0">Mon profil</h1>
</div> </div>
<div class="row"> <?php if ($profileSuccess): ?>
<div class="col-md-6 col-lg-4"> <div class="alert alert-success py-2 small mb-3">Profil mis à jour.</div>
<div class="card"> <?php endif; ?>
<div class="card-body"> <?php if ($profileError !== ''): ?>
<?php if ($profileSuccess): ?> <div class="alert alert-danger py-2 small mb-3"><?= htmlspecialchars($profileError) ?></div>
<div class="alert alert-success py-2 small mb-3">Profil mis à jour.</div> <?php endif; ?>
<?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"> <form method="post" action="/profile">
<div class="mb-3"> <div class="row g-4">
<label class="form-label fw-semibold" for="display_name">Nom affiché</label>
<input type="text" id="display_name" name="display_name" <!-- Colonne gauche : identité -->
class="form-control" <div class="col-md-4">
value="<?= htmlspecialchars($profileCurrentName) ?>" <div class="card h-100">
placeholder="Prénom Nom" required> <div class="card-header small fw-semibold">Identité</div>
<div class="form-text"> <div class="card-body d-flex flex-column gap-3">
Affiché comme auteur sur vos articles. <div>
<?php if (($profileCurrentSlug ?? '') !== ''): ?> <label class="form-label fw-semibold" for="display_name">Nom affiché</label>
Page publique : <a href="/profil/<?= rawurlencode($profileCurrentSlug) ?>">/profil/<?= htmlspecialchars($profileCurrentSlug) ?></a> <input type="text" id="display_name" name="display_name"
<?php endif; ?> class="form-control"
</div> value="<?= htmlspecialchars($profileCurrentName) ?>"
</div> placeholder="Prénom Nom" required>
<div class="mb-3"> <div class="form-text">
<label class="form-label fw-semibold" for="bio">Biographie</label> Affiché comme auteur sur vos articles.
<textarea id="bio" name="bio" class="form-control" rows="4" <?php if (($profileCurrentSlug ?? '') !== ''): ?>
placeholder="Quelques mots sur vous…"><?= htmlspecialchars($profileCurrentBio ?? '') ?></textarea> <br>Page publique : <a href="/profil/<?= rawurlencode($profileCurrentSlug) ?>">/profil/<?= htmlspecialchars($profileCurrentSlug) ?></a>
<div class="form-text">Affichée sur votre page de profil public.</div> <?php endif; ?>
</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>
</div> </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> <button type="submit" class="btn btn-primary w-100">Enregistrer</button>
</form> </div>
</div> </div>
</div> </div>
</div> </div>
<?php <!-- Colonne droite : page publique -->
$pdo = dbPdo(); <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 = []; $_profileRoles = [];
if ($pdo) { if ($pdo) {
$st = $pdo->prepare( $st = $pdo->prepare(
@@ -70,15 +86,17 @@ if ($pdo) {
$_profileRoles = $st->fetchAll(PDO::FETCH_ASSOC); $_profileRoles = $st->fetchAll(PDO::FETCH_ASSOC);
} }
if (!empty($_profileRoles)): ?> if (!empty($_profileRoles)): ?>
<div class="col-md-6 col-lg-8 mt-4 mt-md-0"> <div class="mt-4">
<h2 class="h6 text-muted mb-3">Rôles &amp; droits</h2> <h2 class="h6 text-muted mb-3">Rôles &amp; droits</h2>
<?php foreach ($_profileRoles as $_role): <div class="row g-3">
$_caps = array_filter( <?php foreach ($_profileRoles as $_role):
explode(',', trim((string)$_role['caps'], '{}')), $_caps = array_filter(
static fn ($c) => $c !== '' explode(',', trim((string)$_role['caps'], '{}')),
); static fn ($c) => $c !== ''
?> );
<div class="card mb-3"> ?>
<div class="col-md-4">
<div class="card">
<div class="card-header d-flex align-items-center gap-2 py-2"> <div class="card-header d-flex align-items-center gap-2 py-2">
<strong><?= htmlspecialchars($_role['label']) ?></strong> <strong><?= htmlspecialchars($_role['label']) ?></strong>
<code class="text-muted small"><?= htmlspecialchars($_role['name']) ?></code> <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> <div class="card-body py-2 small text-muted">Aucun droit associé à ce rôle.</div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php endforeach; ?>
</div> </div>
<?php endif; ?> <?php endforeach; ?>
</div>
</div> </div>
<?php endif; ?>
<?php <?php
$content = ob_get_clean(); $content = ob_get_clean();