diff options
| author | Zach DeCook <zachdecook@gmail.com> | 2018-12-27 21:33:47 -0500 |
|---|---|---|
| committer | Zach DeCook <zachdecook@gmail.com> | 2018-12-27 21:33:47 -0500 |
| commit | c0953948d7008100ab4fcb4c5df6076ed7e69e3c (patch) | |
| tree | 26d3cbbc2386c7adb324cb6b9988de1f8a532f1c /laravel/resources/views | |
| parent | ed8d234975e3df79ab60cdc990f42856e5811d3f (diff) | |
| download | prosongsa-c0953948d7008100ab4fcb4c5df6076ed7e69e3c.tar.gz | |
* Routes: Create edit route
Diffstat (limited to 'laravel/resources/views')
| -rw-r--r-- | laravel/resources/views/editsong.blade.php | 17 | ||||
| -rw-r--r-- | laravel/resources/views/playlist.blade.php | 2 | ||||
| -rw-r--r-- | laravel/resources/views/song.blade.php | 6 | ||||
| -rw-r--r-- | laravel/resources/views/welcome.blade.php | 2 |
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 |
