diff --git a/app/CsrCampaignPage.php b/app/CsrCampaignPage.php new file mode 100644 index 000000000..e08ac8615 --- /dev/null +++ b/app/CsrCampaignPage.php @@ -0,0 +1,45 @@ + 'boolean', + ]; + + public function resources() + { + return $this->hasMany(CsrCampaignResource::class, 'page_id')->orderBy('position'); + } + + public static function config(): self + { + $page = self::first(); + if ($page) { + return $page; + } + + return self::create([ + 'use_dynamic_content' => false, + 'primary_cta_link' => 'https://codeweek.eu/blog/futurereadycsr-campaign-launch', + 'secondary_cta_link' => 'https://codeweek.eu/blog/futurereadycsr-resources', + ]); + } +} diff --git a/app/CsrCampaignResource.php b/app/CsrCampaignResource.php new file mode 100644 index 000000000..6d82c2c19 --- /dev/null +++ b/app/CsrCampaignResource.php @@ -0,0 +1,27 @@ + 'integer', + 'active' => 'boolean', + ]; +} diff --git a/app/DancePage.php b/app/DancePage.php new file mode 100644 index 000000000..9eba9e785 --- /dev/null +++ b/app/DancePage.php @@ -0,0 +1,36 @@ + 'boolean', + ]; + + public static function config(): self + { + $page = self::first(); + if ($page) { + return $page; + } + + return self::create([ + 'use_dynamic_content' => false, + ]); + } +} diff --git a/app/Http/Controllers/OnlineCoursesController.php b/app/Http/Controllers/OnlineCoursesController.php index 80f4602fc..28b31a1aa 100644 --- a/app/Http/Controllers/OnlineCoursesController.php +++ b/app/Http/Controllers/OnlineCoursesController.php @@ -2,7 +2,9 @@ namespace App\Http\Controllers; +use App\OnlineCoursesPage; use App\OnlineCourse; +use Illuminate\Support\Facades\Schema; use Illuminate\View\View; class OnlineCoursesController extends Controller @@ -14,7 +16,8 @@ class OnlineCoursesController extends Controller public function index(): View { $onlineCourses = OnlineCourse::active()->ordered()->get(); + $page = Schema::hasTable('online_courses_page') ? OnlineCoursesPage::config() : null; - return view('online-courses', compact('onlineCourses')); + return view('online-courses', compact('onlineCourses', 'page')); } } diff --git a/app/Nova/CsrCampaignPage.php b/app/Nova/CsrCampaignPage.php new file mode 100644 index 000000000..e1debae2b --- /dev/null +++ b/app/Nova/CsrCampaignPage.php @@ -0,0 +1,69 @@ +where('id', 1); + } + + public static function authorizedToCreate(Request $request): bool + { + return false; + } + + public function fields(Request $request): array + { + return [ + ID::make()->onlyOnForms(), + Panel::make('General', [ + Boolean::make('Use dynamic content for this page', 'use_dynamic_content'), + ])->collapsable()->collapsedByDefault(), + Panel::make('Hero', [ + Trix::make('Hero text', 'hero_text')->nullable(), + Text::make('Primary CTA text', 'primary_cta_text')->nullable(), + Text::make('Primary CTA link', 'primary_cta_link')->nullable(), + Text::make('Secondary CTA text', 'secondary_cta_text')->nullable(), + Text::make('Secondary CTA link', 'secondary_cta_link')->nullable(), + ])->collapsable()->collapsedByDefault(), + Panel::make('About section', [ + Text::make('Title', 'about_title')->nullable(), + Trix::make('Description', 'about_description')->nullable(), + ])->collapsable()->collapsedByDefault(), + Panel::make('Resources section', [ + Text::make('Section title', 'resources_title')->nullable(), + HasMany::make('Resources', 'resources', CsrCampaignResource::class), + ])->collapsable()->collapsedByDefault(), + ]; + } +} diff --git a/app/Nova/CsrCampaignResource.php b/app/Nova/CsrCampaignResource.php new file mode 100644 index 000000000..37e0181c9 --- /dev/null +++ b/app/Nova/CsrCampaignResource.php @@ -0,0 +1,38 @@ +sortable(), + Text::make('Title', 'title')->nullable(), + Textarea::make('Description', 'description')->nullable()->alwaysShow(), + Text::make('Button text', 'button_text')->nullable(), + Text::make('Button link', 'button_link')->nullable(), + Text::make('Desktop image', 'image')->nullable(), + Text::make('Mobile image', 'image_mobile')->nullable(), + Number::make('Position', 'position')->min(0)->nullable(), + Boolean::make('Active', 'active'), + ]; + } + + public static function indexQuery(NovaRequest $request, $query) + { + return $query->orderBy('position')->orderBy('id'); + } +} diff --git a/app/Nova/DancePage.php b/app/Nova/DancePage.php new file mode 100644 index 000000000..39c6bd0fb --- /dev/null +++ b/app/Nova/DancePage.php @@ -0,0 +1,65 @@ +where('id', 1); + } + + public static function authorizedToCreate(Request $request): bool + { + return false; + } + + public function fields(Request $request): array + { + return [ + ID::make()->onlyOnForms(), + Panel::make('General', [ + Boolean::make('Use dynamic content for this page', 'use_dynamic_content'), + ])->collapsable()->collapsedByDefault(), + Panel::make('Hero', [ + Text::make('Hero title', 'hero_title')->nullable(), + Trix::make('Hero subtitle', 'hero_subtitle')->nullable(), + ])->collapsable()->collapsedByDefault(), + Panel::make('Content intro', [ + Text::make('Title', 'content_intro_title')->nullable(), + Trix::make('Subtitle', 'content_intro_subtitle')->nullable(), + ])->collapsable()->collapsedByDefault(), + Panel::make('Get involved section', [ + Text::make('Title', 'get_involved_title')->nullable(), + Trix::make('Subtitle', 'get_involved_subtitle')->nullable(), + ])->collapsable()->collapsedByDefault(), + ]; + } +} diff --git a/app/Nova/OnlineCoursesPage.php b/app/Nova/OnlineCoursesPage.php new file mode 100644 index 000000000..5066eaed7 --- /dev/null +++ b/app/Nova/OnlineCoursesPage.php @@ -0,0 +1,65 @@ +where('id', 1); + } + + public static function authorizedToCreate(Request $request): bool + { + return false; + } + + public function fields(Request $request): array + { + return [ + ID::make()->onlyOnForms(), + Panel::make('General', [ + Boolean::make('Use dynamic content for this page', 'use_dynamic_content'), + ])->collapsable()->collapsedByDefault(), + Panel::make('Hero', [ + Text::make('Title', 'hero_title')->nullable(), + Trix::make('Text', 'hero_text')->nullable(), + Text::make('CTA text', 'hero_cta_text')->nullable(), + Text::make('CTA link', 'hero_cta_link')->nullable(), + ])->collapsable()->collapsedByDefault(), + Panel::make('Intro section', [ + Text::make('Title', 'intro_title')->nullable(), + Trix::make('Paragraph 1', 'intro_text_1')->nullable(), + Trix::make('Paragraph 2', 'intro_text_2')->nullable(), + Trix::make('Paragraph 3', 'intro_text_3')->nullable(), + ])->collapsable()->collapsedByDefault(), + ]; + } +} diff --git a/app/Nova/TreasureHuntPage.php b/app/Nova/TreasureHuntPage.php new file mode 100644 index 000000000..4e5711ef8 --- /dev/null +++ b/app/Nova/TreasureHuntPage.php @@ -0,0 +1,79 @@ +where('id', 1); + } + + public static function authorizedToCreate(Request $request): bool + { + return false; + } + + public function fields(Request $request): array + { + return [ + ID::make()->onlyOnForms(), + Panel::make('General', [ + Boolean::make('Use dynamic content for this page', 'use_dynamic_content'), + ])->collapsable()->collapsedByDefault(), + Panel::make('Hero', [ + Text::make('Title', 'hero_title')->nullable(), + Trix::make('Subtitle', 'hero_subtitle')->nullable(), + ])->collapsable()->collapsedByDefault(), + Panel::make('Intro section', [ + Text::make('Title', 'intro_title')->nullable(), + Trix::make('Paragraph 1', 'intro_paragraph_1')->nullable(), + Trix::make('Paragraph 2', 'intro_paragraph_2')->nullable(), + ])->collapsable()->collapsedByDefault(), + Panel::make('How to play section', [ + Text::make('Title', 'how_to_play_title')->nullable(), + Trix::make('Step 1 text', 'step_1_text')->nullable(), + Trix::make('Step 2 text', 'step_2_text')->nullable(), + Trix::make('Step 3 text', 'step_3_text')->nullable(), + Trix::make('Step 4 text', 'step_4_text')->nullable(), + Trix::make('Info box text', 'info_text')->nullable(), + ])->collapsable()->collapsedByDefault(), + Panel::make('Get involved section', [ + Text::make('Title', 'get_involved_title')->nullable(), + Trix::make('Description', 'get_involved_text')->nullable(), + Text::make('Link 1 URL', 'get_involved_link_1')->nullable(), + Text::make('Link 2 URL', 'get_involved_link_2')->nullable(), + Text::make('Link 3 URL', 'get_involved_link_3')->nullable(), + Text::make('Link 4 URL', 'get_involved_link_4')->nullable(), + Text::make('Link 5 URL', 'get_involved_link_5')->nullable(), + ])->collapsable()->collapsedByDefault(), + ]; + } +} diff --git a/app/OnlineCoursesPage.php b/app/OnlineCoursesPage.php new file mode 100644 index 000000000..97fd88e7e --- /dev/null +++ b/app/OnlineCoursesPage.php @@ -0,0 +1,39 @@ + 'boolean', + ]; + + public static function config(): self + { + $page = self::first(); + if ($page) { + return $page; + } + + return self::create([ + 'use_dynamic_content' => false, + 'hero_cta_link' => '/', + ]); + } +} diff --git a/app/Providers/NovaServiceProvider.php b/app/Providers/NovaServiceProvider.php index 9793704f6..8f0bf21a4 100644 --- a/app/Providers/NovaServiceProvider.php +++ b/app/Providers/NovaServiceProvider.php @@ -3,6 +3,8 @@ namespace App\Providers; use App\Nova\Dashboards\Main; +use App\Nova\CsrCampaignPage as CsrCampaignPageNova; +use App\Nova\DancePage as DancePageNova; use App\Nova\GetInvolvedPage as GetInvolvedPageNova; use App\Nova\MediaUpload as MediaUploadNova; use App\Nova\Metrics\EventCount; @@ -14,6 +16,8 @@ use App\Nova\SupportCaseAction as SupportCaseActionNova; use App\Nova\SupportCaseMessage as SupportCaseMessageNova; use App\Nova\SupportGmailCursor as SupportGmailCursorNova; +use App\Nova\OnlineCoursesPage as OnlineCoursesPageNova; +use App\Nova\TreasureHuntPage as TreasureHuntPageNova; use App\Nova\TrainingResource as TrainingResourceNova; use App\Nova\MenuSection as MenuSectionNova; use App\Nova\Metrics\UsersPerDay; @@ -34,7 +38,11 @@ public function boot(): void // Explicitly register newly added resources to avoid sidebar discovery misses. Nova::resources([ + CsrCampaignPageNova::class, + DancePageNova::class, GetInvolvedPageNova::class, + OnlineCoursesPageNova::class, + TreasureHuntPageNova::class, TrainingResourceNova::class, MediaUploadNova::class, SupportCaseNova::class, diff --git a/app/TreasureHuntPage.php b/app/TreasureHuntPage.php new file mode 100644 index 000000000..be31c009d --- /dev/null +++ b/app/TreasureHuntPage.php @@ -0,0 +1,53 @@ + 'boolean', + ]; + + public static function config(): self + { + $page = self::first(); + if ($page) { + return $page; + } + + return self::create([ + 'use_dynamic_content' => false, + 'get_involved_link_1' => 'https://blog.codeweek.eu/getting-started-with-eu-code-week/', + 'get_involved_link_2' => '/guide', + 'get_involved_link_3' => '/training', + 'get_involved_link_4' => 'https://bit.ly/DEEPDIVE2020', + 'get_involved_link_5' => '/resources/CodingAtHome', + ]); + } +} diff --git a/database/migrations/2026_04_15_130000_create_editable_static_pages_tables.php b/database/migrations/2026_04_15_130000_create_editable_static_pages_tables.php new file mode 100644 index 000000000..b12a2d7b2 --- /dev/null +++ b/database/migrations/2026_04_15_130000_create_editable_static_pages_tables.php @@ -0,0 +1,108 @@ +id(); + $table->boolean('use_dynamic_content')->default(false); + $table->text('hero_title')->nullable(); + $table->longText('hero_text')->nullable(); + $table->text('hero_cta_text')->nullable(); + $table->text('hero_cta_link')->nullable(); + $table->text('intro_title')->nullable(); + $table->longText('intro_text_1')->nullable(); + $table->longText('intro_text_2')->nullable(); + $table->longText('intro_text_3')->nullable(); + $table->timestamps(); + }); + } + + if (!Schema::hasTable('csr_campaign_page')) { + Schema::create('csr_campaign_page', function (Blueprint $table) { + $table->id(); + $table->boolean('use_dynamic_content')->default(false); + $table->longText('hero_text')->nullable(); + $table->text('primary_cta_text')->nullable(); + $table->text('primary_cta_link')->nullable(); + $table->text('secondary_cta_text')->nullable(); + $table->text('secondary_cta_link')->nullable(); + $table->text('about_title')->nullable(); + $table->longText('about_description')->nullable(); + $table->text('resources_title')->nullable(); + $table->timestamps(); + }); + } + + if (!Schema::hasTable('csr_campaign_resources')) { + Schema::create('csr_campaign_resources', function (Blueprint $table) { + $table->id(); + $table->foreignId('page_id')->constrained('csr_campaign_page')->cascadeOnDelete(); + $table->text('title')->nullable(); + $table->longText('description')->nullable(); + $table->text('button_text')->nullable(); + $table->text('button_link')->nullable(); + $table->text('image')->nullable(); + $table->text('image_mobile')->nullable(); + $table->integer('position')->default(0); + $table->boolean('active')->default(true); + $table->timestamps(); + }); + } + + if (!Schema::hasTable('dance_page')) { + Schema::create('dance_page', function (Blueprint $table) { + $table->id(); + $table->boolean('use_dynamic_content')->default(false); + $table->text('hero_title')->nullable(); + $table->longText('hero_subtitle')->nullable(); + $table->text('content_intro_title')->nullable(); + $table->longText('content_intro_subtitle')->nullable(); + $table->text('get_involved_title')->nullable(); + $table->longText('get_involved_subtitle')->nullable(); + $table->timestamps(); + }); + } + + if (!Schema::hasTable('treasure_hunt_page')) { + Schema::create('treasure_hunt_page', function (Blueprint $table) { + $table->id(); + $table->boolean('use_dynamic_content')->default(false); + $table->text('hero_title')->nullable(); + $table->longText('hero_subtitle')->nullable(); + $table->text('intro_title')->nullable(); + $table->longText('intro_paragraph_1')->nullable(); + $table->longText('intro_paragraph_2')->nullable(); + $table->text('how_to_play_title')->nullable(); + $table->longText('step_1_text')->nullable(); + $table->longText('step_2_text')->nullable(); + $table->longText('step_3_text')->nullable(); + $table->longText('step_4_text')->nullable(); + $table->longText('info_text')->nullable(); + $table->text('get_involved_title')->nullable(); + $table->longText('get_involved_text')->nullable(); + $table->text('get_involved_link_1')->nullable(); + $table->text('get_involved_link_2')->nullable(); + $table->text('get_involved_link_3')->nullable(); + $table->text('get_involved_link_4')->nullable(); + $table->text('get_involved_link_5')->nullable(); + $table->timestamps(); + }); + } + } + + public function down(): void + { + Schema::dropIfExists('treasure_hunt_page'); + Schema::dropIfExists('dance_page'); + Schema::dropIfExists('csr_campaign_resources'); + Schema::dropIfExists('csr_campaign_page'); + Schema::dropIfExists('online_courses_page'); + } +}; diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 7ffb504a4..feb376e32 100755 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -32,6 +32,7 @@ public function run(): void $this->call(DreamJobRoleModelSeeder::class); $this->call(DreamJobsPageSeeder::class); $this->call(GetInvolvedPageSeeder::class); + $this->call(EditableStaticPagesSeeder::class); $this->call(HackathonsPageSeeder::class); $this->call(SchoolSeeder::class); diff --git a/database/seeders/EditableStaticPagesSeeder.php b/database/seeders/EditableStaticPagesSeeder.php new file mode 100644 index 000000000..3234d0fd3 --- /dev/null +++ b/database/seeders/EditableStaticPagesSeeder.php @@ -0,0 +1,151 @@ +seedOnlineCoursesPage(); + $this->seedCsrPage(); + $this->seedDancePage(); + $this->seedTreasureHuntPage(); + } + + private function seedOnlineCoursesPage(): void + { + if (!Schema::hasTable('online_courses_page')) { + return; + } + + OnlineCoursesPage::firstOrCreate( + ['id' => 1], + [ + 'use_dynamic_content' => true, + 'hero_title' => 'Online Courses', + 'hero_text' => __('online-courses.online-courses-text'), + 'hero_cta_text' => 'Optional secondary CTA introduction to online courses', + 'hero_cta_link' => '/', + 'intro_title' => 'EU Code Week Online Courses', + 'intro_text_1' => __('online-courses.online-courses-sub-text1'), + 'intro_text_2' => __('online-courses.online-courses-sub-text2'), + 'intro_text_3' => __('online-courses.online-courses-sub-text3'), + ] + ); + } + + private function seedCsrPage(): void + { + if (!Schema::hasTable('csr_campaign_page')) { + return; + } + + $page = CsrCampaignPage::firstOrCreate( + ['id' => 1], + [ + 'use_dynamic_content' => true, + 'hero_text' => __('csr-campaign.landing_header'), + 'primary_cta_text' => __('csr-campaign.get_involved'), + 'primary_cta_link' => 'https://codeweek.eu/blog/futurereadycsr-campaign-launch', + 'secondary_cta_text' => __('csr-campaign.explore_resources'), + 'secondary_cta_link' => 'https://codeweek.eu/blog/futurereadycsr-resources', + 'about_title' => __('csr-campaign.about_title'), + 'about_description' => __('csr-campaign.about_description'), + 'resources_title' => __('csr-campaign.resources'), + ] + ); + + if (!Schema::hasTable('csr_campaign_resources')) { + return; + } + + $resources = [ + ['i' => 1, 'img' => '/images/csr/res1_explore_befefits_vertical.jpg', 'img_mobile' => '/images/csr/res1_explore_befefits_horizontal.jpg'], + ['i' => 2, 'img' => '/images/csr/res2_first_steps_vertical.jpg', 'img_mobile' => '/images/csr/res2_first_steps_horizontal.jpg'], + ['i' => 3, 'img' => '/images/csr/res3_pledge_badge_vertical.jpg', 'img_mobile' => '/images/csr/res3_pledge_badge_horizontal.jpg'], + ['i' => 4, 'img' => '/images/csr/res4_csr_toolkit_vertical.jpg', 'img_mobile' => '/images/csr/res4_csr_toolkit_horizontal.jpg'], + ['i' => 5, 'img' => '/images/csr/res5_employee_voluntering_vertical.jpg', 'img_mobile' => '/images/csr/res5_employee_voluntering_horizontal.jpg'], + ['i' => 6, 'img' => '/images/csr/res6_mentorship_programme_vertical.jpg', 'img_mobile' => '/images/csr/res6_mentorship_programme_horizontal.jpg'], + ['i' => 7, 'img' => '/images/csr/res7_empowering_industry_vertical.jpg', 'img_mobile' => '/images/csr/res7_empowering_industry_horizontal.jpg'], + ['i' => 8, 'img' => '/images/csr/res8_csr_survey_vertical.jpg', 'img_mobile' => '/images/csr/res8_csr_survey_horizontal.jpg'], + ['i' => 9, 'img' => '/images/csr/res9_faq_vertical.jpg', 'img_mobile' => '/images/csr/res9_faq_horizontal.jpg'], + ['i' => 10, 'img' => '/images/csr/res10_happening_now_vertical.jpg', 'img_mobile' => '/images/csr/res10_happening_now_horizontal.jpg'], + ]; + + foreach ($resources as $index => $item) { + $i = $item['i']; + CsrCampaignResource::updateOrCreate( + ['page_id' => $page->id, 'position' => $index], + [ + 'title' => __("csr-campaign.resource_title_{$i}"), + 'description' => __("csr-campaign.resource_description_{$i}"), + 'button_text' => __("csr-campaign.resource_button_{$i}"), + 'button_link' => __("csr-campaign.resource_link_{$i}"), + 'image' => $item['img'], + 'image_mobile' => $item['img_mobile'], + 'active' => true, + ] + ); + } + } + + private function seedDancePage(): void + { + if (!Schema::hasTable('dance_page')) { + return; + } + + DancePage::firstOrCreate( + ['id' => 1], + [ + 'use_dynamic_content' => true, + 'hero_title' => __('cw2020.title.0'), + 'hero_subtitle' => __('cw2020.dance.title'), + 'content_intro_title' => __('cw2020.dance.title'), + 'content_intro_subtitle' => __('snippets.dance.subtitle'), + 'get_involved_title' => __('cw2020.get-involved.title'), + 'get_involved_subtitle' => __('cw2020.get-involved.subtitle'), + ] + ); + } + + private function seedTreasureHuntPage(): void + { + if (!Schema::hasTable('treasure_hunt_page')) { + return; + } + + TreasureHuntPage::firstOrCreate( + ['id' => 1], + [ + 'use_dynamic_content' => true, + 'hero_title' => 'Treasure Hunt', + 'hero_subtitle' => 'Simple yet challenging Telegram game – easy for beginners, engaging for experienced players.', + 'intro_title' => 'Code Week Treasure Hunt', + 'intro_paragraph_1' => 'This is a game on Telegram that is simple enough for beginners, but also challenging to keep experienced participants on their toes.', + 'intro_paragraph_2' => 'The Code Week Treasure Hunt is a game best played on your PC with a mobile phone in hand. The game will ask you to solve coding challenges and guide you through the history of coding, computer science and technology in Europe.', + 'how_to_play_title' => 'How to play', + 'step_1_text' => 'Download the Telegram app. It is available for Desktop (Windows, macOS and Linux), iOS and Android You can play the game either on your PC or laptop, or on your smartphone. We recommend you play it on your computer so that you can get the instructions and solve the coding challenges on the Telegram app on your phone.', + 'step_2_text' => 'To play the game, open the game and scan the QR code that will take you to the Telegram app and give you the first set of instructions.', + 'step_3_text' => 'To win, you need to solve 10 coding challenges and find 10 locations on the map of Europe that are linked to the rise of coding and technology.', + 'step_4_text' => 'After you complete the game, share your score with your friends using #EUCodeWeek and challenge them to play and learn about the history of coding too. Let\'s see who scores the top results!', + 'info_text' => 'The Code Week Treasure Hunt is the virtual version of the original EU Code Week Treasure Hunt which was first developed by Alessandro Bogliolo, Professor of Computer Systems at the University of Urbino. To learn more about his original game, visit our blog.', + 'get_involved_title' => 'How to get involved', + 'get_involved_text' => 'Can’t wait to start coding? If you would like to join the EU Code Week community but don\'t know where to start, take a look at these resources that will help get you started, just in time for our annual celebration in October.', + 'get_involved_link_1' => 'https://blog.codeweek.eu/getting-started-with-eu-code-week/', + 'get_involved_link_2' => '/guide', + 'get_involved_link_3' => '/training', + 'get_involved_link_4' => 'https://bit.ly/DEEPDIVE2020', + 'get_involved_link_5' => '/resources/CodingAtHome', + ] + ); + } +} diff --git a/resources/views/online-courses.blade.php b/resources/views/online-courses.blade.php index a030e533f..da3bf6b27 100644 --- a/resources/views/online-courses.blade.php +++ b/resources/views/online-courses.blade.php @@ -7,6 +7,10 @@ ]; @endphp +@php + $dynamic = $page && $page->use_dynamic_content; +@endphp + @section('layout.breadcrumb') @include('layout.breadcrumb', ['list' => $list]) @endsection @@ -25,14 +29,18 @@

- Online Courses + {{ $dynamic && $page->hero_title ? $page->hero_title : 'Online Courses' }}

- @lang('online-courses.online-courses-text') + @if($dynamic && $page->hero_text) + {!! $page->hero_text !!} + @else + @lang('online-courses.online-courses-text') + @endif

- - Optional secondary CTA introduction to online courses + + {{ $dynamic && $page->hero_cta_text ? $page->hero_cta_text : 'Optional secondary CTA introduction to online courses' }} @@ -60,15 +68,27 @@ class="absolute top-0 right-0 h-full max-w-[calc(70vw)] object-cover hidden md:b

- EU Code Week Online Courses + {{ $dynamic && $page->intro_title ? $page->intro_title : 'EU Code Week Online Courses' }}

- @lang('online-courses.online-courses-sub-text1') -
- @lang('online-courses.online-courses-sub-text2') + @if($dynamic && $page->intro_text_1) + {!! $page->intro_text_1 !!} + @else + @lang('online-courses.online-courses-sub-text1') + @endif +
+ @if($dynamic && $page->intro_text_2) + {!! $page->intro_text_2 !!} + @else + @lang('online-courses.online-courses-sub-text2') + @endif

- @lang('online-courses.online-courses-sub-text3') + @if($dynamic && $page->intro_text_3) + {!! $page->intro_text_3 !!} + @else + @lang('online-courses.online-courses-sub-text3') + @endif

diff --git a/resources/views/static/csr-campaign.blade.php b/resources/views/static/csr-campaign.blade.php index 82ad1af04..3d4af0025 100644 --- a/resources/views/static/csr-campaign.blade.php +++ b/resources/views/static/csr-campaign.blade.php @@ -89,6 +89,16 @@ ]; @endphp +@php + $hasPageTable = \Illuminate\Support\Facades\Schema::hasTable('csr_campaign_page'); + $hasResourcesTable = \Illuminate\Support\Facades\Schema::hasTable('csr_campaign_resources'); + $page = $hasPageTable ? \App\CsrCampaignPage::config() : null; + $dynamic = $page && $page->use_dynamic_content; + $dynamicResources = ($dynamic && $page && $hasResourcesTable) + ? $page->resources()->where('active', true)->orderBy('position')->get() + : collect(); + $resourcesToRender = $dynamicResources->isNotEmpty() ? $dynamicResources : collect($resources); +@endphp @section('layout.breadcrumb') @include('layout.breadcrumb', ['list' => $list]) @endsection @@ -101,20 +111,24 @@
@@ -138,10 +152,14 @@ class="absolute top-0 right-0 h-full max-w-[calc(70vw)] object-cover hidden md:b

- @lang('csr-campaign.about_title') + {{ $dynamic && $page->about_title ? $page->about_title : __('csr-campaign.about_title') }}

- @lang('csr-campaign.about_description') + @if($dynamic && $page->about_description) + {!! $page->about_description !!} + @else + @lang('csr-campaign.about_description') + @endif

- @lang('csr-campaign.resources') + {{ $dynamic && $page->resources_title ? $page->resources_title : __('csr-campaign.resources') }}

- @foreach($resources as $resource) + @foreach($resourcesToRender as $resource)
@@ -188,7 +206,7 @@ class="text-nowrap flex justify-center items-center bg-primary hover:bg-hover-or {{ $resource->title }} diff --git a/resources/views/static/dance.blade.php b/resources/views/static/dance.blade.php index 55f37565f..f99cf14c7 100644 --- a/resources/views/static/dance.blade.php +++ b/resources/views/static/dance.blade.php @@ -7,6 +7,9 @@ $list = [ (object) ['label' => 'Dance', 'href' => ''], ]; + $hasDanceTable = \Illuminate\Support\Facades\Schema::hasTable('dance_page'); + $page = $hasDanceTable ? \App\DancePage::config() : null; + $dynamic = $page && $page->use_dynamic_content; @endphp @section('layout.breadcrumb') @@ -21,10 +24,14 @@

- @lang('cw2020.title.0') + {{ $dynamic && $page->hero_title ? $page->hero_title : __('cw2020.title.0') }}

- @lang('cw2020.dance.title') + @if($dynamic && $page->hero_subtitle) + {!! $page->hero_subtitle !!} + @else + @lang('cw2020.dance.title') + @endif

-

@lang('cw2020.dance.title')

-

@lang('snippets.dance.subtitle')

+

+ {{ $dynamic && $page->content_intro_title ? $page->content_intro_title : __('cw2020.dance.title') }} +

+

+ @if($dynamic && $page->content_intro_subtitle) + {!! $page->content_intro_subtitle !!} + @else + @lang('snippets.dance.subtitle') + @endif +

@lang('cw2020.dance.section1.title') @@ -128,8 +143,16 @@ class="absolute top-0 right-0 !h-full w-full max-w-[calc(70vw)] object-cover hid @lang('cw2020.dance.outro.3').

-

@lang('cw2020.get-involved.title')

-

@lang('cw2020.get-involved.subtitle').

+

+ {{ $dynamic && $page->get_involved_title ? $page->get_involved_title : __('cw2020.get-involved.title') }} +

+

+ @if($dynamic && $page->get_involved_subtitle) + {!! $page->get_involved_subtitle !!} + @else + @lang('cw2020.get-involved.subtitle'). + @endif +

  • @lang('cw2020.get-involved.content.0')
  • @lang('cw2020.get-involved.content.1')
  • diff --git a/resources/views/static/treasure-hunt.blade.php b/resources/views/static/treasure-hunt.blade.php index b7107c1f9..74ece5d0f 100644 --- a/resources/views/static/treasure-hunt.blade.php +++ b/resources/views/static/treasure-hunt.blade.php @@ -5,6 +5,9 @@ (object) ['label' => 'Educational Resources', 'href' => '/educational-resources'], (object) ['label' => 'Treasure Hunt', 'href' => ''], ]; + $hasTreasureTable = \Illuminate\Support\Facades\Schema::hasTable('treasure_hunt_page'); + $page = $hasTreasureTable ? \App\TreasureHuntPage::config() : null; + $dynamic = $page && $page->use_dynamic_content; @endphp @section('layout.breadcrumb') @@ -22,10 +25,14 @@

    - Treasure Hunt + {{ $dynamic && $page->hero_title ? $page->hero_title : 'Treasure Hunt' }}

    - Simple yet challenging Telegram game – easy for beginners, engaging for experienced players. + @if($dynamic && $page->hero_subtitle) + {!! $page->hero_subtitle !!} + @else + Simple yet challenging Telegram game – easy for beginners, engaging for experienced players. + @endif

    @@ -50,13 +57,21 @@ class="absolute top-0 right-0 h-full max-w-[calc(70vw)] object-cover hidden md:b

    - Code Week Treasure Hunt + {{ $dynamic && $page->intro_title ? $page->intro_title : 'Code Week Treasure Hunt' }}

    - This is a game on Telegram that is simple enough for beginners, but also challenging to keep experienced participants on their toes. + @if($dynamic && $page->intro_paragraph_1) + {!! $page->intro_paragraph_1 !!} + @else + This is a game on Telegram that is simple enough for beginners, but also challenging to keep experienced participants on their toes. + @endif

    - The Code Week Treasure Hunt is a game best played on your PC with a mobile phone in hand. The game will ask you to solve coding challenges and guide you through the history of coding, computer science and technology in Europe. + @if($dynamic && $page->intro_paragraph_2) + {!! $page->intro_paragraph_2 !!} + @else + The Code Week Treasure Hunt is a game best played on your PC with a mobile phone in hand. The game will ask you to solve coding challenges and guide you through the history of coding, computer science and technology in Europe. + @endif

    @@ -78,7 +93,7 @@ class="animation-element move-background duration-[1.5s] absolute z-0 lg:-bottom

    - How to play + {{ $dynamic && $page->how_to_play_title ? $page->how_to_play_title : 'How to play' }}

    @@ -87,7 +102,11 @@ class="animation-element move-background duration-[1.5s] absolute z-0 lg:-bottom

    - Download the Telegram app. It is available for Desktop (Windows, macOS and Linux), iOS and Android You can play the game either on your PC or laptop, or on your smartphone. We recommend you play it on your computer so that you can get the instructions and solve the coding challenges on the Telegram app on your phone. + @if($dynamic && $page->step_1_text) + {!! $page->step_1_text !!} + @else + Download the Telegram app. It is available for Desktop (Windows, macOS and Linux), iOS and Android You can play the game either on your PC or laptop, or on your smartphone. We recommend you play it on your computer so that you can get the instructions and solve the coding challenges on the Telegram app on your phone. + @endif

    @@ -98,7 +117,11 @@ class="animation-element move-background duration-[1.5s] absolute z-0 lg:-bottom

    - To play the game, open the game and scan the QR code that will take you to the Telegram app and give you the first set of instructions. + @if($dynamic && $page->step_2_text) + {!! $page->step_2_text !!} + @else + To play the game, open the game and scan the QR code that will take you to the Telegram app and give you the first set of instructions. + @endif

    @@ -109,7 +132,11 @@ class="animation-element move-background duration-[1.5s] absolute z-0 lg:-bottom

    - To win, you need to solve 10 coding challenges and find 10 locations on the map of Europe that are linked to the rise of coding and technology. + @if($dynamic && $page->step_3_text) + {!! $page->step_3_text !!} + @else + To win, you need to solve 10 coding challenges and find 10 locations on the map of Europe that are linked to the rise of coding and technology. + @endif

    @@ -119,7 +146,11 @@ class="animation-element move-background duration-[1.5s] absolute z-0 lg:-bottom

    - After you complete the game, share your score with your friends using #EUCodeWeek and challenge them to play and learn about the history of coding too. Let's see who scores the top results! + @if($dynamic && $page->step_4_text) + {!! $page->step_4_text !!} + @else + After you complete the game, share your score with your friends using #EUCodeWeek and challenge them to play and learn about the history of coding too. Let's see who scores the top results! + @endif

    @@ -127,7 +158,11 @@ class="animation-element move-background duration-[1.5s] absolute z-0 lg:-bottom

    - The Code Week Treasure Hunt is the virtual version of the original EU Code Week Treasure Hunt which was first developed by Alessandro Bogliolo, Professor of Computer Systems at the University of Urbino. To learn more about his original game, visit our blog. + @if($dynamic && $page->info_text) + {!! $page->info_text !!} + @else + The Code Week Treasure Hunt is the virtual version of the original EU Code Week Treasure Hunt which was first developed by Alessandro Bogliolo, Professor of Computer Systems at the University of Urbino. To learn more about his original game, visit our blog. + @endif

@@ -147,16 +182,20 @@ class="animation-element move-background duration-[1.5s] absolute z-0 lg:-bottom

- How to get involved + {{ $dynamic && $page->get_involved_title ? $page->get_involved_title : 'How to get involved' }}

- Can’t wait to start coding? If you would like to join the EU Code Week community but don't know where to start, take a look at these resources that will help get you started, just in time for our annual celebration in October. + @if($dynamic && $page->get_involved_text) + {!! $page->get_involved_text !!} + @else + Can’t wait to start coding? If you would like to join the EU Code Week community but don't know where to start, take a look at these resources that will help get you started, just in time for our annual celebration in October. + @endif

- - - - - + + + + +