From 47208936ee3c18745bbd9a753a9cc566648a5e17 Mon Sep 17 00:00:00 2001 From: Zach DeCook Date: Fri, 28 Dec 2018 14:59:54 -0500 Subject: * Links: Make them better show song name instead of title --- laravel/app/Song.php | 4 ++++ laravel/public/css/song.css | 15 +++++++++++++++ laravel/resources/views/song.blade.php | 18 +++++++++++++----- laravel/resources/views/welcome.blade.php | 2 +- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 laravel/public/css/song.css (limited to 'laravel') diff --git a/laravel/app/Song.php b/laravel/app/Song.php index 0565ff6..ceaae21 100644 --- a/laravel/app/Song.php +++ b/laravel/app/Song.php @@ -11,4 +11,8 @@ class Song extends Model { return $this->belongsToMany('App\Playlist'); } + public function getNameAttribute() + { + return $this->title . ( $this->author ? " ($this->author)" : "" ); + } } diff --git a/laravel/public/css/song.css b/laravel/public/css/song.css new file mode 100644 index 0000000..8465822 --- /dev/null +++ b/laravel/public/css/song.css @@ -0,0 +1,15 @@ +div.controlArea{ + display: flex; + justify-content: space-between; +} +a.back, a.home, a.next{ + border: 2px solid var(--gray); + color: var(--dark); + padding: 3px; + margin: 3px; + text-decoration: none; +} +a.back:hover, a.home:hover, a.next:hover{ + color: var(--light); + background-color: var(--secondary); +} diff --git a/laravel/resources/views/song.blade.php b/laravel/resources/views/song.blade.php index 412e53d..6c34871 100644 --- a/laravel/resources/views/song.blade.php +++ b/laravel/resources/views/song.blade.php @@ -3,19 +3,28 @@ @section('content') + +
@if( isset( $back ) ) - $back])}}'>{{$back->title}} + $back, 'playlist' => $playlist ?? ''])}}'> + {{$back->name}} + @endif @if( $playlist ?? FALSE) - $playlist->name])}}'> + $playlist->name])}}'> Back to {{$playlist->name}} @else - Go home + + Go home + @endif @if( isset( $next ) ) - $next])}}'>{{$next->title}} + @endif +

{{$song['title']}}

{{$song->author}}

@@ -37,7 +46,6 @@ for ($i=-6; $i < 12; $i++) { if (($transp + 24)%12 == $i) $selected = 'selected'; else $selected = ''; - //$dir = ($i >= 0 ? "up" : "down" ); $dir = "transpose"; echo ""; } diff --git a/laravel/resources/views/welcome.blade.php b/laravel/resources/views/welcome.blade.php index 3f95380..b8b2627 100644 --- a/laravel/resources/views/welcome.blade.php +++ b/laravel/resources/views/welcome.blade.php @@ -10,7 +10,7 @@ @foreach( App\Song::all() as $song )
  • $song]) }}'> - {{ $song['title'] }} + {{ $song->name }} @endforeach -- cgit 1.4.1