Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions app/GrassrootsGrantsHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,29 @@ public function isStatusOnly(): bool
{
return in_array($this->hub_status, ['not_launched', 'cancelled'], true);
}

public function statusLabel(): ?string
{
return match ($this->hub_status) {
'not_launched' => 'Call not launched',
'cancelled' => 'Cancelled due to low number of applications',
default => null,
};
}

public function statusBodyHtml(): string
{
$message = trim(strip_tags((string) ($this->status_message ?? ''), '<p><br><strong><em><a><ul><ol><li>'));
if ($message !== '') {
if (str_contains((string) $this->status_message, '<')) {
return (string) $this->status_message;
}

return '<p>'.e($message).'</p>';
}

$overview = trim((string) ($this->overview ?? ''));

return $overview;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
public function up(): void
{
if (! Schema::hasTable('grassroots_grants_hubs')) {
return;
}

$updates = [
'Poland – KPI' => [
'hub_status' => 'not_launched',
'status_message' => '<p>The small grants call was not launched in Poland during the implementation period. As a result, no projects were funded under Round 1 in this country.</p>',
],
'Malta – eSkills Malta' => [
'hub_status' => 'cancelled',
'status_message' => '<p>The small grants call in Malta was cancelled due to a low number of applications. Consequently, no projects were selected or implemented under Round 1.</p>',
],
'Ireland – Microsoft' => [
'hub_status' => 'not_launched',
'status_message' => '<p>The small grants call was not launched in Ireland during the implementation period. Therefore, no projects were funded under Round 1.</p>',
],
'Denmark, Finland, Iceland, Norway & Sweden – ECWT' => [
'hub_status' => 'not_launched',
'status_message' => '<p>The small grants call was not launched in the Nordic region during the implementation period. As a result, no projects were funded under Round 1 in these countries.</p>',
],
];

foreach ($updates as $title => $data) {
DB::table('grassroots_grants_hubs')
->where('title', $title)
->update(array_merge($data, ['updated_at' => now()]));
}
}

public function down(): void
{
// No rollback needed for content corrections.
}
};
8 changes: 4 additions & 4 deletions database/seeders/data/grassroots_grants_round1.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
'activities_on_platform' => null,
'overview' => '<p>The small grants call was not launched in Poland during the implementation period. As a result, no projects were funded under Round 1 in this country.</p>',
'underserved_focus' => null,
'status_message' => 'The small grants call was not launched in Poland during the implementation period. As a result, no projects were funded under Round 1 in this country.',
'status_message' => '<p>The small grants call was not launched in Poland during the implementation period. As a result, no projects were funded under Round 1 in this country.</p>',
'image_folder' => null,
'projects' => [],
],
Expand All @@ -520,7 +520,7 @@
'activities_on_platform' => null,
'overview' => '<p>The small grants call in Malta was cancelled due to a low number of applications. Consequently, no projects were selected or implemented under Round 1.</p>',
'underserved_focus' => null,
'status_message' => 'The small grants call in Malta was cancelled due to a low number of applications. Consequently, no projects were selected or implemented under Round 1.',
'status_message' => '<p>The small grants call in Malta was cancelled due to a low number of applications. Consequently, no projects were selected or implemented under Round 1.</p>',
'image_folder' => null,
'projects' => [],
],
Expand All @@ -533,7 +533,7 @@
'activities_on_platform' => null,
'overview' => '<p>The small grants call was not launched in Ireland during the implementation period. Therefore, no projects were funded under Round 1.</p>',
'underserved_focus' => null,
'status_message' => 'The small grants call was not launched in Ireland during the implementation period. Therefore, no projects were funded under Round 1.',
'status_message' => '<p>The small grants call was not launched in Ireland during the implementation period. Therefore, no projects were funded under Round 1.</p>',
'image_folder' => null,
'projects' => [],
],
Expand Down Expand Up @@ -1029,7 +1029,7 @@
'activities_on_platform' => null,
'overview' => '<p>The small grants call was not launched in the Nordic region during the implementation period. As a result, no projects were funded under Round 1 in these countries.</p>',
'underserved_focus' => null,
'status_message' => 'The small grants call was not launched in the Nordic region during the implementation period. As a result, no projects were funded under Round 1 in these countries.',
'status_message' => '<p>The small grants call was not launched in the Nordic region during the implementation period. As a result, no projects were funded under Round 1 in these countries.</p>',
'image_folder' => null,
'projects' => [],
],
Expand Down
16 changes: 13 additions & 3 deletions resources/views/static/grassroots-grants.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,26 @@ class="absolute top-0 right-0 w-full md:w-[60vw] h-[50%] md:h-full object-cover
@forelse(($page?->activeHubs ?? collect()) as $hub)
<div class="bg-transparent border-b-2 border-solid border-[#A4B8D9]">
<div class="text-[#20262C] font-semibold text-lg py-4 cursor-pointer flex items-center justify-between duration-300 accordion-item-header">
<p>{{ $hub->title }}</p>
<p>
{{ $hub->title }}
@if($hub->isStatusOnly() && ($statusLabel = $hub->statusLabel()))
<span class="block text-base font-normal text-[#333E48] mt-1">
<strong>Status:</strong> {{ $statusLabel }}
</span>
@endif
</p>
<button class="flex justify-center items-center rounded-full duration-300 bg-yellow hover:bg-primary min-w-12 min-h-12">
<img class="duration-300" src="/images/digital-girls/arrow.svg" alt="" />
</button>
</div>
<div class="overflow-hidden max-h-0 transition-all duration-300">
<div class="pb-6 pt-2 text-[#333E48] text-lg md:text-xl font-normal grants-content">
@if($hub->isStatusOnly())
@if($hub->status_message)
{!! $hub->status_message !!}
@if($statusLabel = $hub->statusLabel())
<p class="mb-4"><strong>Status:</strong> {{ $statusLabel }}</p>
@endif
@if($statusBody = $hub->statusBodyHtml())
<div>{!! $statusBody !!}</div>
@endif
@else
<div class="mb-4">
Expand Down
Loading