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,51 +253,37 @@ namespace wishthis;
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<?php
|
<button class="ui disabled primary labeled icon button wish-fulfilled">
|
||||||
/** Determine if current user is wishlist owner */
|
<i class="check icon"></i>
|
||||||
$url = new URL($_SERVER['REQUEST_URI']);
|
<span><?= __('Mark as fulfilled') ?></span>
|
||||||
$wishlist_id = $_GET['id'] ?? $_GET['hash'];
|
</button>
|
||||||
$wishlist = new Wishlist($wishlist_id);
|
|
||||||
|
|
||||||
$userIsCurrent = $_SESSION['user']->isLoggedIn()
|
<button class="ui disabled primary labeled icon button wish-fulfil">
|
||||||
&& $_SESSION['user']->id === $wishlist->user;
|
<i class="gift icon"></i>
|
||||||
?>
|
<span><?= __('Fulfil wish') ?></span>
|
||||||
|
</button>
|
||||||
<?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">
|
<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>
|
|
||||||
|
|
||||||
<div class="menu">
|
<div class="menu">
|
||||||
<button class="item disabled wish-edit">
|
<button class="item disabled wish-edit">
|
||||||
<i class="pen icon"></i>
|
<i class="pen icon"></i>
|
||||||
<span><?= __('Edit') ?></span>
|
<span><?= __('Edit') ?></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button class="item disabled wish-delete">
|
<button class="item disabled wish-delete">
|
||||||
<i class="trash icon"></i>
|
<i class="trash icon"></i>
|
||||||
<span><?= __('Delete') ?></span>
|
<span><?= __('Delete') ?></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
</div>
|
||||||
|
|
||||||
<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