From 40dc5bf117d74915d190cab7622e56eb412e836f Mon Sep 17 00:00:00 2001 From: Ro Date: Thu, 9 Feb 2023 12:34:51 -0800 Subject: [PATCH] Listing style tweaks Cleaned up pagination to make it easier to identify what page is currently being displayed and tweaks font sizes of page links for better legibility. --- public/assets/css/front/listing.css | 11 ++++++++- src/Service/HandleLocations.php | 15 ++++++++---- templates/front/listing.twig | 36 ++++++++++++++++++++++++----- 3 files changed, 51 insertions(+), 11 deletions(-) diff --git a/public/assets/css/front/listing.css b/public/assets/css/front/listing.css index 9539106..5c6b7bc 100644 --- a/public/assets/css/front/listing.css +++ b/public/assets/css/front/listing.css @@ -12,7 +12,6 @@ section[role="listings"] a { font-size: 2em; font-weight: bold; border: 0; - display: block; } section[role="listings"] a label { @@ -25,3 +24,13 @@ section[role="listings"] a label { section[role="listings"] a:hover { color: var(--white); } + +section[role="listings"] div[role="paginate"] { + padding: 5px; +} + +section[role="listings"] div[role="paginate"] span { + vertical-align: super; + font-weight: bold; + font-size: 1.5em; +} diff --git a/src/Service/HandleLocations.php b/src/Service/HandleLocations.php index f0dd5f1..f0e51d3 100644 --- a/src/Service/HandleLocations.php +++ b/src/Service/HandleLocations.php @@ -45,11 +45,18 @@ class HandleLocations $response = null; //$utils = new StringTools(); //$term = $utils->removeCommonWords($terms); - $terms = str_replace(",", "", $terms); - $terms = str_replace(" ", "|", $terms); + $rawSearch = $terms; + $terms = str_replace(",", "", $terms); + $terms = str_replace(" ", "|", $terms); try { $search = $this->connection->fetchAllAssociative("SELECT * FROM searchlocations('$terms')"); + $active = []; + foreach ($search as $item) { + if ($item["active"] == true) { + array_push($active, $item); + } + } } catch (PDOException $error) { $errorMessage = $error->getMessage(); } catch (DBALException $error) { @@ -71,8 +78,8 @@ class HandleLocations $response = [ "status" => true, "message" => "Good Reqeust", - "items" => $search, - "terms" => $terms, + "items" => $active, + "terms" => $rawSearch, ]; } diff --git a/templates/front/listing.twig b/templates/front/listing.twig index c31e129..ef86703 100644 --- a/templates/front/listing.twig +++ b/templates/front/listing.twig @@ -6,10 +6,20 @@ {% block main %}

The Bad Space Listings

-

Page - {{ options.currentPage }} - of - {{ options.list.total }}

+
+ + + + + Page + {{ options.currentPage }} + of + {{ options.list.total }} + + + + +
{% for location in options.list.locations %} @@ -17,7 +27,21 @@ {{ location.name }}
{% endfor %} - Previous - Next + +
+ + + + + Page + {{ options.currentPage }} + of + {{ options.list.total }} + + + + +
+
{% endblock %}