]> _ Git - songbook.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Oct 2022 15:25:35 +0000 (17:25 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Oct 2022 15:25:35 +0000 (17:25 +0200)
app/Http/Controllers/FrontController.php
resources/css/app.sass
resources/js/mmenu.js
resources/views/menu.blade.php

index 6fee32f47e32f5a3e4866b7fca326e2a705dafb9..b815951ba503b47aaaf14fa64fd8d80f9862be80 100644 (file)
@@ -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('<style', '<style scoped', $lyrics_html);
+                }
+            } catch (\Exception $e) {
+
             }
-            $lyrics_html = file_get_contents($htmlFile);
-            //$lyrics_html = str_replace('<style', '<style scoped', $lyrics_html);
         }
         return view('song', ['menu' => 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();
     }
 }
 
index 31ae6fa41da927b6ad7bdcbaeaece8512e0b9b23..fd3f8bce813f5213073d7528477518e70accae60 100644 (file)
@@ -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)
index af36d08d67087dcefec020b91c537b81382faa1f..0a0326600285488e18c00df0d7f71c39d44e300f 100644 (file)
@@ -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);
 
 }
index 7409c83c0c17be3b425c966b6a064d9dcfa6d4ad..545474f94528ce7dee8f44cdac686e0d760af459 100644 (file)
                     <li><a target="_blank" href="{{$partition}}">🎼 {{__('Partition')}}</a></li>
                 @endif
                 @if($collection->download_assets)
-                    <li><a href="/downloadassets/{{$song->id}}">⬇️ &nbsp;{{__('Télécharger')}}</a></li>
+                    <li><a download="{{$song->title}}.zip" href="/downloadassets/{{$song->id}}">⬇️ &nbsp;{{__('Télécharger')}}</a></li>
                 @endif
             @endif