From: Vincent Vanwaelscappel Date: Sun, 11 Sep 2022 18:26:26 +0000 (+0200) Subject: . X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=018587441a7cf98d61c91074a72077a6560c4d1e;p=songbook.git . --- diff --git a/app/Models/Song.php b/app/Models/Song.php index 17595c1..bffb0c4 100644 --- a/app/Models/Song.php +++ b/app/Models/Song.php @@ -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) { diff --git a/resources/css/app.sass b/resources/css/app.sass index 47d9829..7de1fec 100644 --- a/resources/css/app.sass +++ b/resources/css/app.sass @@ -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 diff --git a/resources/js/mmenu.js b/resources/js/mmenu.js index 585b739..13d3a41 100644 --- a/resources/js/mmenu.js +++ b/resources/js/mmenu.js @@ -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 () { diff --git a/resources/views/menu.blade.php b/resources/views/menu.blade.php index 18d88a6..1abcbe1 100644 --- a/resources/views/menu.blade.php +++ b/resources/views/menu.blade.php @@ -39,6 +39,12 @@
  • 🎼 Show chords
  • + @if($song->hasSimpleChords()) +
  • 🐣 Show simple chords
  • + @endif
  • ↕️ Key