Backend for songs.zachdecook.com
* Songs: Fix spacing for newly created songs
Zach DeCook 2018-12-27
parent e31c45a · commit ed8d234
-rw-r--r--laravel/app/Http/Controllers/SongController.php2
-rw-r--r--laravel/resources/views/playlist.blade.php2
-rw-r--r--laravel/resources/views/song.blade.php4
3 files changed, 3 insertions, 5 deletions
diff --git a/laravel/app/Http/Controllers/SongController.php b/laravel/app/Http/Controllers/SongController.php
index 00216ce..8d6c497 100644
--- a/laravel/app/Http/Controllers/SongController.php
+++ b/laravel/app/Http/Controllers/SongController.php
@@ -16,7 +16,7 @@ class SongController extends Controller
$newText = '';
$transp = $_GET['transp'] ?? 0;
foreach( $lines as $line ){
- $line = htmlspecialchars( $line );
+ $line = trim(htmlspecialchars( $line ), "\n\t\r");
if ( $this->chordline( $line ) ) {
if ( $transp != 0) {
$line = $this->z_transpose2( $line, $transp );
diff --git a/laravel/resources/views/playlist.blade.php b/laravel/resources/views/playlist.blade.php
index 856c81c..0793176 100644
--- a/laravel/resources/views/playlist.blade.php
+++ b/laravel/resources/views/playlist.blade.php
@@ -18,7 +18,7 @@
<input name='key' placeholder='Key (e.g. Am)' type='text' />
<input name='playlist' value='{{ $playlist->id }}' hidden/>
<br/>
- <textarea name='text' placeholder='song lyrics/chords' style='width: 100%; height: 200px;' ></textarea>
+ <textarea name='text' placeholder='song lyrics/chords' style='width: 100%; height: 200px; font-family: monospace;' ></textarea>
<button type='submit'>Add song!</button>
</form>
@endsection
diff --git a/laravel/resources/views/song.blade.php b/laravel/resources/views/song.blade.php
index 6405b8a..7029871 100644
--- a/laravel/resources/views/song.blade.php
+++ b/laravel/resources/views/song.blade.php
@@ -29,9 +29,7 @@
</noscript>
</form>
- <pre>
- {!! $song['escapedText'] !!}
- </pre>
+ <pre>{!! $song['escapedText'] !!}</pre>
<div id="chordarea">
<canvas id='guitarregion' width="100" height="100" onclick="cycle(guitarObj);"></canvas>
<canvas id='ukuleleregion' width="100" height="100" onclick="cycle(ukeObj);"></canvas>