]> _ Git - songbook.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Sun, 11 Sep 2022 18:26:26 +0000 (20:26 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Sun, 11 Sep 2022 18:26:26 +0000 (20:26 +0200)
app/Models/Song.php
resources/css/app.sass
resources/js/mmenu.js
resources/views/menu.blade.php
resources/views/song.blade.php

index 17595c1a041d7017822881e251e5331f38b4b1bf..bffb0c47ef1192cf3a7074fe0bb8a747818887be 100644 (file)
@@ -112,6 +112,16 @@ class Song extends CubistMagicAbstractModel
         return false;
     }
 
+    public function hasSimpleChords()
+    {
+        foreach ($this->lyrics as $part) {
+            if ($this->getChordsData($part['part_chords_simple'])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     public static function parseChord($c)
     {
         if (!$c) {
index 47d9829c26cb52c2b50b94ff66fad71f7d18a3e2..7de1fece3cfbc2f7ab4f913005db744bf0919506 100644 (file)
@@ -112,7 +112,6 @@ main
 article.song
     font-size: 16px
 
-
     section
         position: relative
 
@@ -122,7 +121,10 @@ article.song
 
     &.chords
         .chords
-            display: block
+            display: none
+
+            &.visible
+                display: block
 
     &.chords.lyrics
         section
@@ -130,11 +132,15 @@ article.song
             @media (min-width: 800px)
                 .chords
                     width: 360px
+                    display: none
+
+                    &.visible
+                        display: inline-block
                 .lyrics
                     width: calc(90% - 360px)
+                    display: inline-block
                 .chords, .lyrics
                     margin-top: 0
-                    display: inline-block
                     vertical-align: top
 
 
index 585b7398021475dd21b9a84fbeb70e974bcfdbdb..13d3a41fb260a224d2ecc85a66226d679884df71 100644 (file)
@@ -59,6 +59,14 @@ function updateSongView() {
         s.removeClass('chords');
     }
 
+    if (getOption('show_simplechords') === '1') {
+        s.find('.chords.simple').addClass('visible');
+        s.find('.chords:not(.simple)').removeClass('visible');
+    } else {
+        s.find('.chords.simple').removeClass('visible');
+        s.find('.chords:not(.simple)').addClass('visible');
+    }
+
     var toneOffset = parseInt(getOption('tone'));
 
     $(s).each(function () {
index 18d88a6ed90d3fa557aa7993b6be214f1bc18388..1abcbe1f2a886f6ec1b5669704d123b4169f55aa 100644 (file)
                     <li><a href="#" class="noaction">🎼 Show chords <input type="checkbox" class="checkbox-switch"
                                                                           name="show_chords_{{$song->id}}"
                                                                           data-default="1"></a></li>
+                    @if($song->hasSimpleChords())
+                        <li><a href="#" class="noaction">🐣 Show simple chords <input type="checkbox"
+                                                                                     class="checkbox-switch"
+                                                                                     name="show_simplechords_{{$song->id}}"
+                                                                                     data-default="0"></a></li>
+                    @endif
                     <li><a href="#" class="clickselect">↕️ Key <select data-name="tone" name="tone_{{$song->id}}">
                                 @for($i=-5;$i<=6;$i++)
                                     <option value="{{$i}}"
index 054978d85ece1d61e15f0073f529bb7937b5f8ed..8096321e637baaf5645ff33127640629ee645420 100644 (file)
@@ -1,5 +1,6 @@
 @php
     $audioTracks=$song->getAudioTracks();
+    $simple=$song->hasSimpleChords();
 @endphp
 
 @extends('layout')
                 if($c){
                   $chords=json_encode($c);
                 }
+                $sc=$song->getChordsData($part['part_chords_simple']);
+                if($sc){
+                    $simple_chords=json_encode($sc);
+                }
                 $lyrics=nl2br($part['part_lyrics']);
                 $lyrics=preg_replace('/(\<br \/\>\s*){2,}/','<div class="br2"></div>',$lyrics);
             @endphp
                 @if(isset($chords))
                     <div class="chords" data-chords="{{$chords}}"></div>
                 @endif
+                @if(isset($simple_chords))
+                    <div class="chords simple" data-chords="{{$simple_chords}}"></div>
+                @elseif($simple)
+                    <div class="chords simple" data-chords="{{$chords}}"></div>
+                @endif
             </section>
         @endforeach
         <div class="credits">{{$song->credits}}</div>