From 0ee7e4a315a9916c60708aaf73d6af2cbed819ed Mon Sep 17 00:00:00 2001 From: Kelvin Date: Mon, 11 Jul 2016 13:40:31 +0100 Subject: [PATCH] #7: Implement front-end handling of mixed losslessness track collections --- app/Models/Album.php | 3 ++- app/Models/Playlist.php | 3 ++- public/templates/albums/show.html | 4 ++-- .../collection-mixed-losslessness-dialog.html | 16 ++++++++++++++++ public/templates/playlists/show.html | 4 ++-- .../assets/scripts/app/controllers/album.coffee | 9 ++++++++- .../scripts/app/controllers/playlist.coffee | 9 ++++++++- 7 files changed, 40 insertions(+), 8 deletions(-) create mode 100644 public/templates/partials/collection-mixed-losslessness-dialog.html diff --git a/app/Models/Album.php b/app/Models/Album.php index 4ce398f1..876e9ca2 100644 --- a/app/Models/Album.php +++ b/app/Models/Album.php @@ -152,7 +152,8 @@ class Album extends Model implements Searchable, Commentable, Favouritable 'extension' => $format['extension'], 'url' => $album->getDownloadUrl($name), 'size' => Helpers::formatBytes($album->getFilesize($name)), - 'isCacheable' => (in_array($name, Track::$CacheableFormats) ? true : false) + 'isCacheable' => (in_array($name, Track::$CacheableFormats) ? true : false), + 'isMixedLosslessness' => (in_array($name, Track::$LosslessFormats) && !$album->hasLosslessTracksOnly() && $album->hasLosslessTracks()) ]; } diff --git a/app/Models/Playlist.php b/app/Models/Playlist.php index 3fea8ecf..f2639a3f 100644 --- a/app/Models/Playlist.php +++ b/app/Models/Playlist.php @@ -127,7 +127,8 @@ class Playlist extends Model implements Searchable, Commentable, Favouritable 'extension' => $format['extension'], 'url' => $playlist->getDownloadUrl($name), 'size' => Helpers::formatBytes($playlist->getFilesize($name)), - 'isCacheable' => (in_array($name, Track::$CacheableFormats) ? true : false) + 'isCacheable' => (in_array($name, Track::$CacheableFormats) ? true : false), + 'isMixedLosslessness' => (in_array($name, Track::$LosslessFormats) && !$playlist->hasLosslessTracksOnly() && $playlist->hasLosslessTracks()) ]; } diff --git a/public/templates/albums/show.html b/public/templates/albums/show.html index b7f520ca..710368ed 100644 --- a/public/templates/albums/show.html +++ b/public/templates/albums/show.html @@ -6,11 +6,11 @@