Skip to content

Commit 2c3d99d

Browse files
committed
Reverting dev content to version bf6ab33 to test
1 parent dd5cccf commit 2c3d99d

40 files changed

+208
-225
lines changed

app/Console/Commands/excel/CoderDojoEvents.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function handle(): void
4242

4343
Excel::import(
4444
new CoderDojoEventsImport(),
45-
'events.xlsx',
45+
'events-coderdojobelgium.xlsx',
4646
'excel'
4747
);
4848
}

app/Event.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,6 @@ class Event extends Model
7676

7777
//protected $appends = ['LatestModeration'];
7878

79-
public function getUrlAttribute() {
80-
return route('view_event', [
81-
'event' => $this->id,
82-
'slug' => $this->slug
83-
]);
84-
}
85-
8679
public function getJavascriptData()
8780
{
8881
return $this->only(['geoposition', 'title', 'description']);

app/Http/Controllers/PodcastsController.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public function index(Request $request): View
1919

2020
public function show(Podcast $podcast): View
2121
{
22+
2223
return view('podcast', compact('podcast'));
2324
}
2425

Lines changed: 118 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,127 @@
1-
<?php
1+
<?php
22

33
namespace App\Http\Controllers;
44

5+
use App\Country;
6+
use App\Event;
7+
use App\Filters\EventFilters;
8+
use App\Http\Transformers\EventTransformer;
9+
use Carbon\Carbon;
510
use Illuminate\Http\Request;
11+
use Illuminate\Support\Arr;
12+
use Illuminate\Support\Facades\Cache;
13+
use Illuminate\Support\Facades\Log;
14+
use Illuminate\View\View;
615

716
class SearchController extends Controller
817
{
9-
public function index()
18+
protected $eventTransformer;
19+
20+
/**
21+
* EventController constructor.
22+
*/
23+
public function __construct(EventTransformer $eventTransformer)
24+
{
25+
$this->eventTransformer = $eventTransformer;
26+
}
27+
28+
public function search(Request $request): View
29+
{
30+
31+
$query = $request->input('q', '');
32+
$selected_year = $request->input('year', Carbon::now()->year);
33+
34+
$country_iso = $request->input('country_iso', null);
35+
$tag = $request->input('tag', '');
36+
37+
$selected_country = [];
38+
39+
if (! is_null($country_iso)) {
40+
$country = Country::where('iso', $country_iso)->first();
41+
if ($country) {
42+
$country->translation = __('countries.'.$country->name);
43+
$selected_country[] = $country;
44+
}
45+
46+
}
47+
48+
$current_year = Carbon::now()->year;
49+
$years = [];
50+
for ($year = $current_year; $year >= 2014; $year--) {
51+
$years[] = $year;
52+
}
53+
54+
return view('event.search', compact(['query', 'years', 'selected_country', 'selected_year', 'tag']));
55+
}
56+
57+
public function searchPOST(EventFilters $filters, Request $request)
58+
{
59+
$events = $this->getEvents($filters);
60+
61+
//Log::info($request->input('page'));
62+
if ($request->input('page')) {
63+
$result = [$events];
64+
} else {
65+
Log::info('no page');
66+
$eventsMap = $this->getAllEventsToMap($filters);
67+
$result = [$events, $eventsMap];
68+
}
69+
70+
return $result;
71+
}
72+
73+
protected function getEvents(EventFilters $filters)
1074
{
11-
return view('static.search');
75+
76+
$events = Event::where('status', 'like', 'APPROVED')
77+
->filter($filters)
78+
->orderBy('start_date')
79+
->get()
80+
->groupBy(function ($event) {
81+
if ($event->start_date <= Carbon::today()) {
82+
return 'past';
83+
}
84+
85+
return 'future';
86+
});
87+
88+
if (is_null($events->get('future')) || is_null($events->get('past'))) {
89+
return $events->flatten()->paginate(12);
90+
}
91+
92+
return $events->get('future')->merge($events->get('past'))->paginate(12);
93+
94+
}
95+
96+
protected function getAllEventsToMap(EventFilters $filters)
97+
{
98+
99+
$flattened = Arr::flatten($filters->getFilters());
100+
101+
$composed_key = '';
102+
103+
foreach ($flattened as $value) {
104+
$composed_key .= $value.',';
105+
}
106+
107+
$value = Cache::get($composed_key, function () use ($composed_key, $filters) {
108+
Log::info("Building cache [{$composed_key}]");
109+
$events = Event::where('status', 'like', 'APPROVED')
110+
->filter($filters)
111+
->get();
112+
113+
$events = $this->eventTransformer->transformCollection($events);
114+
115+
$events = $events->groupBy('country');
116+
117+
Cache::put($composed_key, $events, 5 * 60);
118+
119+
return $events;
120+
});
121+
122+
Log::info("Serving from cache [{$composed_key}]");
123+
124+
return $value;
125+
12126
}
13-
}
127+
}

app/Imports/IrelandDreamSpaceImport.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function model(array $row): ?Model
4242
'description' => '',
4343
'organizer_type' => $row['type_of_organization'],
4444
'activity_type' => $row['activity_type'],
45-
'location' => $row['address'],
45+
'location' => '',
4646
'event_url' => '',
4747
'contact_person' => $row['email'],
4848
'user_email' => '',
@@ -55,9 +55,9 @@ public function model(array $row): ?Model
5555
'codeweek_for_all_participation_code' => '',
5656
'start_date' => $this->parseDate($row['date']),
5757
'end_date' => $this->parseDate($row['date']),
58-
'geoposition' => $row['latitude'].','.$row['longitude'],
59-
'longitude' => $row['latitude'],
60-
'latitude' => $row['latitude'],
58+
'geoposition' => '',
59+
'longitude' => '',
60+
'latitude' => '',
6161
'language' => '',
6262
'approved_by' => 19588,
6363
'mass_added_for' => 'Excel',

app/Livewire/PartnerFilterComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function selectFilter($filter)
1818

1919
public function render()
2020
{
21-
return view('livewire.filter-component', [
21+
return view('livewire.partner-filter-component', [
2222
'filters' => ['Partners', 'Council Presidency', 'EU Code Week Supporters'] // Available filters
2323
]);
2424
}

app/Podcast.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ class Podcast extends Model implements Feedable
1313
//
1414
protected $guarded = [];
1515

16-
public function getUrlAttribute() {
17-
return route('podcast', ['podcast' => $this->id]);
18-
}
19-
2016
protected function casts(): array
2117
{
2218
return [

app/Providers/AppServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
use App\Event;
66
use App\Observers\EventObserver;
77
use Carbon\Carbon;
8+
use Illuminate\Database\Eloquent\Model;
89
use Illuminate\Pagination\LengthAwarePaginator;
910
use Illuminate\Support\Collection;
1011
use Illuminate\Support\Facades\Gate;
1112
use Illuminate\Support\Facades\View;
1213
use Illuminate\Support\ServiceProvider;
1314
use Illuminate\Validation\Rules\Password;
1415
use Illuminate\Support\Facades\Blade;
16+
use Livewire\Livewire;
1517

1618
class AppServiceProvider extends ServiceProvider
1719
{

config/codeweek.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@
1212
'MAP_TILES' => env('MAP_TILES', ''),
1313
'EEDUCATION_CLIENTID' => env('EEDUCATION_CLIENTID', null),
1414
'LOCALES' => env('LOCALES', null),
15-
'blog_url' => env('BLOG_URL', 'https://codeweek.eu/blog'),
15+
1616
];

public/css/fonts.css

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -60,67 +60,3 @@
6060
src: URL('/fonts/OCR A Std Regular.ttf') format('truetype');
6161
}
6262

63-
/* Blinker */
64-
@font-face {
65-
font-family: 'Blinker';
66-
src: URL('/fonts/blinker/Blinker-Light.ttf') format('truetype');
67-
font-weight: 300;
68-
font-style: normal;
69-
}
70-
71-
@font-face {
72-
font-family: 'Blinker';
73-
src: URL('/fonts/blinker/Blinker-Regular.ttf') format('truetype');
74-
font-weight: 400;
75-
font-style: normal;
76-
}
77-
78-
@font-face {
79-
font-family: 'Blinker';
80-
src: URL('/fonts/blinker/Blinker-SemiBold.ttf') format('truetype');
81-
font-weight: 600;
82-
font-style: normal;
83-
}
84-
85-
@font-face {
86-
font-family: 'Blinker';
87-
src: URL('/fonts/blinker/Blinker-Bold.ttf') format('truetype');
88-
font-weight: 700;
89-
font-style: normal;
90-
}
91-
92-
/* Montserrat */
93-
@font-face {
94-
font-family: 'Montserrat';
95-
src: URL('/fonts/montserrat/Montserrat-Light.ttf') format('truetype');
96-
font-weight: 300;
97-
font-style: normal;
98-
}
99-
100-
@font-face {
101-
font-family: 'Montserrat';
102-
src: URL('/fonts/montserrat/Montserrat-Regular.ttf') format('truetype');
103-
font-weight: 400;
104-
font-style: normal;
105-
}
106-
107-
@font-face {
108-
font-family: 'Montserrat';
109-
src: URL('/fonts/montserrat/Montserrat-Medium.ttf') format('truetype');
110-
font-weight: 500;
111-
font-style: normal;
112-
}
113-
114-
@font-face {
115-
font-family: 'Montserrat';
116-
src: URL('/fonts/montserrat/Montserrat-SemiBold.ttf') format('truetype');
117-
font-weight: 600;
118-
font-style: normal;
119-
}
120-
121-
@font-face {
122-
font-family: 'Montserrat';
123-
src: URL('/fonts/montserrat/Montserrat-Bold.ttf') format('truetype');
124-
font-weight: 700;
125-
font-style: normal;
126-
}

0 commit comments

Comments
 (0)