From 845fb7b47e781758480d9c58ffdca9e6aaf1c1db Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 4 Oct 2022 17:25:35 +0200 Subject: [PATCH] . --- app/Http/Controllers/FrontController.php | 47 ++++++++++++++++-------- resources/css/app.sass | 3 +- resources/js/mmenu.js | 1 + resources/views/menu.blade.php | 2 +- 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/FrontController.php b/app/Http/Controllers/FrontController.php index 6fee32f..b815951 100644 --- a/app/Http/Controllers/FrontController.php +++ b/app/Http/Controllers/FrontController.php @@ -67,22 +67,37 @@ class FrontController extends Controller return $p; } $lists = CollectionList::where('collection', $collection->id)->get(); - $partition = $song->getFirstMediaInField('partition'); - if ($partition) { - $partition = $partition->getUrl(); - } - $lyrics_doc = $song->getFirstMediaInField('lyrics_doc'); - - if ($lyrics_doc) { - $path = new \SplFileInfo($lyrics_doc->getPath()); - $html_path = $path->getPath() . '/html'; - $htmlFile = $html_path . '/' . $path->getBasename('.' . $path->getExtension()) . '.HTML'; - if (!file_exists($htmlFile)) { - $cmd = "export HOME=/tmp;/usr/bin/libreoffice --convert-to HTML:HTML --outdir $html_path --headless $path"; - `$cmd`; + $partition=false; + $lyrics_html=''; + + if($song->chorale) { + try { + $partition = $song->getFirstMediaInField('partition'); + if ($partition) { + $partition = $partition->getUrl(); + } + } catch (\Exception $e) { + + } + + + try { + $lyrics_doc = $song->getFirstMediaInField('lyrics_doc'); + + if ($lyrics_doc) { + $path = new \SplFileInfo($lyrics_doc->getPath()); + $html_path = $path->getPath() . '/html'; + $htmlFile = $html_path . '/' . $path->getBasename('.' . $path->getExtension()) . '.HTML'; + if (!file_exists($htmlFile)) { + $cmd = "export HOME=/tmp;/usr/bin/libreoffice --convert-to HTML:HTML --outdir $html_path --headless $path"; + `$cmd`; + } + $lyrics_html = file_get_contents($htmlFile); + //$lyrics_html = str_replace(' true, 'lyrics_html' => $lyrics_html, 'song' => $song, 'collection' => $collection, 'partition' => $partition, 'collection_songs' => $this->_getSongsOfCollection($collection->id, $lists), 'collection_lists' => $lists]); } @@ -154,7 +169,7 @@ class FrontController extends Controller $zip->addFile($file, $f->getFilename()); } $zip->close(); - return response()->download($tmp, $song->title . '.zip')->deleteFileAfterSend(); + return response()->download($tmp, $song->title . '.zip', ['Content-Type' => 'application/zip'], 'attachment')->deleteFileAfterSend(); } } diff --git a/resources/css/app.sass b/resources/css/app.sass index 31ae6fa..fd3f8bc 100644 --- a/resources/css/app.sass +++ b/resources/css/app.sass @@ -126,7 +126,8 @@ article.song &.fromdoc padding: 20px 0 - p + p,font + font-size: calc(16px*var(--text-multi)) !important font-family: $slab !important color: #000 !important @media (prefers-color-scheme: dark) diff --git a/resources/js/mmenu.js b/resources/js/mmenu.js index af36d08..0a03266 100644 --- a/resources/js/mmenu.js +++ b/resources/js/mmenu.js @@ -78,6 +78,7 @@ function updateSongView() { c.updateChords(); }); + $("body").get(0).style.setProperty("--text-multi", getOption('size')); s.find('.lyrics,h3').css('font-size', getOption('size') * 16); } diff --git a/resources/views/menu.blade.php b/resources/views/menu.blade.php index 7409c83..545474f 100644 --- a/resources/views/menu.blade.php +++ b/resources/views/menu.blade.php @@ -115,7 +115,7 @@
  • 🎼 {{__('Partition')}}
  • @endif @if($collection->download_assets) -
  • ⬇️  {{__('Télécharger')}}
  • +
  • ⬇️  {{__('Télécharger')}}
  • @endif @endif -- 2.39.5