Export PDF : fiche Publication et options d'export (module à partager ou vendre)
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 44s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 57s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 1m41s
Qualité & Sécurité / Web (ESLint · angular-eslint + sonarjs) (push) Successful in 44s
Qualité & Sécurité / Trivy (CVE dépendances Maven / pip / npm) (push) Failing after 57s
Qualité & Sécurité / MegaLinter (PMD · Ruff · Bandit · gitleaks · hadolint) (push) Successful in 1m41s
- Correctifs du livret : le résumé des scènes est enfin exporté, libellés
accentués (Thèmes, Récompenses, Résolution, Choix et conséquences), stats
Foundry en français (PV, CA, FOR, FP…), encadrés et longues pages de lore
coupables entre deux pages (fini les grands blancs), plus de date d'export
en couverture, titre/auteur/sujet/langue dans les propriétés du PDF.
- Fiche Publication de la campagne (écran /campaigns/:id/publication) :
sous-titre, auteur, version, illustration de couverture, page technique
(système, niveaux, joueurs, durée), argument, avertissements de contenu,
contexte caché et accroches pour le MJ, crédits et licence. Stockée en JSON
(migration V26), API GET/PUT /api/campaigns/{id}/publication, conservée à
l'export/import de campagne (couverture remappée).
- Dans le PDF : couverture illustrée, page de crédits, introduction (page
technique, l'aventure en bref, contexte MJ, accroches, structure). Fiche
vide : livret de campagne inchangé.
- Options d'export (modale au clic sur « Exporter en PDF ») : version MJ ou
joueurs (aucun secret : notes MJ, conséquences, sorties, combats, contexte),
format A4 / A5 / US Letter, mode impression sans aplats, choix des parties,
lore complet ou seulement les pages liées à la campagne.
- Cinq nouvelles fiches du coach d'écriture sur l'écran Publication
(argument, avertissements, contexte caché, accroches, crédits).
Vérifié : core clean verify (1247 tests, dont contenu du PDF par option,
version joueurs sans secret, propriétés du fichier, format Letter, remap de
la couverture à l'import), web build + 357 vitest, lint sans erreur, essai
dans le navigateur (migration V26 sur une base existante, enregistrement de
la fiche, export joueurs A5).
À redéployer : core + web (migration V26).
This commit is contained in:
@@ -322,6 +322,15 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<!-- Options du livret PDF (version MJ/joueurs, format, parties, lore) + accès à la fiche Publication. -->
|
||||
<app-pdf-export-dialog
|
||||
[open]="pdfDialogOpen"
|
||||
[exporting]="exportingPdf"
|
||||
[hasPublication]="hasPublication"
|
||||
(cancelled)="pdfDialogOpen = false"
|
||||
(confirmed)="onPdfExportConfirmed($event)"
|
||||
(editPublication)="openPublication()"></app-pdf-export-dialog>
|
||||
|
||||
<!-- Choix du périmètre de l'export Foundry (tout / cartes+ennemis / journaux / tables). -->
|
||||
<app-foundry-export-dialog
|
||||
[open]="foundryDialogOpen"
|
||||
|
||||
@@ -11,7 +11,7 @@ import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
||||
import { Router, RouterLink } from '@angular/router';
|
||||
import { forkJoin, of, Observable } from 'rxjs';
|
||||
import { catchError, switchMap, filter, map } from 'rxjs/operators';
|
||||
import { CampaignService, FoundryExportOptions } from '../../../services/campaign.service';
|
||||
import { CampaignService, FoundryExportOptions, PdfExportOptions } from '../../../services/campaign.service';
|
||||
import { LoreService } from '../../../services/lore.service';
|
||||
import { GameSystemService } from '../../../services/game-system.service';
|
||||
import { GameSystem } from '../../../services/game-system.model';
|
||||
@@ -35,10 +35,12 @@ import { ReadinessPanelComponent } from '../../../shared/readiness-panel/readine
|
||||
import { WritingReviewPanelComponent } from '../../../shared/writing-review/writing-review-panel.component';
|
||||
import { CampaignPlayBlockComponent } from '../campaign-play-block/campaign-play-block.component';
|
||||
import { FoundryExportDialogComponent } from '../foundry-export-dialog/foundry-export-dialog.component';
|
||||
import { PdfExportDialogComponent } from '../pdf-export-dialog/pdf-export-dialog.component';
|
||||
import { downloadBlob, safeFileName } from '../../../shared/download.util';
|
||||
|
||||
@Component({
|
||||
selector: 'app-campaign-detail',
|
||||
imports: [FormsModule, LucideAngularModule, RouterLink, TranslatePipe, CdkDropList, CdkDrag, ReadinessPanelComponent, WritingReviewPanelComponent, CampaignPlayBlockComponent, FoundryExportDialogComponent],
|
||||
imports: [FormsModule, LucideAngularModule, RouterLink, TranslatePipe, CdkDropList, CdkDrag, ReadinessPanelComponent, WritingReviewPanelComponent, CampaignPlayBlockComponent, FoundryExportDialogComponent, PdfExportDialogComponent],
|
||||
templateUrl: './campaign-detail.component.html',
|
||||
styleUrls: ['./campaign-detail.component.scss']
|
||||
})
|
||||
@@ -67,6 +69,10 @@ export class CampaignDetailComponent implements OnInit, OnDestroy {
|
||||
foundryDialogOpen = false;
|
||||
/** Export PDF en cours (anti double-clic). */
|
||||
exportingPdf = false;
|
||||
/** Modale des options du livret PDF. */
|
||||
pdfDialogOpen = false;
|
||||
/** Fiche Publication remplie (sinon la modale propose de la compléter). */
|
||||
hasPublication = true;
|
||||
|
||||
campaign: Campaign | null = null;
|
||||
arcs: Arc[] = [];
|
||||
@@ -430,22 +436,27 @@ export class CampaignDetailComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
/** Génère et télécharge le livret PDF de la campagne. */
|
||||
/** Ouvre la modale d'options du livret PDF (en vérifiant si la fiche Publication est remplie). */
|
||||
exportPdf(): void {
|
||||
if (!this.campaign?.id || this.exportingPdf) return;
|
||||
this.pdfDialogOpen = true;
|
||||
this.campaignService.getPublication(this.campaign.id).subscribe({
|
||||
next: (p) => this.hasPublication = Object.values(p ?? {}).some(v => typeof v === 'string' && v.trim().length > 0),
|
||||
error: () => this.hasPublication = true // inconnu : pas d'incitation à tort
|
||||
});
|
||||
}
|
||||
|
||||
/** Génère et télécharge le livret PDF selon les options choisies. */
|
||||
onPdfExportConfirmed(opts: PdfExportOptions): void {
|
||||
if (!this.campaign?.id || this.exportingPdf) return;
|
||||
this.exportingPdf = true;
|
||||
const name = this.campaign.name;
|
||||
this.campaignService.exportPdf(this.campaign.id).subscribe({
|
||||
this.campaignService.exportPdf(this.campaign.id, opts).subscribe({
|
||||
next: (blob) => {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
a.download = `${(name || 'campagne').replace(/[^a-zA-Z0-9-_]+/g, '_')}.pdf`;
|
||||
document.body.appendChild(a);
|
||||
a.click();
|
||||
document.body.removeChild(a);
|
||||
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
||||
const suffix = opts.edition === 'player' ? '_joueurs' : '';
|
||||
downloadBlob(blob, `${safeFileName(name, 'campagne')}${suffix}.pdf`);
|
||||
this.exportingPdf = false;
|
||||
this.pdfDialogOpen = false;
|
||||
},
|
||||
error: (err) => {
|
||||
console.error('Échec de l\'export PDF', err);
|
||||
@@ -454,6 +465,13 @@ export class CampaignDetailComponent implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
/** Depuis la modale PDF : compléter la fiche Publication (couverture, crédits…). */
|
||||
openPublication(): void {
|
||||
if (!this.campaign?.id) return;
|
||||
this.pdfDialogOpen = false;
|
||||
this.router.navigate(['/campaigns', this.campaign.id, 'publication']);
|
||||
}
|
||||
|
||||
/** Réordonne les arcs par glisser-déposer et persiste le nouvel ordre. */
|
||||
dropArc(event: CdkDragDrop<Arc[]>): void {
|
||||
if (event.previousIndex === event.currentIndex) return;
|
||||
|
||||
Reference in New Issue
Block a user