Skip to content
Merged

Dev #3532

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 0 additions & 51 deletions app/Http/Controllers/TrainingRoadmapPdfController.php

This file was deleted.

10 changes: 5 additions & 5 deletions app/Nova/TrainingResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ public function fields(Request $request): array

Select::make('Roadmap embed format', 'roadmap_embed_kind')
->options([
'pdf' => 'PDF (inline viewer)',
'svg' => 'SVG (paste markup below)',
'pdf' => 'PDF (recommended — keeps clickable links from the file)',
'svg' => 'SVG (static graphic; exports usually do not preserve PDF links)',
'none' => 'None (remove placeholder output)',
])
->default('pdf')
->help('Use [[embed_roadmap_pdf]] or [[embed_roadmap]] in Content where the roadmap should appear.'),
->help('Put [[embed_roadmap_pdf]] or [[embed_roadmap]] in Content where the roadmap should appear. Use PDF when the roadmap must open real URLs from the document.'),

Text::make('Roadmap PDF embed URL', 'roadmap_pdf_embed_url')
->nullable()
Expand All @@ -174,7 +174,7 @@ public function fields(Request $request): array
$field->hide();
}
})
->help('HTTPS URL to the roadmap PDF. Used when format is PDF.'),
->help('HTTPS URL to the PDF. Shown in an iframe with the browser’s built-in PDF viewer so links inside the file stay active.'),

Textarea::make('Roadmap SVG', 'roadmap_svg')
->nullable()
Expand All @@ -186,7 +186,7 @@ public function fields(Request $request): array
$field->hide();
}
})
->help('Full <svg>...</svg> markup from your design tool. Used when format is SVG.'),
->help('Optional: paste full <svg>...</svg> only for a non-interactive graphic. For clickable resources, prefer PDF above.'),

Text::make('Button text', 'button_text')->nullable(),

Expand Down
10 changes: 3 additions & 7 deletions resources/views/training/partials/roadmap-pdf-embed.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
'url',
])
@php
// Strip any fragment from stored URL for the "open in new tab" link.
// Strip any fragment from stored URL for the "open in new tab" link and iframe src.
// Use the plain PDF URL in the iframe so the browser's native viewer keeps link annotations working.
$tabUrl = \Illuminate\Support\Str::before($url, '#');
// Same-origin PDF.js viewer for the allowlisted DDP roadmap (see TrainingRoadmapPdfController).
// Other URLs keep the direct PDF iframe with viewer chrome hints.
$ddpRoadmapBase = 'https://codeweek-resources.s3.eu-west-1.amazonaws.com/+discover-digital-toolkit/DDP_toolkit_roadmap.pdf';
$usePdfjsViewer = strtolower(rtrim($tabUrl, '/')) === strtolower(rtrim($ddpRoadmapBase, '/'));
$fragment = '#toolbar=0&navpanes=0&scrollbar=1&view=FitH';
$embedSrc = $usePdfjsViewer ? route('training.roadmap_pdf_viewer') : $tabUrl.$fragment;
$embedSrc = $tabUrl;
@endphp
<div class="w-full max-w-full my-6 rounded-xl overflow-hidden border border-slate-200 bg-slate-100 shadow-sm">
<iframe
Expand Down
65 changes: 0 additions & 65 deletions resources/views/training/roadmap-pdfjs.blade.php

This file was deleted.

5 changes: 0 additions & 5 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
use App\Http\Controllers\CertificateBackendController;
use App\Http\Controllers\ToolkitsController;
use App\Http\Controllers\TrainingController;
use App\Http\Controllers\TrainingRoadmapPdfController;
use App\Http\Controllers\UnsubscribeController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VolunteerController;
Expand Down Expand Up @@ -341,10 +340,6 @@
Route::get('/training-preview/{trainingResource}', [TrainingController::class, 'preview'])
->middleware('signed')
->name('training.preview');
Route::get('/training/embedded-roadmap.pdf', [TrainingRoadmapPdfController::class, 'proxyPdf'])
->name('training.embedded_pdf.roadmap');
Route::get('/training/roadmap-pdf-viewer', [TrainingRoadmapPdfController::class, 'viewer'])
->name('training.roadmap_pdf_viewer');
Route::get('/training/{slug}', [TrainingController::class, 'show'])->name('training.dynamic.show');
Route::post('/contact-submit', [ContactFormController::class, 'submit'])
->middleware('throttle:5,1') // 5 requests per minute per IP
Expand Down
Loading