Refactor
This commit is contained in:
parent
24082c5cff
commit
fb38bb7f86
5 changed files with 26 additions and 29 deletions
|
@ -23,7 +23,11 @@ $(function () {
|
|||
var dropdown_wishlists = $('.dropdown.wishlists');
|
||||
|
||||
if (dropdown_wishlists.length) {
|
||||
settings.urlData.wishlistid = $('.dropdown.wishlists').dropdown('get value');
|
||||
var dropdown_wishlists_value = dropdown_wishlists.dropdown('get value');
|
||||
|
||||
if (dropdown_wishlists_value) {
|
||||
settings.urlData.wishlistid = dropdown_wishlists_value;
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof wistlist_cards_data !== 'undefined') {
|
||||
|
|
|
@ -20,7 +20,7 @@ $(function () {
|
|||
/**
|
||||
* Get Wishlists
|
||||
*/
|
||||
var wishlists = [];
|
||||
var wishlists = [];
|
||||
|
||||
$('.ui.dropdown.wishlists')
|
||||
.dropdown()
|
||||
|
@ -39,15 +39,17 @@ $(function () {
|
|||
wishlists = response.results;
|
||||
|
||||
dropdown_wishlists.dropdown({
|
||||
values : wishlists
|
||||
'values' : wishlists,
|
||||
})
|
||||
|
||||
/** Select current/active wishlist */
|
||||
if (wishlist.id) {
|
||||
dropdown_wishlists.dropdown('set selected', wishlist.id);
|
||||
} else {
|
||||
if (wishlists.length >= 1) {
|
||||
dropdown_wishlists.dropdown('set selected', Object.values(wishlists)[0]);
|
||||
if (Object.keys(wishlists).length >= 1) {
|
||||
var first_wishlist_id = Object.keys(wishlists)[0];
|
||||
|
||||
dropdown_wishlists.dropdown('set selected', first_wishlist_id);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,9 +6,14 @@
|
|||
|
||||
namespace wishthis;
|
||||
|
||||
$scriptPart = '/src/assets/js/parts/wishlist-filter.js';
|
||||
$scripts = array(
|
||||
'/src/assets/js/parts/wishlist-filter.js',
|
||||
'/src/assets/js/parts/wishlists.js',
|
||||
);
|
||||
?>
|
||||
<script defer src="<?= $scriptPart ?>?m=<?= filemtime(ROOT . $scriptPart) ?>"></script>
|
||||
<?php foreach ($scripts as $script) { ?>
|
||||
<script defer src="<?= $script ?>?m=<?= filemtime(ROOT . $script) ?>"></script>
|
||||
<?php } ?>
|
||||
|
||||
<div>
|
||||
<div class="ui stackable grid">
|
||||
|
@ -65,3 +70,9 @@ $scriptPart = '/src/assets/js/parts/wishlist-filter.js';
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (isset($wishlist->id)) { ?>
|
||||
<div class="wishlist-cards" data-wishlist="<?= $wishlist->id ?>"></div>
|
||||
<?php } else { ?>
|
||||
<div class="wishlist-cards"></div>
|
||||
<?php } ?>
|
|
@ -69,25 +69,7 @@ $page->navigation();
|
|||
|
||||
<h2 class="ui header"><?= __('Wishes') ?></h2>
|
||||
|
||||
<?php include 'parts/wishlist-filter.php' ?>
|
||||
|
||||
<div class="wishlist-cards" data-wishlist="<?= $wishlist->id ?>">
|
||||
<?php
|
||||
/*
|
||||
echo $wishlist->getCards(
|
||||
array(
|
||||
'WHERE' => '`wishlist` = ' . $wishlist->id . '
|
||||
AND (
|
||||
`status` = ""
|
||||
OR `status` IS NULL
|
||||
OR `status` < unix_timestamp(CURRENT_TIMESTAMP - INTERVAL ' . Wish::STATUS_TEMPORARY_MINUTES . ' MINUTE)
|
||||
)
|
||||
AND (`status` != "' . Wish::STATUS_UNAVAILABLE . '" OR `status` IS NULL)'
|
||||
)
|
||||
);
|
||||
*/
|
||||
?>
|
||||
</div>
|
||||
<?php include 'parts/wishlist.php' ?>
|
||||
|
||||
<div class="ui basic center aligned segment">
|
||||
<button class="ui primary button wishlist-request-wishes" data-locale="<?= $wishlist_user->getLocale() ?>">
|
||||
|
|
|
@ -92,9 +92,7 @@ $page->navigation();
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<?php include 'parts/wishlist-filter.php' ?>
|
||||
|
||||
<div class="wishlist-cards"></div>
|
||||
<?php include 'parts/wishlist.php' ?>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
|
|
Loading…
Reference in a new issue