Skip to content

Commit bbd3945

Browse files
authored
Merge pull request #3564 from codeeu/dev
Status label is now shown from hub_status
2 parents 93723d1 + 02082a8 commit bbd3945

4 files changed

Lines changed: 87 additions & 7 deletions

File tree

app/GrassrootsGrantsHub.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,29 @@ public function isStatusOnly(): bool
6565
{
6666
return in_array($this->hub_status, ['not_launched', 'cancelled'], true);
6767
}
68+
69+
public function statusLabel(): ?string
70+
{
71+
return match ($this->hub_status) {
72+
'not_launched' => 'Call not launched',
73+
'cancelled' => 'Cancelled due to low number of applications',
74+
default => null,
75+
};
76+
}
77+
78+
public function statusBodyHtml(): string
79+
{
80+
$message = trim(strip_tags((string) ($this->status_message ?? ''), '<p><br><strong><em><a><ul><ol><li>'));
81+
if ($message !== '') {
82+
if (str_contains((string) $this->status_message, '<')) {
83+
return (string) $this->status_message;
84+
}
85+
86+
return '<p>'.e($message).'</p>';
87+
}
88+
89+
$overview = trim((string) ($this->overview ?? ''));
90+
91+
return $overview;
92+
}
6893
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Support\Facades\DB;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
public function up(): void
10+
{
11+
if (! Schema::hasTable('grassroots_grants_hubs')) {
12+
return;
13+
}
14+
15+
$updates = [
16+
'Poland – KPI' => [
17+
'hub_status' => 'not_launched',
18+
'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>',
19+
],
20+
'Malta – eSkills Malta' => [
21+
'hub_status' => 'cancelled',
22+
'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>',
23+
],
24+
'Ireland – Microsoft' => [
25+
'hub_status' => 'not_launched',
26+
'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>',
27+
],
28+
'Denmark, Finland, Iceland, Norway & Sweden – ECWT' => [
29+
'hub_status' => 'not_launched',
30+
'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>',
31+
],
32+
];
33+
34+
foreach ($updates as $title => $data) {
35+
DB::table('grassroots_grants_hubs')
36+
->where('title', $title)
37+
->update(array_merge($data, ['updated_at' => now()]));
38+
}
39+
}
40+
41+
public function down(): void
42+
{
43+
// No rollback needed for content corrections.
44+
}
45+
};

database/seeders/data/grassroots_grants_round1.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@
507507
'activities_on_platform' => null,
508508
'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>',
509509
'underserved_focus' => null,
510-
'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.',
510+
'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>',
511511
'image_folder' => null,
512512
'projects' => [],
513513
],
@@ -520,7 +520,7 @@
520520
'activities_on_platform' => null,
521521
'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>',
522522
'underserved_focus' => null,
523-
'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.',
523+
'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>',
524524
'image_folder' => null,
525525
'projects' => [],
526526
],
@@ -533,7 +533,7 @@
533533
'activities_on_platform' => null,
534534
'overview' => '<p>The small grants call was not launched in Ireland during the implementation period. Therefore, no projects were funded under Round 1.</p>',
535535
'underserved_focus' => null,
536-
'status_message' => 'The small grants call was not launched in Ireland during the implementation period. Therefore, no projects were funded under Round 1.',
536+
'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>',
537537
'image_folder' => null,
538538
'projects' => [],
539539
],
@@ -1029,7 +1029,7 @@
10291029
'activities_on_platform' => null,
10301030
'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>',
10311031
'underserved_focus' => null,
1032-
'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.',
1032+
'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>',
10331033
'image_folder' => null,
10341034
'projects' => [],
10351035
],

resources/views/static/grassroots-grants.blade.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,26 @@ class="absolute top-0 right-0 w-full md:w-[60vw] h-[50%] md:h-full object-cover
130130
@forelse(($page?->activeHubs ?? collect()) as $hub)
131131
<div class="bg-transparent border-b-2 border-solid border-[#A4B8D9]">
132132
<div class="text-[#20262C] font-semibold text-lg py-4 cursor-pointer flex items-center justify-between duration-300 accordion-item-header">
133-
<p>{{ $hub->title }}</p>
133+
<p>
134+
{{ $hub->title }}
135+
@if($hub->isStatusOnly() && ($statusLabel = $hub->statusLabel()))
136+
<span class="block text-base font-normal text-[#333E48] mt-1">
137+
<strong>Status:</strong> {{ $statusLabel }}
138+
</span>
139+
@endif
140+
</p>
134141
<button class="flex justify-center items-center rounded-full duration-300 bg-yellow hover:bg-primary min-w-12 min-h-12">
135142
<img class="duration-300" src="/images/digital-girls/arrow.svg" alt="" />
136143
</button>
137144
</div>
138145
<div class="overflow-hidden max-h-0 transition-all duration-300">
139146
<div class="pb-6 pt-2 text-[#333E48] text-lg md:text-xl font-normal grants-content">
140147
@if($hub->isStatusOnly())
141-
@if($hub->status_message)
142-
{!! $hub->status_message !!}
148+
@if($statusLabel = $hub->statusLabel())
149+
<p class="mb-4"><strong>Status:</strong> {{ $statusLabel }}</p>
150+
@endif
151+
@if($statusBody = $hub->statusBodyHtml())
152+
<div>{!! $statusBody !!}</div>
143153
@endif
144154
@else
145155
<div class="mb-4">

0 commit comments

Comments
 (0)