Skip to content

Commit 6acf436

Browse files
committed
training pages dynamic
1 parent 425708a commit 6acf436

4 files changed

Lines changed: 69 additions & 0 deletions

File tree

app/Nova/TrainingResource.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ public function fields(Request $request): array
8787
->nullable()
8888
->help('Main training content area'),
8989

90+
Trix::make('PDF links section', 'pdf_links_section')
91+
->nullable()
92+
->help('Optional area for numbered downloadable resources (e.g. 1-6 links).'),
93+
94+
Trix::make('Contacts section', 'contacts_section')
95+
->nullable()
96+
->help('Optional contacts/extra info block.'),
97+
98+
Trix::make('Register box section', 'register_box_section')
99+
->nullable()
100+
->help('Optional text shown in a highlighted callout box (register on map, hashtags, etc).'),
101+
90102
Text::make('Button text', 'button_text')->nullable(),
91103

92104
Text::make('Button URL', 'button_url')

app/TrainingResource.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ class TrainingResource extends Model
2323
'body_image',
2424
'body_image_alt',
2525
'content',
26+
'pdf_links_section',
27+
'contacts_section',
28+
'register_box_section',
2629
'button_text',
2730
'button_url',
2831
'secondary_button_text',
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('training_resources', function (Blueprint $table) {
15+
$table->longText('pdf_links_section')->nullable()->after('content');
16+
$table->longText('contacts_section')->nullable()->after('pdf_links_section');
17+
$table->longText('register_box_section')->nullable()->after('contacts_section');
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*/
24+
public function down(): void
25+
{
26+
Schema::table('training_resources', function (Blueprint $table) {
27+
$table->dropColumn([
28+
'pdf_links_section',
29+
'contacts_section',
30+
'register_box_section',
31+
]);
32+
});
33+
}
34+
};

resources/views/training/show.blade.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ class="mb-8 w-full h-auto rounded-lg"
5555
</div>
5656
@endif
5757

58+
@if(!empty($trainingResource->pdf_links_section))
59+
<div class="text-[#333E48] font-normal text-lg md:text-xl p-0 mb-6">
60+
{!! $trainingResource->pdf_links_section !!}
61+
</div>
62+
@endif
63+
5864
@if(
5965
(!empty($trainingResource->button_text) && !empty($trainingResource->button_url)) ||
6066
(!empty($trainingResource->secondary_button_text) && !empty($trainingResource->secondary_button_url))
@@ -83,6 +89,20 @@ class="inline-block bg-[#FFD56A] rounded-full py-2.5 px-6 font-['Blinker'] hover
8389
@endif
8490
</div>
8591
@endif
92+
93+
@if(!empty($trainingResource->contacts_section))
94+
<div class="text-[#333E48] font-normal text-lg md:text-xl p-0 mt-8 mb-6">
95+
{!! $trainingResource->contacts_section !!}
96+
</div>
97+
@endif
98+
99+
@if(!empty($trainingResource->register_box_section))
100+
<div class="p-6 mb-8 bg-blue-50 border-l-4 border-dark-blue">
101+
<div class="text-[#333E48] font-normal text-base md:text-lg">
102+
{!! $trainingResource->register_box_section !!}
103+
</div>
104+
</div>
105+
@endif
86106
</div>
87107
</section>
88108

0 commit comments

Comments
 (0)