Skip to content

Commit

Permalink
Fixed occasions when artist, band or album has no image
Browse files Browse the repository at this point in the history
  • Loading branch information
Akasiek committed Jul 31, 2022
1 parent 0a2f79a commit 1e9aad0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
16 changes: 8 additions & 8 deletions frontend/views/album/_album_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
}, $genres));



?>

<div class="group">

<a href="<?= Url::to(['/album/view', 'slug' => $model->slug,]) ?>" class="block
relative shadow-lg group-hover:scale-95 transition-transform ease-in-out">
<img src="<?= $model->artwork_url ?>" alt="Album artwork" class=" ">
<img src="<?= $model->artwork_url ?: Yii::getAlias('@web/resources/images/no_image.jpg') ?>" alt="Album artwork"
class="aspect-square object-cover object-center">
<?php if ($model->type !== "LP") : ?>
<p class="absolute bottom-0 right-0 text-xs md:text-sm font-bold bg-secondary-accent pr-1 md:pr-2 pl-2 md:pl-3 py-1 rounded-tl-xl md:rounded-tl-2xl">
<?= $model->type ?>
Expand All @@ -31,18 +31,18 @@
<div class="flex flex-col px-1 py-2 xl:p-2 truncate">
<h3 class="font-bold text-sm lg:text-base xl:text-lg truncate">
<a href="<?= Url::to([
'/album/view',
'slug' => $model->slug,
]) ?>" class="hover:underline transition underline-offset-2" title="<?= $model->title ?>">
'/album/view',
'slug' => $model->slug,
]) ?>" class="hover:underline transition underline-offset-2" title="<?= $model->title ?>">
<?= $model->title ?>
</a>
</h3>

<p class="text-sm truncate italic">
<a href="<?= Url::to([
'/' . ($model->artist_id ? 'artist' : 'band') . '/view/',
'slug' => $model->artist->slug ?? $model->band->slug,
]) ?>" class="hover:underline transition" title="<?= $model->artist->name ?? $model->band->name ?>">
'/' . ($model->artist_id ? 'artist' : 'band') . '/view/',
'slug' => $model->artist->slug ?? $model->band->slug,
]) ?>" class="hover:underline transition" title="<?= $model->artist->name ?? $model->band->name ?>">
<?= $model->artist->name ?? $model->band->name ?>
</a>
</p>
Expand Down
3 changes: 2 additions & 1 deletion frontend/views/album/_view_album_jumbotron.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

<div class="flex flex-col md:flex-row justify-center items-center gap-5 xl:gap-10 max-w-screen-xl px-4 md:px-12 lg:px-16">
<div class="relative group overflow-hidden">
<img src="<?= $model->artwork_url ?>" alt="Album artwork" class="w-64 md:w-72 lg:w-96">
<img src="<?= $model->artwork_url ?: Yii::getAlias('@web/resources/images/no_image.jpg') ?>"
alt="Album artwork" class="w-64 md:w-72 lg:w-96 aspect-square object-cover object-center">
<?php if (!Yii::$app->user->isGuest): ?>
<a href="<?= Url::to(['edit', 'slug' => $model->slug]) ?>"
class="absolute bottom-0 right-0 pl-6 pr-1 pt-6 pb-1 lg:pl-8 lg:pr-2 lg:pt-8 lg:pb-2
Expand Down
4 changes: 3 additions & 1 deletion frontend/views/components/_default_card.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
<div class="rounded-3xl w-full h-40 md:h-48 !bg-cover flex flex-col justify-end items-start snap-start scroll-pl-3
group overflow-hidden !bg-center relative group bg-secondary-dark">

<img src="<?= $model->bg_image_url ?>" alt="" class="absolute h-full w-full object-center object-cover z-10
<img src="<?= $model->bg_image_url ?: Yii::getAlias('@web/resources/images/no_image.jpg') ?>"
alt="artist background image"
class="absolute h-full w-full object-center object-cover z-10
transition-all xl:group-hover:scale-110 opacity-95 xl:opacity-80 group-hover:opacity-100">

<div class="absolute top-0 bottom-0 left-0 right-0 w-full z-20 group-hover:scale-125 transition-all" style="background: linear-gradient(180deg, rgba(94, 43, 255, 0),
Expand Down
2 changes: 1 addition & 1 deletion frontend/views/components/_default_jumbotron.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
linear-gradient(180deg, rgba(94, 43, 255, 0) 30%,
rgba(94, 43, 255, 0.85) 100%,
rgba(94, 43, 255, 0.85) 100%),
url('<?php echo $model->bg_image_url ?>'); ">
url('<?php echo $model->bg_image_url ?: Yii::getAlias('@web/resources/images/no_image.jpg') ?>'); ">
<div class="px-6 md:px-12 lg:px-14 pb-6 md:pb-8 lg:pb-10 w-full flex flex-col gap-2">


Expand Down

0 comments on commit 1e9aad0

Please sign in to comment.