diff --git a/app/Http/Controllers/TrainingRoadmapPdfController.php b/app/Http/Controllers/TrainingRoadmapPdfController.php deleted file mode 100644 index 72899ccd0..000000000 --- a/app/Http/Controllers/TrainingRoadmapPdfController.php +++ /dev/null @@ -1,51 +0,0 @@ -get(self::ROADMAP_SOURCE); - - if (! $response->successful()) { - abort(502, 'Unable to load roadmap PDF.'); - } - - return $response->body(); - } - ); - - return response($bytes, 200, [ - 'Content-Type' => 'application/pdf', - 'Content-Disposition' => 'inline; filename="DDP_toolkit_roadmap.pdf"', - 'Cache-Control' => 'public, max-age=3600', - ]); - } - - /** - * Minimal PDF.js viewer (no site chrome) for iframe embedding on training pages. - */ - public function viewer() - { - return response() - ->view('training.roadmap-pdfjs') - ->header('X-Frame-Options', 'SAMEORIGIN'); - } -} diff --git a/app/Nova/TrainingResource.php b/app/Nova/TrainingResource.php index d907c53b5..dc9a9ea50 100644 --- a/app/Nova/TrainingResource.php +++ b/app/Nova/TrainingResource.php @@ -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() @@ -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() @@ -186,7 +186,7 @@ public function fields(Request $request): array $field->hide(); } }) - ->help('Full markup from your design tool. Used when format is SVG.'), + ->help('Optional: paste full only for a non-interactive graphic. For clickable resources, prefer PDF above.'), Text::make('Button text', 'button_text')->nullable(), diff --git a/resources/views/training/partials/roadmap-pdf-embed.blade.php b/resources/views/training/partials/roadmap-pdf-embed.blade.php index c037de629..496cac9f0 100644 --- a/resources/views/training/partials/roadmap-pdf-embed.blade.php +++ b/resources/views/training/partials/roadmap-pdf-embed.blade.php @@ -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