Add warning when viewing own wishlist

This commit is contained in:
Jay Trees 2022-01-18 15:54:08 +01:00
parent 28e8e1d08d
commit be1b46cc22
2 changed files with 42 additions and 1 deletions

View file

@ -0,0 +1,22 @@
$(function() {
if ($('.wishlist-own').length) {
$('body')
.modal({
title: $('.wishlist-own .header').text(),
content: $('.wishlist-own .text').html(),
class: '',
blurring: true,
closable: false,
actions: [
{
text: 'Show wishlist anyway',
class: 'approve primary'
}
],
onApprove: function() {
$('.wishlist-own').slideUp();
}
})
.modal('show');
}
});

View file

@ -33,12 +33,31 @@ if ($wishlist) {
<div class="ui container">
<h1 class="ui header"><?= $page->title ?></h1>
<?php
/**
* Warn the wishlist creator
*/
if (isset($user->id) && $user->id === intval($wishlist['user'])) { ?>
<div class="ui icon warning message wishlist-own">
<i class="exclamation triangle icon"></i>
<div class="content">
<div class="header">
Careful
</div>
<div class="text">
<p>You are viewing your own wishlist! You will be able to see which products have already been bought for you. Don't you want to be surprised?</p>
<p>It's probably best to just close this tab.</p>
</div>
</div>
</div>
<?php } ?>
<div class="ui segment">
<h2 class="ui header"><?= $wishlist['name'] ?></h2>
</div>
<?php if (!empty($products)) { ?>
<div class="ui three column grid">
<div class="ui three column grid wishlist-cards">
<?php foreach ($products as $product) { ?>
<?php