Skip to content

Commit eb2cffa

Browse files
authored
Merge pull request #3531 from codeeu/feature/ddp-training-resource
Feature/ddp training resource
2 parents fef2293 + 0e88bca commit eb2cffa

5 files changed

Lines changed: 8 additions & 133 deletions

File tree

app/Http/Controllers/TrainingRoadmapPdfController.php

Lines changed: 0 additions & 51 deletions
This file was deleted.

app/Nova/TrainingResource.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ public function fields(Request $request): array
157157

158158
Select::make('Roadmap embed format', 'roadmap_embed_kind')
159159
->options([
160-
'pdf' => 'PDF (inline viewer)',
161-
'svg' => 'SVG (paste markup below)',
160+
'pdf' => 'PDF (recommended — keeps clickable links from the file)',
161+
'svg' => 'SVG (static graphic; exports usually do not preserve PDF links)',
162162
'none' => 'None (remove placeholder output)',
163163
])
164164
->default('pdf')
165-
->help('Use [[embed_roadmap_pdf]] or [[embed_roadmap]] in Content where the roadmap should appear.'),
165+
->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.'),
166166

167167
Text::make('Roadmap PDF embed URL', 'roadmap_pdf_embed_url')
168168
->nullable()
@@ -174,7 +174,7 @@ public function fields(Request $request): array
174174
$field->hide();
175175
}
176176
})
177-
->help('HTTPS URL to the roadmap PDF. Used when format is PDF.'),
177+
->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.'),
178178

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

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

resources/views/training/partials/roadmap-pdf-embed.blade.php

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

resources/views/training/roadmap-pdfjs.blade.php

Lines changed: 0 additions & 65 deletions
This file was deleted.

routes/web.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
use App\Http\Controllers\CertificateBackendController;
6464
use App\Http\Controllers\ToolkitsController;
6565
use App\Http\Controllers\TrainingController;
66-
use App\Http\Controllers\TrainingRoadmapPdfController;
6766
use App\Http\Controllers\UnsubscribeController;
6867
use App\Http\Controllers\UserController;
6968
use App\Http\Controllers\VolunteerController;
@@ -341,10 +340,6 @@
341340
Route::get('/training-preview/{trainingResource}', [TrainingController::class, 'preview'])
342341
->middleware('signed')
343342
->name('training.preview');
344-
Route::get('/training/embedded-roadmap.pdf', [TrainingRoadmapPdfController::class, 'proxyPdf'])
345-
->name('training.embedded_pdf.roadmap');
346-
Route::get('/training/roadmap-pdf-viewer', [TrainingRoadmapPdfController::class, 'viewer'])
347-
->name('training.roadmap_pdf_viewer');
348343
Route::get('/training/{slug}', [TrainingController::class, 'show'])->name('training.dynamic.show');
349344
Route::post('/contact-submit', [ContactFormController::class, 'submit'])
350345
->middleware('throttle:5,1') // 5 requests per minute per IP

0 commit comments

Comments
 (0)