From 2ed1e39b84a10656f5f876d07d588355f3e1717c Mon Sep 17 00:00:00 2001 From: Yannick Date: Tue, 1 Dec 2020 22:55:08 +0100 Subject: [PATCH] #87 #88 Dynamically generate platform channel forms --- app/Channel.php | 4 ++ .../Controllers/admin/FlightController.php | 4 +- .../Controllers/admin/MilestoneController.php | 1 + app/Release.php | 2 - resources/views/core/flights/index.blade.php | 70 ++++--------------- 5 files changed, 21 insertions(+), 60 deletions(-) diff --git a/app/Channel.php b/app/Channel.php index e095821..2f44eda 100644 --- a/app/Channel.php +++ b/app/Channel.php @@ -21,6 +21,10 @@ public function getBgColorAttribute() { return 'background-color: '.$this->color; } + public function getTextColorAttribute() { + return 'color: '.$this->color; + } + public function getRouteKeyName() { return 'slug'; } diff --git a/app/Http/Controllers/admin/FlightController.php b/app/Http/Controllers/admin/FlightController.php index d36dc1e..3e4b249 100644 --- a/app/Http/Controllers/admin/FlightController.php +++ b/app/Http/Controllers/admin/FlightController.php @@ -5,6 +5,7 @@ use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Release; +use App\Platform; use App\Milestone; use Twitter; @@ -17,12 +18,13 @@ class FlightController extends Controller */ public function index() { $releases = Release::orderBy('date', 'desc')->orderBy('build', 'desc')->orderBy('delta', 'desc')->orderBy('ring', 'desc')->paginate(100); + $platforms = Platform::where('active', 1)->get(); foreach ($releases as $release) { $timeline[$release->date->format('j F Y')][$release->build][$release->delta][$release->platform][$release->ring] = $release; } - return view('core.flights.index', compact('releases', 'timeline')); + return view('core.flights.index', compact('releases', 'platforms', 'timeline')); } /** diff --git a/app/Http/Controllers/admin/MilestoneController.php b/app/Http/Controllers/admin/MilestoneController.php index 054bdd3..00dccfb 100644 --- a/app/Http/Controllers/admin/MilestoneController.php +++ b/app/Http/Controllers/admin/MilestoneController.php @@ -50,6 +50,7 @@ public function store(Request $request) { */ public function edit(Milestone $milestone) { $this->authorize('edit_milestone'); + return view('core.milestones.edit', compact('milestone')); } diff --git a/app/Release.php b/app/Release.php index 2655973..7828f05 100644 --- a/app/Release.php +++ b/app/Release.php @@ -164,8 +164,6 @@ static function getMilestoneByString($string) { $milestone = Milestone::where('start_build', '<=', $build)->orderBy('start_build', 'desc')->first(); - dd($build, $delta, $milestone->id); - return $milestone->id; } diff --git a/resources/views/core/flights/index.blade.php b/resources/views/core/flights/index.blade.php index a499558..f8696db 100644 --- a/resources/views/core/flights/index.blade.php +++ b/resources/views/core/flights/index.blade.php @@ -47,63 +47,19 @@
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
-
- -
-
-
- -
-
-
- -
-
+ @foreach($platforms as $platform) +
+ + @foreach($platform->channelPlatforms as $channelPlatform) +
+ + +
+ @endforeach +
+ @endforeach @endcan