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 */
|
/** Show modal */
|
||||||
wish_details
|
wish_details
|
||||||
.modal({
|
.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() {
|
'onVisible' : function() {
|
||||||
/**
|
/**
|
||||||
* Dirty hack to change the default `display: block;` to
|
* Dirty hack to change the default `display: block;` to
|
||||||
|
|
|
@ -7,6 +7,11 @@
|
||||||
namespace wishthis;
|
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="wishlist-filter-wrapper">
|
||||||
<div class="ui stackable grid">
|
<div class="ui stackable grid">
|
||||||
<div class="column">
|
<div class="column">
|
||||||
|
@ -248,34 +253,21 @@ namespace wishthis;
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<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">
|
<button class="ui disabled primary labeled icon button wish-fulfilled">
|
||||||
<i class="check icon"></i>
|
<i class="check icon"></i>
|
||||||
<span><?= __('Mark as fulfilled') ?></span>
|
<span><?= __('Mark as fulfilled') ?></span>
|
||||||
</button>
|
</button>
|
||||||
<?php } else { ?>
|
|
||||||
<button class="ui disabled primary labeled icon button wish-fulfil">
|
<button class="ui disabled primary labeled icon button wish-fulfil">
|
||||||
<i class="gift icon"></i>
|
<i class="gift icon"></i>
|
||||||
<span><?= __('Fulfil wish') ?></span>
|
<span><?= __('Fulfil wish') ?></span>
|
||||||
</button>
|
</button>
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<a class="ui disabled labeled icon button wish-visit" target="_blank">
|
<a class="ui disabled labeled icon button wish-visit" target="_blank">
|
||||||
<i class="external icon"></i>
|
<i class="external icon"></i>
|
||||||
<span><?= __('Visit') ?></span>
|
<span><?= __('Visit') ?></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<?php if ($userIsCurrent) { ?>
|
|
||||||
<div class="ui disabled labeled icon top left pointing dropdown button wish-options">
|
<div class="ui disabled labeled icon top left pointing dropdown button wish-options">
|
||||||
<i class="cog icon"></i>
|
<i class="cog icon"></i>
|
||||||
<span class="text"><?= __('Options') ?></span>
|
<span class="text"><?= __('Options') ?></span>
|
||||||
|
@ -292,7 +284,6 @@ namespace wishthis;
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
|
||||||
|
|
||||||
<button class="ui cancel labeled icon button wish-close">
|
<button class="ui cancel labeled icon button wish-close">
|
||||||
<i class="close icon"></i>
|
<i class="close icon"></i>
|
||||||
|
|
Loading…
Reference in a new issue