diff --git a/.htaccess b/.htaccess index 3ecf58b3..2a7242ff 100644 --- a/.htaccess +++ b/.htaccess @@ -9,6 +9,7 @@ # Wishlists (My lists) RewriteRule ^(wishlists)/([0-9]+)$ /?page=$1&id=$2 [QSA,L] + RewriteRule ^(wishlists)/([0-9]+)/add$ /?page=$1&id=$2&wish_add=true [QSA,L] # Wishlist RewriteRule ^(wishlist)/([0-9a-f]{40})$ /?page=$1&hash=$2 [QSA,L] diff --git a/src/assets/css/home.css b/src/assets/css/home.css index b0868955..ad92f6fe 100644 --- a/src/assets/css/home.css +++ b/src/assets/css/home.css @@ -44,3 +44,20 @@ opacity: 1; } } + +.column.buttons { + display: flex !important; +} + +.column.buttons .left.attached.button { + flex: 1 1 100%; + + text-align: center; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.column.buttons .right.attached.button { + flex: 0 0 auto; +} diff --git a/src/assets/js/wishlists.js b/src/assets/js/wishlists.js index 1820ddfb..be842d1d 100644 --- a/src/assets/js/wishlists.js +++ b/src/assets/js/wishlists.js @@ -28,6 +28,11 @@ $(function () { element.dropdown('set selected', wishlists[0].value); } } + + /** Open add wish modal */ + if ($_GET.wish_add) { + $('.button.wishlist-wish-add').trigger('click'); + } } }); } diff --git a/src/classes/page.php b/src/classes/page.php index ad864b32..13a84f44 100644 --- a/src/classes/page.php +++ b/src/classes/page.php @@ -406,6 +406,7 @@ class Page button_wishlist_saved : '', }; + navigation();
  • +
  • +
  • diff --git a/src/pages/home.php b/src/pages/home.php index 563b8041..32165598 100644 --- a/src/pages/home.php +++ b/src/pages/home.php @@ -29,25 +29,54 @@ $page->navigation(); isLoggedIn()) { ?>
    + + query( + ' SELECT `wishlists`.* + FROM `wishes` + JOIN `wishlists` ON `wishes`.`wishlist` = `wishlists`.`id` + JOIN `users` ON `wishlists`.`user` = `users`.`id` + WHERE `users`.`id` = ' . $user->id . ' + ORDER BY `wishes`.`edited` DESC + LIMIT 1;' + ); + + if (false !== $lastWishlistQuery && 1 === $lastWishlistQuery->rowCount()) { + $lastWishlist = $lastWishlistQuery->fetch(); + $href = Page::PAGE_WISHLISTS . '&id=' . $lastWishlist['id']; + $hrefAdd = $href . '&wish_add=true'; + ?> +
    + + + + + + +
    +
    diff --git a/src/pages/wishlists.php b/src/pages/wishlists.php index b5cfdc71..cb24b496 100644 --- a/src/pages/wishlists.php +++ b/src/pages/wishlists.php @@ -12,7 +12,9 @@ $page = new Page(__FILE__, __('My lists')); $page->header(); $page->bodyStart(); $page->navigation(); + ?> +

    title ?>

    diff --git a/src/update/0-7-0.sql b/src/update/0-7-0.sql index 3d57d6c2..56edd6f2 100644 --- a/src/update/0-7-0.sql +++ b/src/update/0-7-0.sql @@ -1,7 +1,8 @@ /** * Wishes */ -ALTER TABLE `wishes` MODIFY `image` TEXT NULL DEFAULT NULL; +ALTER TABLE `wishes` MODIFY `image` TEXT NULL DEFAULT NULL, + ADD COLUMN `edited` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP; /** * Products