about summary refs log tree commit diff
path: root/laravel/resources
diff options
context:
space:
mode:
Diffstat (limited to 'laravel/resources')
-rw-r--r--laravel/resources/views/editsong.blade.php17
-rw-r--r--laravel/resources/views/playlist.blade.php2
-rw-r--r--laravel/resources/views/song.blade.php6
-rw-r--r--laravel/resources/views/welcome.blade.php2
4 files changed, 24 insertions, 3 deletions
diff --git a/laravel/resources/views/editsong.blade.php b/laravel/resources/views/editsong.blade.php
new file mode 100644
index 0000000..ae0060d
--- /dev/null
+++ b/laravel/resources/views/editsong.blade.php
@@ -0,0 +1,17 @@
+@extends('layouts.app')
+@section('title', "Editing $song[title]")
+
+@section('content')
+
+    <form method="POST" action="{{ route('song.show',['song'=>$song]) }}">
+        @csrf
+        <input name='title' placeholder='title' type='text' value='{{$song->title}}'/>
+        <input name='author' placeholder='author' type='text' value='{{$song->author}}'/>
+        <input name='key' placeholder='Key (e.g. Am)' type='text' value='{{$song->key}}'/>
+        <br/>
+        <textarea name='text' placeholder='song lyrics/chords'
+        style='width: 100%; height: 200px; font-family: monospace;' >{{$song->text}}</textarea>
+        <button type='submit'>Save!</button>
+    </form>
+
+@endsection
diff --git a/laravel/resources/views/playlist.blade.php b/laravel/resources/views/playlist.blade.php
index 0793176..7f6bed5 100644
--- a/laravel/resources/views/playlist.blade.php
+++ b/laravel/resources/views/playlist.blade.php
@@ -6,7 +6,7 @@
     <h2>Playlist "<i>{{$playlist->name}}</i>"</h2>
     <ul>
     @foreach($playlist->songs as $song)
-        <li><a href='/song/{{$song->number}}?playlist={{$playlist->id}}'>{{$song->title}}</a>
+        <li><a href='{{ route('song.show', ['song' => $song, 'playlist' => $playlist]) }}'>{{$song->title}}</a>
     @endforeach
     </ul>
 
diff --git a/laravel/resources/views/song.blade.php b/laravel/resources/views/song.blade.php
index 7029871..3d8cf2a 100644
--- a/laravel/resources/views/song.blade.php
+++ b/laravel/resources/views/song.blade.php
@@ -8,8 +8,12 @@
         Back to "<i>{{$playlist->name}}</i>" playlist
     </a>
     @endif
-
     <h2>{{$song['title']}}</h2>
+
+    @can('update', $song )
+        <a href='{{ route( 'song.edit', $song->number ) }}'>edit this song</a>
+    @endcan
+
     <form>
     <select name="transp" id="transp"
         value = "<?php echo $transp;?>"
diff --git a/laravel/resources/views/welcome.blade.php b/laravel/resources/views/welcome.blade.php
index 4e57621..3f95380 100644
--- a/laravel/resources/views/welcome.blade.php
+++ b/laravel/resources/views/welcome.blade.php
@@ -9,7 +9,7 @@
                 <ul>
                     @foreach( App\Song::all() as $song )
                         <li>
-                            <a href='{{ route('song.show', ['song' => $song['number']]) }}'>
+                            <a href='{{ route('song.show', ['song' => $song]) }}'>
                                 {{ $song['title'] }}
                             </a>
                     @endforeach