Skip to content

Commit

Permalink
Merge dev into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tdiam committed Mar 22, 2018
2 parents 1deaa61 + 6a7c107 commit 9f667ed
Show file tree
Hide file tree
Showing 20 changed files with 53,956 additions and 69 deletions.
59 changes: 59 additions & 0 deletions app/Http/Controllers/CurrentEventController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use LaravelLocalization;
use App\Schedule;

class CurrentEventController extends Controller {

private $now;

private function getCurr($events) {
$coll = $events -> where('hour', '<=', $this->now);
$last = $coll -> pop();
$prevToLast = $coll -> last();
# if there are many events happening at the exact same time, choose the one that is not a general event
while(!is_null($last) && $coll -> isNotEmpty() && $last -> hour == $prevToLast -> hour) {
if($last -> type != "general" && $prevToLast -> type == "general") {
$coll -> pop();
$coll -> push($last);
}
$last = $coll -> pop();
$prevToLast = $coll -> last();
}
return $last;
}

private function getNext($events) {
$next = $events -> where('hour', '>', $this->now) -> whereIn('type', ['talk', 'performance']) -> first();
return $next;
}

public function __construct() {
$this->now = date('H:i');
}

public function index(Request $request) {

if(env('SHOW_HIDDEN_ENTRIES', false) == true) {
$where = [];
} else {
$where = [['visible', true]];
}

if(date('Y-m-d') == '2018-03-24') {
$events = Schedule :: where(array_merge($where, [['type', '!=', 'workshop']]))
-> orderBy('hour', 'asc')
-> get();
} else {
$events = collect([]);
}

$curr = $this->getCurr($events);
$next = $this->getNext($events);
return view('api/currentEvent', compact('curr', 'next'));

}

}
6 changes: 4 additions & 2 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ public function index(Request $request) {
}

$speakers = $query->get()->sortByAppearance();
$now = date("Y-m-d H:i");
$isToday = $request->testLive == "yes" || ($now >= "2018-03-24 10:30" && $now <= "2018-03-24 21:00");

$isPjax = $request->header('X-PJAX');
if ($isPjax) {
return response()->view('home', compact('isPjax', 'speakers'), 200)
return response()->view('home', compact('isPjax', 'isToday', 'speakers'), 200)
->header('X-PJAX-URL', LaravelLocalization::getLocalizedURL());
}
return view('home', compact('speakers'));
return view('home', compact('speakers', 'isToday'));
}

}
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
|
*/

'timezone' => 'UTC',
'timezone' => 'Europe/Athens',

/*
|--------------------------------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions database/seeds/GeneralEventsSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,25 @@ public function run() {
],
]),

App\Schedule::updateOrCreate(['sid' => 'early-drinks'], [
'hour' => '20:00',
'visible' => true,
'img_src' => '/images/schedule/drinks.jpg',
'type' => 'general',
'event_title' => [
'en' => 'Early drinks',
'el' => 'Early drinks'
],
'event_prev' => [
'en' => '',
'el' => ''
],
'subtitle' => [
'en' => '',
'el' => ''
],
]),

App\Schedule::updateOrCreate(['sid' => 'after-party'], [
'hour' => '21:30',
'visible' => true,
Expand Down
15,204 changes: 15,196 additions & 8 deletions public/css/app.css

Large diffs are not rendered by default.

Binary file added public/images/schedule/drinks.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/images/sponsors/large/large_athens-legal-firm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/images/sponsors/raw/athens-legal-firm.png
Binary file not shown.
Binary file modified public/images/sponsors/small/small_athens-legal-firm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38,071 changes: 38,070 additions & 1 deletion public/js/app.js

Large diffs are not rendered by default.

Loading

0 comments on commit 9f667ed

Please sign in to comment.