Admin mobile block: fix inline style beating media query

This commit is contained in:
Pontoporeia
2026-05-09 20:51:44 +02:00
parent 6614b04dbd
commit a80b2c08bf
9 changed files with 149 additions and 11 deletions

View File

@@ -61,3 +61,8 @@
- [x] Remove admin-bulk-meta__default (count bar), clean up layout - [x] Remove admin-bulk-meta__default (count bar), clean up layout
- [x] Fix nested form issue: per-row publish/unpublish buttons now submit correctly - [x] Fix nested form issue: per-row publish/unpublish buttons now submit correctly
- [x] Fix delete button: stopPropagation prevents row nav on confirm - [x] Fix delete button: stopPropagation prevents row nav on confirm
- [x] CSV import: set is_published=0 by default instead of 1
- [x] Fix AP column wrapping: CSS selector main > table didn't match (table nested in div)
- [x] Admin mobile block screen: fix inline style beating media query, use CSS default display:none instead
- [x] Fix deploy: add missing 023b migration to rename cc4r→cc2r, make run.php skip 'no such column' errors
- [x] Fix FK constraint violation on edit: pass null instead of 0 for absent orientation/ap/finality

View File

@@ -0,0 +1,75 @@
-- Rename cc4r column to cc2r (fix pre-existing naming inconsistency)
-- Must run before 024_remove_duration_size_fields.sql which references cc2r
ALTER TABLE theses RENAME COLUMN cc4r TO cc2r;
-- Rebuild views with the new column name
DROP VIEW IF EXISTS v_theses_public;
DROP VIEW IF EXISTS v_theses_full;
CREATE VIEW IF NOT EXISTS v_theses_full AS
SELECT
t.id,
t.identifier,
t.title,
t.subtitle,
t.year,
t.is_doctoral,
t.objet,
o.name as orientation,
ap.name as ap_program,
ft.name as finality_type,
t.synopsis,
t.context_note,
t.duration_minutes,
t.duration_pages,
t.file_size_info,
at.name as access_type,
lt.name as license_type,
t.license_id,
t.access_type_id,
t.jury_points,
t.submitted_at,
t.defense_date,
t.published_at,
t.is_published,
t.baiu_link,
t.banner_path,
t.exemplaire_baiu,
t.exemplaire_erg,
t.cc2r,
t.remarks,
t.jury_note_added,
GROUP_CONCAT(DISTINCT a.name ORDER BY a.name ASC) as authors,
GROUP_CONCAT(DISTINCT s.name) as supervisors,
GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'president' THEN s.name END) as jury_president,
GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'promoteur' AND ts.is_ulb = 0 THEN s.name END) as jury_promoteurs,
GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'promoteur' AND ts.is_ulb = 1 THEN s.name END) as jury_promoteurs_ulb,
GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'lecteur' AND ts.is_external = 0 THEN s.name END) as jury_lecteurs_internes,
GROUP_CONCAT(DISTINCT CASE WHEN ts.role = 'lecteur' AND ts.is_external = 1 THEN s.name END) as jury_lecteurs_externes,
GROUP_CONCAT(DISTINCT l.name) as languages,
GROUP_CONCAT(DISTINCT fmt.name) as formats,
GROUP_CONCAT(DISTINCT tg.name) as keywords,
(SELECT a2.email FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as author_email,
(SELECT a2.show_contact FROM authors a2 JOIN thesis_authors ta2 ON a2.id = ta2.author_id WHERE ta2.thesis_id = t.id ORDER BY ta2.author_order LIMIT 1) as author_show_contact
FROM theses t
LEFT JOIN orientations o ON t.orientation_id = o.id
LEFT JOIN ap_programs ap ON t.ap_program_id = ap.id
LEFT JOIN finality_types ft ON t.finality_id = ft.id
LEFT JOIN access_types at ON t.access_type_id = at.id
LEFT JOIN license_types lt ON t.license_id = lt.id
LEFT JOIN thesis_authors ta ON t.id = ta.thesis_id
LEFT JOIN authors a ON ta.author_id = a.id
LEFT JOIN thesis_supervisors ts ON t.id = ts.thesis_id
LEFT JOIN supervisors s ON ts.supervisor_id = s.id
LEFT JOIN thesis_languages tl ON t.id = tl.thesis_id
LEFT JOIN languages l ON tl.language_id = l.id
LEFT JOIN thesis_formats tf ON t.id = tf.thesis_id
LEFT JOIN format_types fmt ON tf.format_id = fmt.id
LEFT JOIN thesis_tags tt ON t.id = tt.thesis_id
LEFT JOIN tags tg ON tt.tag_id = tg.id
GROUP BY t.id;
CREATE VIEW IF NOT EXISTS v_theses_public AS
SELECT * FROM v_theses_full
WHERE is_published = 1;

View File

@@ -77,8 +77,9 @@ foreach ($files as $name => $file) {
$pdo->exec($stmt . ';'); $pdo->exec($stmt . ';');
} catch (PDOException $e) { } catch (PDOException $e) {
$msg = $e->getMessage(); $msg = $e->getMessage();
if (stripos($msg, 'duplicate column name') !== false) { if (stripos($msg, 'duplicate column name') !== false
echo " Skipping (column exists): " . substr($stmt, 0, 60) . "...\n"; || stripos($msg, 'no such column') !== false) {
echo " Skipping (already applied): " . substr($stmt, 0, 60) . "...\n";
continue; continue;
} }
$errors[] = $msg; $errors[] = $msg;

View File

@@ -296,7 +296,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
synopsis, context_note, remarks, synopsis, context_note, remarks,
jury_points, baiu_link, jury_points, baiu_link,
access_type_id, is_published, submitted_at access_type_id, is_published, submitted_at
) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,1,CURRENT_TIMESTAMP) ) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,0,CURRENT_TIMESTAMP)
"); ");
$s->execute([ $s->execute([
!empty($identifier) ? $identifier : null, $title, !empty($identifier) ? $identifier : null, $title,

View File

@@ -349,8 +349,8 @@
padding: var(--space-3xs); padding: var(--space-3xs);
} }
.admin-body main > table td.admin-ap-col, td.admin-ap-col,
.admin-body main > table th.admin-ap-col { th.admin-ap-col {
white-space: nowrap; white-space: nowrap;
} }
@@ -1898,3 +1898,48 @@
.fhb-inline-form { .fhb-inline-form {
margin-top: var(--space-xs); margin-top: var(--space-xs);
} }
/* ── Mobile: admin unavailable ─────────────────────────────────────────── */
.admin-mobile-block {
display: none;
}
@media screen and (max-width: 640px) {
.admin-body header {
display: none;
}
.admin-body main {
display: none;
}
.admin-mobile-block {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
padding: var(--space-l);
text-align: center;
color: var(--text-secondary);
}
.admin-mobile-block svg {
width: 48px;
height: 48px;
fill: var(--text-tertiary);
margin-bottom: var(--space-m);
}
.admin-mobile-block h2 {
font-size: var(--step-0);
font-weight: 600;
color: var(--text-primary);
margin: 0 0 var(--space-xs);
}
.admin-mobile-block p {
font-size: var(--step--1);
margin: 0;
}
}

View File

@@ -196,9 +196,9 @@ class ThesisEditController
'title' => trim($post['titre'] ?? ''), 'title' => trim($post['titre'] ?? ''),
'subtitle' => trim($post['subtitle'] ?? ''), 'subtitle' => trim($post['subtitle'] ?? ''),
'year' => intval($post['année'] ?? 0), 'year' => intval($post['année'] ?? 0),
'orientation_id' => intval($post['orientation'] ?? 0), 'orientation_id' => ($v = intval($post['orientation'] ?? 0)) > 0 ? $v : null,
'ap_program_id' => intval($post['ap'] ?? 0), 'ap_program_id' => ($v = intval($post['ap'] ?? 0)) > 0 ? $v : null,
'finality_id' => intval($post['finality'] ?? 0), 'finality_id' => ($v = intval($post['finality'] ?? 0)) > 0 ? $v : null,
'synopsis' => trim($post['synopsis'] ?? ''), 'synopsis' => trim($post['synopsis'] ?? ''),
'context_note' => trim($post['context_note'] ?? ''), 'context_note' => trim($post['context_note'] ?? ''),
'baiu_link' => trim($post['lien'] ?? ''), 'baiu_link' => trim($post['lien'] ?? ''),

View File

@@ -1744,9 +1744,9 @@ class Database
$data['title'], $data['title'],
!empty($data['subtitle']) ? $data['subtitle'] : null, !empty($data['subtitle']) ? $data['subtitle'] : null,
(int)$data['year'], (int)$data['year'],
(int)$data['orientation_id'], ($data['orientation_id'] ?? null) ? (int)$data['orientation_id'] : null,
(int)$data['ap_program_id'], ($data['ap_program_id'] ?? null) ? (int)$data['ap_program_id'] : null,
(int)$data['finality_id'], ($data['finality_id'] ?? null) ? (int)$data['finality_id'] : null,
$data['synopsis'], $data['synopsis'],
!empty($data['context_note']) ? $data['context_note'] : null, !empty($data['context_note']) ? $data['context_note'] : null,
!empty($data['baiu_link']) ? $data['baiu_link'] : null, !empty($data['baiu_link']) ? $data['baiu_link'] : null,

View File

@@ -45,6 +45,10 @@
$linkName = $link['name'] ?? ''; $linkName = $link['name'] ?? '';
$linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : ''; $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
$linkLockedYear = $link['locked_year'] ?? null; $linkLockedYear = $link['locked_year'] ?? null;
%%%%%%% diff from: somsyvxz 249f7943 "Bulk bar anti-shift, tags icons, AP no-wrap, credits reorder" (rebased revision)
\\\\\\\ to: unnnvyqs 357a2fff "Admin mobile block: fix inline style beating media query" (rebased revision)
+ $linkName = $link['name'] ?? '';
+ $linkExpiresVal = $link['expires_at'] ? date('Y-m-d\TH:i', strtotime($link['expires_at'])) : '';
?> ?>
<tr class="admin-table-row" onclick="event.stopPropagation(); window.open('/partage/<?= urlencode($link['slug']) ?>', '_blank')" style="cursor:pointer"> <tr class="admin-table-row" onclick="event.stopPropagation(); window.open('/partage/<?= urlencode($link['slug']) ?>', '_blank')" style="cursor:pointer">
<td><?= htmlspecialchars($linkName ?: '—') ?></td> <td><?= htmlspecialchars($linkName ?: '—') ?></td>

View File

@@ -82,6 +82,14 @@ $_thesisId = $_GET['id'] ?? null;
</header> </header>
<?php if ($_isAdmin): ?>
<div class="admin-mobile-block">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" aria-hidden="true"><rect width="256" height="256" fill="none"/><rect x="24" y="56" width="208" height="144" rx="16" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/><line x1="24" y1="168" x2="104" y2="88" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/><line x1="152" y1="168" x2="232" y2="88" fill="none" stroke="currentColor" stroke-width="16" stroke-linecap="round" stroke-linejoin="round"/></svg>
<h2>Section administrateur</h2>
<p>L'administration n'est pas accessible sur mobile. Veuillez utiliser un ordinateur.</p>
</div>
<?php endif; ?>
<?php if (!$_isAdmin): ?> <?php if (!$_isAdmin): ?>
<?php <?php
// Search bar — public section only (rendered below header for equal height) // Search bar — public section only (rendered below header for equal height)