From 4cffc56aef98d44fb5cb12ec5e5ffae7207b843c Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Tue, 29 Jan 2019 18:53:08 -0500 Subject: * Editing: Go back to same key you came from (Also show key in song name) --- laravel/app/Http/Controllers/SongController.php | 6 +++++- laravel/app/Song.php | 4 +++- laravel/resources/views/editsong.blade.php | 1 + laravel/resources/views/song.blade.php | 6 +++++- 4 files changed, 14 insertions(+), 3 deletions(-) (limited to 'laravel') diff --git a/laravel/app/Http/Controllers/SongController.php b/laravel/app/Http/Controllers/SongController.php index a18de7a..669ec3e 100644 --- a/laravel/app/Http/Controllers/SongController.php +++ b/laravel/app/Http/Controllers/SongController.php @@ -238,6 +238,10 @@ class SongController extends Controller $song->text = $_POST['text'];//request->text strips whitespace. $song->verse = $request->verse; $song->save(); - return redirect()->route( 'song.show', ['song' => $song, 'playlist' => $request->playlistReturn ] ); + return redirect()->route( 'song.show', [ + 'song' => $song, + 'playlist' => $request->playlistReturn, + 'key' => $request->keyReturn, + ] ); } } diff --git a/laravel/app/Song.php b/laravel/app/Song.php index 58e2317..a71e997 100644 --- a/laravel/app/Song.php +++ b/laravel/app/Song.php @@ -13,7 +13,9 @@ class Song extends Model } public function getNameAttribute() { - return $this->title . ( $this->author ? " ($this->author)" : "" ); + return $this->title + . ( $this->author ? " ($this->author)" : "" ) + . ($this->plain_key ? " ($this->plain_key)" : ""); } public function getPlainKeyAttribute() { diff --git a/laravel/resources/views/editsong.blade.php b/laravel/resources/views/editsong.blade.php index 8bc7d22..267f04a 100644 --- a/laravel/resources/views/editsong.blade.php +++ b/laravel/resources/views/editsong.blade.php @@ -5,6 +5,7 @@
+ @csrf diff --git a/laravel/resources/views/song.blade.php b/laravel/resources/views/song.blade.php index 6fed78b..9170144 100644 --- a/laravel/resources/views/song.blade.php +++ b/laravel/resources/views/song.blade.php @@ -35,7 +35,11 @@ Scripture: {{$song->verse}}
@endif @can('update', $song ) - $song, 'playlist' => $playlist ?? ''] ) }}'>edit this song + $song, + 'playlist' => $playlist ?? '', + 'key' => $key, + ] ) }}'>edit this song @endcan -- cgit 1.4.1