Skip to content

Commit 1dc444f

Browse files
committed
Normalize rich text rendering for Nova-editable static pages.
Render dynamic Trix content as HTML across Get Involved, CSR, Dance, and Treasure Hunt while preserving existing styles and fallbacks so editors no longer leak raw HTML tags to the frontend. Made-with: Cursor
1 parent 56c4162 commit 1dc444f

4 files changed

Lines changed: 53 additions & 42 deletions

File tree

resources/views/static/csr-campaign.blade.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@
110110
<div class="w-full overflow-hidden pb-10 md:p-0 flex flex-col md:flex-row justify-end md:items-center flex-shrink-0">
111111
<div class="home-activity codeweek-container-lg flex flex-col md:flex-row md:items-center duration-1000 gap-28 md:gap-4 xl:gap-28">
112112
<div class="px-6 py-10 md:px-14 md:py-[4.5rem] bg-white rounded-[32px] z-10 relative">
113-
<p class="text-xl md:text-2xl leading-8 text-[#333E48] p-0 max-md:max-w-full max-w-[525px] mb-4">
113+
<div class="text-xl md:text-2xl leading-8 text-[#333E48] p-0 max-md:max-w-full max-w-[525px] mb-4 [&_p]:p-0 [&_p]:m-0 [&_p]:mb-4 [&_p:last-child]:mb-0">
114114
@if($dynamic && $page->hero_text)
115115
{!! $page->hero_text !!}
116116
@else
117117
@lang('csr-campaign.landing_header')
118118
@endif
119-
</p>
119+
</div>
120120
<div class="flex flex-col md:flex-row gap-3 md:gap-5 items-center">
121121
<a
122122
class="text-nowrap w-full md:w-fit flex justify-center items-center bg-primary hover:bg-hover-orange duration-300 text-[#20262C] rounded-full py-4 px-8 font-semibold text-lg"
@@ -154,13 +154,13 @@ class="absolute top-0 right-0 h-full max-w-[calc(70vw)] object-cover hidden md:b
154154
<h2 class="text-dark-blue text-[22px] md:text-4xl md:leading-[44px] font-medium font-['Montserrat'] mb-6 md:mb-10 block">
155155
{{ $dynamic && $page->about_title ? $page->about_title : __('csr-campaign.about_title') }}
156156
</h2>
157-
<p class="text-[#20262C] font-normal text-[16px] leading-[22px] md:text-xl p-0 mb-6 md:mb-10 max-w-4xl">
157+
<div class="text-[#20262C] font-normal text-[16px] leading-[22px] md:text-xl p-0 mb-6 md:mb-10 max-w-4xl [&_p]:p-0 [&_p]:m-0 [&_p]:mb-4 [&_p:last-child]:mb-0">
158158
@if($dynamic && $page->about_description)
159159
{!! $page->about_description !!}
160160
@else
161161
@lang('csr-campaign.about_description')
162162
@endif
163-
</p>
163+
</div>
164164
<div class="relative">
165165
<img
166166
class="w-full rounded-2xl object-cover object-center h-[calc(80vw-40px)] sm:h-auto"

resources/views/static/dance.blade.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@
2626
<h2 class="text-dark-blue text-[30px] md:text-[60px] leading-9 md:leading-[72px] font-normal font-['Montserrat'] mb-4 max-md:max-w-full max-w-[532px]">
2727
{{ $dynamic && $page->hero_title ? $page->hero_title : __('cw2020.title.0') }}
2828
</h2>
29-
<p class="text-xl md:text-2xl leading-8 text-[#333E48] p-0 max-md:max-w-full max-w-[525px] mb-4">
29+
<div class="text-xl md:text-2xl leading-8 text-[#333E48] p-0 max-md:max-w-full max-w-[525px] mb-4 [&_p]:p-0 [&_p]:m-0 [&_p]:mb-4 [&_p:last-child]:mb-0">
3030
@if($dynamic && $page->hero_subtitle)
3131
{!! $page->hero_subtitle !!}
3232
@else
3333
@lang('cw2020.dance.title')
3434
@endif
35-
</p>
35+
</div>
3636
</div>
3737
<div
3838
class="absolute top-0 -left-1/4 w-[150vw] h-full !max-w-none md:hidden bg-blue-gradient"
@@ -56,13 +56,13 @@ class="absolute top-0 right-0 !h-full w-full max-w-[calc(70vw)] object-cover hid
5656
<p class="text-dark-blue font-['Montserrat'] font-medium text-[22px] leading-7 md:text-4xl p-0 mb-6">
5757
{{ $dynamic && $page->content_intro_title ? $page->content_intro_title : __('cw2020.dance.title') }}
5858
</p>
59-
<p class="font-normal text-default md:text-xl p-0 text-slate-500 leading-[22px] md:leading-[30px] mb-6">
59+
<div class="font-normal text-default md:text-xl p-0 text-slate-500 leading-[22px] md:leading-[30px] mb-6 [&_p]:p-0 [&_p]:m-0 [&_p]:mb-4 [&_p:last-child]:mb-0">
6060
@if($dynamic && $page->content_intro_subtitle)
6161
{!! $page->content_intro_subtitle !!}
6262
@else
6363
@lang('snippets.dance.subtitle')
6464
@endif
65-
</p>
65+
</div>
6666

6767
<p class="font-semibold text-2xl p-0 mb-2">
6868
@lang('cw2020.dance.section1.title')
@@ -146,13 +146,13 @@ class="absolute top-0 right-0 !h-full w-full max-w-[calc(70vw)] object-cover hid
146146
<p class="text-dark-blue font-['Montserrat'] font-medium text-[22px] leading-7 md:text-4xl p-0 mb-6">
147147
{{ $dynamic && $page->get_involved_title ? $page->get_involved_title : __('cw2020.get-involved.title') }}
148148
</p>
149-
<p class="font-normal text-default md:text-xl p-0 text-slate-500 leading-[22px] md:leading-[30px] mb-6">
149+
<div class="font-normal text-default md:text-xl p-0 text-slate-500 leading-[22px] md:leading-[30px] mb-6 [&_p]:p-0 [&_p]:m-0 [&_p]:mb-4 [&_p:last-child]:mb-0">
150150
@if($dynamic && $page->get_involved_subtitle)
151151
{!! $page->get_involved_subtitle !!}
152152
@else
153153
@lang('cw2020.get-involved.subtitle').
154154
@endif
155-
</p>
155+
</div>
156156
<ul class="list-[circle] m-0 ml-4 pl-2 mb-3">
157157
<li class="font-normal text-default md:text-xl p-0 text-slate-500"><a class="text-dark-blue" href="https://blog.codeweek.eu/getting-started-with-eu-code-week/">@lang('cw2020.get-involved.content.0')</a></li>
158158
<li class="font-normal text-default md:text-xl p-0 text-slate-500"><a class="text-dark-blue" href="{{route("guide")}}">@lang('cw2020.get-involved.content.1')</a></li>

resources/views/static/get-involved.blade.php

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,14 @@ class="px-6 py-10 md:px-14 md:py-[4.5rem] bg-white rounded-[32px] z-10 w-fit h-f
104104
class="text-[#1C4DA1] text-[30px] md:text-[60px] leading-9 md:leading-[72px] font-normal font-['Montserrat'] mb-4">
105105
{{ $dynamic && $page && $page->intro_heading ? $page->intro_heading : __('cw2020.get-involved.title') }}
106106
</h1>
107-
<p
108-
class="text-xl md:text-2xl leading-8 text-[#333E48] p-0 mb-4 max-md:max-w-full max-w-[525px]">
109-
{{ $dynamic && $page && $page->intro_text ? $page->intro_text : 'It’s easy to take part in Code Week. If you’re an educator, student, parent or community leader you can make a big impact. You can host your own activity, join one nearby, explore learning resources, or connect with others across Europe.' }}
110-
</p>
107+
<div
108+
class="text-xl md:text-2xl leading-8 text-[#333E48] p-0 mb-4 max-md:max-w-full max-w-[525px] [&_p]:p-0 [&_p]:m-0 [&_div]:inline [&_br]:leading-8">
109+
@if($dynamic && $page && $page->intro_text)
110+
{!! $page->intro_text !!}
111+
@else
112+
It’s easy to take part in Code Week. If you’re an educator, student, parent or community leader you can make a big impact. You can host your own activity, join one nearby, explore learning resources, or connect with others across Europe.
113+
@endif
114+
</div>
111115
<a class="inline-block bg-primary hover:bg-hover-orange rounded-full py-4 px-6 md:px-10 font-semibold text-base w-full md:w-auto text-center text-[#20262C] transition-all duration-300"
112116
href="{{ $dynamic && $page && $page->intro_button_link ? $page->intro_button_link : '/guide' }}">
113117
{{ $dynamic && $page && $page->intro_button_text ? $page->intro_button_text : 'Get involved' }} </a>
@@ -136,13 +140,20 @@ class="transition-all duration-300 fill-[#FFD700] group-hover:fill-white" />
136140
class="text-dark-blue text-[22px] md:text-4xl leading-7 md:leading-[44px] font-medium font-['Montserrat'] mb-6">
137141
{{ $dynamic && $page && $page->movement_heading ? $page->movement_heading : 'Join the movement for digital creativity' }}
138142
</h2>
139-
<p class="text-[#20262C] font-normal text-lg md:text-2xl p-0 mb-6">
140-
{{ $dynamic && $page && $page->movement_text_1 ? $page->movement_text_1 : 'The beauty of Code Week is that there’s no single way to take part. Whether you run an event or join one, you\'re helping grow a movement built on creativity, inclusion and digital skills.' }}
141-
142-
</p>
143-
<p class="text-[#333E48] font-normal text-[16px] md:text-xl leading-[22px] md:leading-[30px] p-0">
144-
{{ $dynamic && $page && $page->movement_text_2 ? $page->movement_text_2 : 'Spread the joy of coding, connect with like-minded people, and empower others to shape their digital future. Every action makes a difference.' }}
145-
</p>
143+
<div class="text-[#20262C] font-normal text-lg md:text-2xl p-0 mb-6 [&_p]:p-0 [&_p]:m-0 [&_p]:mb-4 [&_p:last-child]:mb-0">
144+
@if($dynamic && $page && $page->movement_text_1)
145+
{!! $page->movement_text_1 !!}
146+
@else
147+
The beauty of Code Week is that there’s no single way to take part. Whether you run an event or join one, you're helping grow a movement built on creativity, inclusion and digital skills.
148+
@endif
149+
</div>
150+
<div class="text-[#333E48] font-normal text-[16px] md:text-xl leading-[22px] md:leading-[30px] p-0 [&_p]:p-0 [&_p]:m-0 [&_p]:mb-4 [&_p:last-child]:mb-0">
151+
@if($dynamic && $page && $page->movement_text_2)
152+
{!! $page->movement_text_2 !!}
153+
@else
154+
Spread the joy of coding, connect with like-minded people, and empower others to shape their digital future. Every action makes a difference.
155+
@endif
156+
</div>
146157
</div>
147158
</div>
148159
<div class="animation-element move-background duration-[1.5s] absolute z-0 bottom-10 md:bottom-auto md:top-1/3 -right-14 md:-right-40 w-28 md:w-72 h-28 md:h-72 bg-[#FFEF99] rounded-full hidden lg:block"
@@ -168,15 +179,15 @@ class="text-dark-blue text-[22px] md:text-4xl leading-7 md:leading-[44px] font-m
168179
class="text-dark-blue text-[22px] md:text-4xl leading-7 md:leading-[44px] font-medium font-['Montserrat'] mb-6">
169180
{{ $dynamic && $page && $page->start_heading ? $page->start_heading : 'How to get started with Code Week' }}
170181
</h3>
171-
<p class="mt-6 max-w-full text-xl leading-8 text-gray-700">
182+
<div class="mt-6 max-w-full text-xl leading-8 text-gray-700 [&_p]:p-0 [&_p]:m-0 [&_p]:mb-4 [&_p:last-child]:mb-0">
172183
@if($dynamic && $page && $page->start_text)
173-
{!! nl2br(e($page->start_text)) !!}
184+
{!! $page->start_text !!}
174185
@else
175186
Whether you’re curious about coding, passionate about teaching, or just want to try something new, there’s a place for you in EU Code Week.
176187
<br><br>
177188
You don’t need to be an expert. From hosting events to sharing resources, there are plenty of ways to contribute to this fun, open and collaborative movement.
178189
@endif
179-
</p>
190+
</div>
180191
</div>
181192

182193
<!-- Right Column - Engagement Options -->

0 commit comments

Comments
 (0)