Fix undefined array key
This commit is contained in:
parent
c31a07d855
commit
73ad4012df
2 changed files with 36 additions and 35 deletions
|
@ -44,6 +44,16 @@ $(function () {
|
|||
/** Show modal */
|
||||
wish_details
|
||||
.modal({
|
||||
'onShow' : function() {
|
||||
var user_is_current = wishlist && wishlist.user === parseInt($('[name="user-id"]').val());
|
||||
|
||||
if (user_is_current) {
|
||||
$('.ui.button.wish-fulfil').remove();
|
||||
} else {
|
||||
$('.ui.button.wish-fulfilled').remove();
|
||||
$('.ui.dropdown.wish-options').remove();
|
||||
}
|
||||
},
|
||||
'onVisible' : function() {
|
||||
/**
|
||||
* Dirty hack to change the default `display: block;` to
|
||||
|
|
|
@ -7,6 +7,11 @@
|
|||
namespace wishthis;
|
||||
|
||||
?>
|
||||
|
||||
<?php if ($_SESSION['user']->isLoggedIn()) { ?>
|
||||
<input type="hidden" name="user-id" value="<?= $_SESSION['user']->id ?>" />
|
||||
<?php } ?>
|
||||
|
||||
<div class="wishlist-filter-wrapper">
|
||||
<div class="ui stackable grid">
|
||||
<div class="column">
|
||||
|
@ -248,34 +253,21 @@ namespace wishthis;
|
|||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<?php
|
||||
/** Determine if current user is wishlist owner */
|
||||
$url = new URL($_SERVER['REQUEST_URI']);
|
||||
$wishlist_id = $_GET['id'] ?? $_GET['hash'];
|
||||
$wishlist = new Wishlist($wishlist_id);
|
||||
|
||||
$userIsCurrent = $_SESSION['user']->isLoggedIn()
|
||||
&& $_SESSION['user']->id === $wishlist->user;
|
||||
?>
|
||||
|
||||
<?php if ($userIsCurrent) { ?>
|
||||
<button class="ui disabled primary labeled icon button wish-fulfilled">
|
||||
<i class="check icon"></i>
|
||||
<span><?= __('Mark as fulfilled') ?></span>
|
||||
</button>
|
||||
<?php } else { ?>
|
||||
|
||||
<button class="ui disabled primary labeled icon button wish-fulfil">
|
||||
<i class="gift icon"></i>
|
||||
<span><?= __('Fulfil wish') ?></span>
|
||||
</button>
|
||||
<?php } ?>
|
||||
|
||||
<a class="ui disabled labeled icon button wish-visit" target="_blank">
|
||||
<i class="external icon"></i>
|
||||
<span><?= __('Visit') ?></span>
|
||||
</a>
|
||||
|
||||
<?php if ($userIsCurrent) { ?>
|
||||
<div class="ui disabled labeled icon top left pointing dropdown button wish-options">
|
||||
<i class="cog icon"></i>
|
||||
<span class="text"><?= __('Options') ?></span>
|
||||
|
@ -292,7 +284,6 @@ namespace wishthis;
|
|||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<button class="ui cancel labeled icon button wish-close">
|
||||
<i class="close icon"></i>
|
||||
|
|
Loading…
Reference in a new issue