Skip to content
Merged
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
7 changes: 4 additions & 3 deletions app/Nova/TrainingResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace App\Nova;

use App\Rules\FlexibleUrlOrAnchor;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\URL;
use Laravel\Nova\Fields\Boolean;
Expand Down Expand Up @@ -156,19 +157,19 @@ public function fields(Request $request): array

Text::make('Button URL', 'button_url')
->nullable()
->rules('nullable', 'url'),
->rules('nullable', new FlexibleUrlOrAnchor),

Text::make('Secondary button text', 'secondary_button_text')->nullable(),

Text::make('Secondary button URL', 'secondary_button_url')
->nullable()
->rules('nullable', 'url'),
->rules('nullable', new FlexibleUrlOrAnchor),

Text::make('Third button text', 'third_button_text')->nullable(),

Text::make('Third button URL', 'third_button_url')
->nullable()
->rules('nullable', 'url'),
->rules('nullable', new FlexibleUrlOrAnchor),

Text::make('Meta title', 'meta_title')
->nullable()
Expand Down
37 changes: 37 additions & 0 deletions app/Rules/FlexibleUrlOrAnchor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Rules;

use Closure;
use Illuminate\Contracts\Validation\ValidationRule;

/**
* Accepts absolute URLs, site-relative paths, or hash anchors (e.g. #key-one-pagers).
* Laravel's built-in "url" rule rejects anchors and many relative paths used in CTAs.
*/
class FlexibleUrlOrAnchor implements ValidationRule
{
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if ($value === null || $value === '') {
return;
}

$value = trim((string) $value);

if (preg_match('/^#([a-zA-Z0-9_-]+)$/', $value) === 1) {
return;
}

// Site-relative path (single leading slash, not protocol-relative)
if (str_starts_with($value, '/') && ! str_starts_with($value, '//')) {
return;
}

if (filter_var($value, FILTER_VALIDATE_URL) !== false) {
return;
}

$fail('Must be a valid URL, a path starting with /, or an anchor like #section-id.');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ public function run(): void
<li>Plan evaluation and feedback to measure outcomes.</li>
<li>Use digital outreach and communication to build awareness and follow-up.</li>
</ol>
<div style="margin-top: 2.25rem;">
<div style="margin-top:2.25rem;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;">
<h2>Roadmap</h2>
<p>Use this roadmap if you do not have time to read the full deliverable. The one-pagers mirror the toolkit flow and provide a practical checklist for implementation.</p>
<a href="https://codeweek-resources.s3.eu-west-1.amazonaws.com/+discover-digital-toolkit/DDP_toolkit_roadmap.pdf" target="_blank" rel="noopener noreferrer">
<img src="https://codeweek-resources.s3.eu-west-1.amazonaws.com/+discover-digital-toolkit/DDP_toolkit_roadmap.svg" alt="Discover Digital Programme roadmap" />
</a>
<img src="https://codeweek-resources.s3.eu-west-1.amazonaws.com/+discover-digital-toolkit/DDP_toolkit_roadmap_small.svg" alt="Discover Digital Programme roadmap diagram" style="display:block;max-width:100%;width:auto;height:auto;margin:0 auto;" />
</div>
HTML,
'body_image' => null,
Expand Down
4 changes: 2 additions & 2 deletions resources/views/training/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
$pageDescription = $trainingResource->meta_description ?: $fallbackDescription;

$introClass = "text-[#20262C] font-normal text-lg md:text-xl p-0 mb-6 [&_p]:p-0 [&_p]:mb-6 [&_a]:text-dark-blue [&_a]:hover:underline";
$contentClass = "text-[#333E48] font-normal text-lg md:text-xl p-0 mb-6 [&_p]:p-0 [&_p]:mb-6 [&_h2]:text-dark-blue [&_h2]:text-2xl [&_h2]:md:text-3xl [&_h2]:leading-[44px] [&_h2]:font-medium [&_h2]:font-['Montserrat'] [&_h2]:mb-4 [&_h3]:text-dark-blue [&_h3]:text-xl [&_h3]:md:text-2xl [&_h3]:font-medium [&_h3]:font-['Montserrat'] [&_h3]:mb-4 [&_ul]:pl-8 [&_ul]:m-0 [&_ul]:mb-6 [&_ul]:list-disc [&_ol]:pl-8 [&_ol]:m-0 [&_ol]:mb-6 [&_ol]:list-decimal [&_li]:p-0 [&_li]:text-lg [&_li]:font-normal [&_li]:leading-7 [&_li]:text-default [&_a]:text-dark-blue [&_a]:hover:underline [&_img]:w-full [&_img]:h-auto [&_img]:my-8";
$pdfClass = "text-[#333E48] font-normal text-lg md:text-xl p-0 mb-6 [&_p]:p-0 [&_p]:mb-4 [&_h2]:text-dark-blue [&_h2]:text-2xl [&_h2]:md:text-3xl [&_h2]:leading-[44px] [&_h2]:font-medium [&_h2]:font-['Montserrat'] [&_h2]:mb-4 [&_ul]:m-0 [&_ul]:mb-6 [&_ul]:list-none [&_ol]:m-0 [&_ol]:mb-6 [&_ol]:list-none [&_li]:p-0 [&_li]:mb-2 [&_li]:font-normal [&_li]:leading-7 [&_li]:text-default [&_a]:text-lg [&_a]:text-dark-blue [&_a]:no-underline [&_a:hover]:underline";
$contentClass = "text-[#333E48] font-normal text-lg md:text-xl p-0 mb-6 [&_p]:p-0 [&_p]:mb-6 [&_h2]:text-dark-blue [&_h2]:text-2xl [&_h2]:md:text-3xl [&_h2]:leading-[44px] [&_h2]:font-medium [&_h2]:font-['Montserrat'] [&_h2]:mb-4 [&_h3]:text-dark-blue [&_h3]:text-xl [&_h3]:md:text-2xl [&_h3]:font-medium [&_h3]:font-['Montserrat'] [&_h3]:mb-4 [&_ul]:pl-8 [&_ul]:m-0 [&_ul]:mb-6 [&_ul]:list-disc [&_ol]:pl-8 [&_ol]:m-0 [&_ol]:mb-6 [&_ol]:list-decimal [&_li]:p-0 [&_li]:text-lg [&_li]:font-normal [&_li]:leading-7 [&_li]:text-default [&_a]:text-dark-blue [&_a]:hover:underline [&_img]:max-w-full [&_img]:w-auto [&_img]:h-auto [&_img]:my-8 [&_img]:mx-auto [&_img]:block";
$pdfClass = "text-[#333E48] font-normal text-lg md:text-xl p-0 mb-6 [&_p]:p-0 [&_p]:mb-4 [&_h2]:text-dark-blue [&_h2]:text-2xl [&_h2]:md:text-3xl [&_h2]:leading-[44px] [&_h2]:font-medium [&_h2]:font-['Montserrat'] [&_h2]:mb-4 [&_ul]:m-0 [&_ul]:mb-6 [&_ul]:list-none [&_ol]:m-0 [&_ol]:mb-6 [&_ol]:list-none [&_li]:p-0 [&_li]:mb-2 [&_li]:font-normal [&_li]:leading-7 [&_li]:text-default [&_li]:break-words [&_a]:text-lg [&_a]:text-dark-blue [&_a]:no-underline [&_a:hover]:underline [&_a]:break-words [&_a]:max-w-full";
$contactsClass = "text-[#333E48] font-normal text-lg md:text-xl p-0 mb-8 [&_p]:p-0 [&_p]:mb-4 [&_h2]:text-dark-blue [&_h2]:text-2xl [&_h2]:md:text-3xl [&_h2]:leading-[44px] [&_h2]:font-medium [&_h2]:font-['Montserrat'] [&_h2]:mb-4 [&_a]:text-dark-blue [&_a]:hover:underline";
$registerClass = "text-[#333E48] font-normal text-base md:text-lg [&_p]:p-0 [&_p]:mb-4 [&_p:last-child]:mb-0 [&_a]:font-medium [&_a]:text-dark-blue [&_a]:hover:underline";
$aboutBoxClass = "text-slate-500 text-[16px] leading-[22px] tablet:text-xl tablet:leading-7 [&_h2]:text-dark-blue [&_h2]:text-2xl [&_h2]:md:text-3xl [&_h2]:leading-[44px] [&_h2]:font-medium [&_h2]:font-['Montserrat'] [&_h2]:mb-3 [&_h3]:text-dark-blue [&_h3]:text-xl [&_h3]:md:text-2xl [&_h3]:font-medium [&_h3]:font-['Montserrat'] [&_h3]:mb-3 [&_p]:p-0 [&_p]:mb-3 [&_p:last-child]:mb-0 [&_ul]:pl-8 [&_ul]:m-0 [&_ul]:mb-2 [&_ul]:list-disc [&_li]:mb-2 [&_li:last-child]:mb-0 [&_a]:font-semibold [&_a]:underline [&_a]:text-dark-blue";
Expand Down
Loading