diff --git a/app/GirlsInDigitalButton.php b/app/GirlsInDigitalButton.php new file mode 100644 index 000000000..3f9f46903 --- /dev/null +++ b/app/GirlsInDigitalButton.php @@ -0,0 +1,35 @@ + 'boolean', + 'enabled' => 'boolean', + 'position' => 'integer', + ]; + + public function scopeEnabled($query) + { + return $query->where('enabled', true); + } + + public function scopeOrdered($query) + { + return $query->orderBy('position')->orderBy('id'); + } +} diff --git a/app/GirlsInDigitalPage.php b/app/GirlsInDigitalPage.php new file mode 100644 index 000000000..6f3fb8552 --- /dev/null +++ b/app/GirlsInDigitalPage.php @@ -0,0 +1,39 @@ + 'array']; + + /** + * Get the singleton page config (id = 1). Create if missing. + */ + public static function config(): self + { + $page = self::first(); + if ($page) { + return $page; + } + return self::create(['locale_overrides' => null]); + } + + /** + * Get content for a key in the current locale: override or lang fallback. + */ + public function contentForLocale(string $key, ?string $locale = null): string + { + $locale = $locale ?? app()->getLocale(); + $overrides = $this->locale_overrides ?? []; + if (! empty($overrides[$locale][$key])) { + return (string) $overrides[$locale][$key]; + } + return (string) __('girls-in-digital.' . $key); + } +} diff --git a/app/Http/View/Composers/GirlsInDigitalComposer.php b/app/Http/View/Composers/GirlsInDigitalComposer.php new file mode 100644 index 000000000..8df47868d --- /dev/null +++ b/app/Http/View/Composers/GirlsInDigitalComposer.php @@ -0,0 +1,21 @@ +ordered()->get(); + } + $page = Schema::hasTable('girls_in_digital_page') ? GirlsInDigitalPage::config() : null; + $view->with(compact('buttons', 'page')); + } +} diff --git a/app/Nova/GirlsInDigitalButton.php b/app/Nova/GirlsInDigitalButton.php new file mode 100644 index 000000000..416ec6fec --- /dev/null +++ b/app/Nova/GirlsInDigitalButton.php @@ -0,0 +1,57 @@ +sortable(), + Text::make('Key', 'key') + ->rules('required') + ->help('Unique identifier, e.g. gcib_sprint_hero. Used in the blade to place the button.'), + Text::make('Label', 'label')->rules('required'), + Text::make('URL', 'url')->rules('required')->hideFromIndex(), + Boolean::make('Open in new tab', 'open_new_tab'), + Boolean::make('Enabled', 'enabled') + ->help('When disabled, this button is hidden on the Girls in Digital page.'), + Number::make('Position', 'position')->min(0)->default(0), + ]; + } + + public static function indexQuery(NovaRequest $request, $query) + { + return $query->orderBy('position')->orderBy('id'); + } +} diff --git a/app/Nova/GirlsInDigitalPage.php b/app/Nova/GirlsInDigitalPage.php new file mode 100644 index 000000000..338d2f3fc --- /dev/null +++ b/app/Nova/GirlsInDigitalPage.php @@ -0,0 +1,109 @@ +json() + ->nullable() + ->help($keysHelp) + ->resolveUsing(function () use ($locale) { + $overrides = $this->resource->locale_overrides ?? []; + $data = $overrides[$locale] ?? []; + return $data; + }) + ->fillUsing(function ($request, $model, $attribute, $requestAttribute) { + $locale = str_replace('locale_override_', '', $attribute); + $value = $request->get($requestAttribute); + $overrides = $model->locale_overrides ?? []; + $overrides[$locale] = is_string($value) ? (json_decode($value, true) ?? []) : (is_array($value) ? $value : []); + $model->locale_overrides = $overrides; + }), + ]); + } + + return [ + ID::make()->onlyOnForms(), + new Panel('Per-locale content overrides (optional)', [ + \Laravel\Nova\Fields\Heading::make('Expand a locale below to override text for that language. Defaults come from resources/lang/{locale}/girls-in-digital.php.'), + ...$localePanels, + ]), + ]; + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 7cc806f2c..f3624066a 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -116,6 +116,8 @@ function ($view) { $view->with('active_countries', \App\Country::withEvents()); }); + View::composer('static.girls-in-digital-week', \App\Http\View\Composers\GirlsInDigitalComposer::class); + /** * Paginate a standard Laravel Collection. * diff --git a/database/migrations/2026_02_09_200000_create_girls_in_digital_buttons_table.php b/database/migrations/2026_02_09_200000_create_girls_in_digital_buttons_table.php new file mode 100644 index 000000000..5ad8cbcc4 --- /dev/null +++ b/database/migrations/2026_02_09_200000_create_girls_in_digital_buttons_table.php @@ -0,0 +1,27 @@ +id(); + $table->string('key')->unique(); + $table->string('label'); + $table->string('url'); + $table->boolean('open_new_tab')->default(false); + $table->boolean('enabled')->default(true); + $table->unsignedInteger('position')->default(0); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('girls_in_digital_buttons'); + } +}; diff --git a/database/migrations/2026_02_09_200001_create_girls_in_digital_page_table.php b/database/migrations/2026_02_09_200001_create_girls_in_digital_page_table.php new file mode 100644 index 000000000..147002f77 --- /dev/null +++ b/database/migrations/2026_02_09_200001_create_girls_in_digital_page_table.php @@ -0,0 +1,24 @@ +id(); + $table->json('locale_overrides')->nullable(); + $table->timestamps(); + }); + DB::table('girls_in_digital_page')->insert(['locale_overrides' => null, 'created_at' => now(), 'updated_at' => now()]); + } + + public function down(): void + { + Schema::dropIfExists('girls_in_digital_page'); + } +}; diff --git a/database/seeders/GirlsInDigitalButtonSeeder.php b/database/seeders/GirlsInDigitalButtonSeeder.php new file mode 100644 index 000000000..a9ececc6e --- /dev/null +++ b/database/seeders/GirlsInDigitalButtonSeeder.php @@ -0,0 +1,36 @@ + 'gcib_sprint_hero', 'label' => 'Girls Code It Better Sprint', 'url' => 'https://codeweek.eu/blog/girls-in-digital-week-2026/', 'open_new_tab' => false, 'position' => 0], + ['key' => 'female_role_models', 'label' => 'Female Role Models Database', 'url' => 'https://codeweek.ecwt.eu/', 'open_new_tab' => true, 'position' => 1], + ['key' => 'open_call_challenges', 'label' => 'Open Call for GiD Challenges', 'url' => '/docs/girls-in-digital/open-call-for-new-code-week-challenges_v2.pdf', 'open_new_tab' => true, 'position' => 2], + ['key' => 'search_activity', 'label' => 'Search an activity', 'url' => '/events', 'open_new_tab' => false, 'position' => 3], + ['key' => 'meet_role_model', 'label' => 'Meet a Role Model', 'url' => 'https://codeweek.ecwt.eu/role-models/', 'open_new_tab' => true, 'position' => 4], + ['key' => 'organise_gcib_sprint', 'label' => 'Organise a GCIB Sprint', 'url' => 'https://codeweek-resources.s3.eu-west-1.amazonaws.com/GCIB-Sprint-materials.zip', 'open_new_tab' => false, 'position' => 5], + ['key' => 'activity_guideline', 'label' => 'Girls in Digital Activity Guideline', 'url' => '/docs/girls-in-digital/girls-in-digital-activity-guidelines.pdf', 'open_new_tab' => true, 'position' => 6], + ['key' => 'social_media_kit', 'label' => 'Social Media Kit', 'url' => '/docs/girls-in-digital/girls-in-digital-media-kit.pdf', 'open_new_tab' => true, 'position' => 7], + ]; + + foreach ($defaults as $i => $row) { + GirlsInDigitalButton::updateOrCreate( + ['key' => $row['key']], + [ + 'label' => $row['label'], + 'url' => $row['url'], + 'open_new_tab' => $row['open_new_tab'], + 'enabled' => true, + 'position' => $row['position'], + ] + ); + } + } +} diff --git a/resources/views/static/girls-in-digital-week.blade.php b/resources/views/static/girls-in-digital-week.blade.php index cc70b8f5f..668a22f39 100644 --- a/resources/views/static/girls-in-digital-week.blade.php +++ b/resources/views/static/girls-in-digital-week.blade.php @@ -9,6 +9,15 @@ @include('layout.breadcrumb', ['list' => $list]) @endsection +@php + $btn = function($key) use ($buttons) { + if (!isset($buttons) || $buttons->isEmpty()) { return null; } + return $buttons->keyBy('key')->get($key); + }; + $content = function($key) use ($page) { + return $page ? $page->contentForLocale($key) : (__('girls-in-digital.' . $key) ?: ''); + }; +@endphp @section('content')
@@ -63,15 +72,28 @@ class="animation-element move-background duration-[1.5s] absolute top-0 left-0 w

- About Girls in Digital + {{ $content('about_girls_title') ?: 'About Girls in Digital' }}

- Get ready to celebrate Girls in Digital Week from 23–27 March 2026, as we put a spotlight on inclusion, innovation, and the limitless opportunities digital skills offer to all! + {{ $content('about_girls_description_1') ?: 'Get ready to celebrate Girls in Digital Week from 23–27 March 2026, as we put a spotlight on inclusion, innovation, and the limitless opportunities digital skills offer to all!' }}

- Girls in Digital encourages communities to get involved in meaningful ways. Through Girls Code It Better (GCIB) Sprints, educators and organisations can offer hands-on learning experiences where girls collaborate, build confidence, and solve real-world challenges using digital tools. The Female Role Model Database connects young people with women and gender-diverse professionals in STE(A)M, sharing stories and guidance that support their digital journeys. Together, these initiatives help turn curiosity into confidence and ideas into possibility. + {!! $content('about_girls_description_2') ?: 'Girls in Digital encourages communities to get involved in meaningful ways. Through Girls Code It Better (GCIB) Sprints, educators and organisations can offer hands-on learning experiences where girls collaborate, build confidence, and solve real-world challenges using digital tools. The Female Role Model Database connects young people with women and gender-diverse professionals in STE(A)M, sharing stories and guidance that support their digital journeys. Together, these initiatives help turn curiosity into confidence and ideas into possibility.' !!}

+ @endif
@@ -121,70 +164,64 @@ class="animation-element move-background duration-[1.5s] absolute z-0 -bottom-28

- Resources + {{ $content('resource_title') ?: 'Resources' }}

- Are you a young person or parent? + {{ $content('resource_person_title') ?: 'Are you a young person or parent?' }}

- You are a young person curious about technology, coding, or digital creativity; search for activities near you or connect with a role model through the Female Role Model Database. - You are a parent seeking safe, inclusive digital activities; find opportunities nearby and explore the Female Role Model Database for inspiring role models. - + {!! $content('resource_person_description_1') ?: 'You are a young person curious about technology, coding, or digital creativity; search for activities near you or connect with a role model through the Female Role Model Database. You are a parent seeking safe, inclusive digital activities; find opportunities nearby and explore the Female Role Model Database for inspiring role models.' !!}

- Are you an educator? + {{ $content('resource_educator_title') ?: 'Are you an educator?' }}

- You are an educator looking to organise an activity to empower youth with digital skills in a safe and inclusive environment, where all feel welcomed to explore the endless opportunities that digital has to offer. Check our resources below for guidance and support in bringing your activity to life. + {{ $content('resource_educator_description') ?: 'You are an educator looking to organise an activity to empower youth with digital skills in a safe and inclusive environment, where all feel welcomed to explore the endless opportunities that digital has to offer. Check our resources below for guidance and support in bringing your activity to life.' }}