diff --git a/app/CsrCampaignPage.php b/app/CsrCampaignPage.php index 9ab2c3d0e..b9114d990 100644 --- a/app/CsrCampaignPage.php +++ b/app/CsrCampaignPage.php @@ -3,6 +3,7 @@ namespace App; use Illuminate\Database\Eloquent\Model; +use Stevebauman\Purify\Facades\Purify; class CsrCampaignPage extends Model { @@ -29,6 +30,15 @@ public function resources() return $this->hasMany(CsrCampaignResource::class, 'page_id')->orderBy('position'); } + public static function renderRichText(?string $html): string + { + if ($html === null || trim($html) === '') { + return ''; + } + + return (string) Purify::clean($html); + } + public static function config(): self { $defaults = [ diff --git a/app/Nova/CsrCampaignPage.php b/app/Nova/CsrCampaignPage.php index e4cc40e1c..dbc8df5bb 100644 --- a/app/Nova/CsrCampaignPage.php +++ b/app/Nova/CsrCampaignPage.php @@ -53,7 +53,8 @@ public function fields(Request $request): array return [ ID::make()->onlyOnForms(), Panel::make('General', [ - Boolean::make('Use dynamic content for this page', 'use_dynamic_content'), + Boolean::make('Use dynamic resource cards', 'use_dynamic_content') + ->help('When enabled, the CSR Resources section uses the Resources list below instead of the default cards. Hero and About are always taken from this Nova form.'), ])->collapsable()->collapsedByDefault(), Panel::make('Hero', [ Trix::make('Hero text', 'hero_text')->nullable(), @@ -63,7 +64,7 @@ public function fields(Request $request): array Text::make('Secondary CTA link', 'secondary_cta_link')->nullable(), ])->collapsable()->collapsedByDefault(), Panel::make('About section', [ - Text::make('Title', 'about_title')->nullable(), + Trix::make('Title', 'about_title')->nullable(), Trix::make('Description', 'about_description')->nullable(), ])->collapsable()->collapsedByDefault(), Panel::make('Resources section', [ diff --git a/resources/views/static/csr-campaign.blade.php b/resources/views/static/csr-campaign.blade.php index fd831c531..94241cbca 100644 --- a/resources/views/static/csr-campaign.blade.php +++ b/resources/views/static/csr-campaign.blade.php @@ -110,25 +110,21 @@