From d99588ac37284194202a677ea9cc2a2ccb5846a1 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Fri, 12 Feb 2021 00:44:51 +0000 Subject: homepage: add server-side sorting --- laravel/public/index.gmi | 11 +++++++++-- laravel/resources/views/welcome.blade.php | 12 +++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/laravel/public/index.gmi b/laravel/public/index.gmi index 89db27b..492ed92 100755 --- a/laravel/public/index.gmi +++ b/laravel/public/index.gmi @@ -9,8 +9,15 @@ $kernel = $app->make(Illuminate\Contracts\Http\Kernel::class); use App\Song; printf("20 text/gemini\r\n"); ?> -pluck('title','id') as $id => $title): ?> -=> /song.gmi.php/ +# Prosongsa Songs + + +=> /? Sort by + + + +sortBy(getenv('QUERY_STRING')??'title')->pluck('title','id') as $id => $title): ?> +=> /song.gmi.php/ diff --git a/laravel/resources/views/welcome.blade.php b/laravel/resources/views/welcome.blade.php index cc0e5d3..27167fe 100644 --- a/laravel/resources/views/welcome.blade.php +++ b/laravel/resources/views/welcome.blade.php @@ -8,8 +8,18 @@
+ Sort by: + @foreach(['id','title','author'] as $key) + + @if(($_GET['sort'] ??'title') ==$key) + {{$key}} + @else + {{$key}} + @endif + + @endforeach