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.
This commit is contained in:
Ro 2023-02-09 12:34:51 -08:00
parent 245531faf6
commit 40dc5bf117
3 changed files with 51 additions and 11 deletions

View file

@ -12,7 +12,6 @@ section[role="listings"] a {
font-size: 2em; font-size: 2em;
font-weight: bold; font-weight: bold;
border: 0; border: 0;
display: block;
} }
section[role="listings"] a label { section[role="listings"] a label {
@ -25,3 +24,13 @@ section[role="listings"] a label {
section[role="listings"] a:hover { section[role="listings"] a:hover {
color: var(--white); 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;
}

View file

@ -45,11 +45,18 @@ class HandleLocations
$response = null; $response = null;
//$utils = new StringTools(); //$utils = new StringTools();
//$term = $utils->removeCommonWords($terms); //$term = $utils->removeCommonWords($terms);
$terms = str_replace(",", "", $terms); $rawSearch = $terms;
$terms = str_replace(" ", "|", $terms); $terms = str_replace(",", "", $terms);
$terms = str_replace(" ", "|", $terms);
try { try {
$search = $this->connection->fetchAllAssociative("SELECT * FROM searchlocations('$terms')"); $search = $this->connection->fetchAllAssociative("SELECT * FROM searchlocations('$terms')");
$active = [];
foreach ($search as $item) {
if ($item["active"] == true) {
array_push($active, $item);
}
}
} catch (PDOException $error) { } catch (PDOException $error) {
$errorMessage = $error->getMessage(); $errorMessage = $error->getMessage();
} catch (DBALException $error) { } catch (DBALException $error) {
@ -71,8 +78,8 @@ class HandleLocations
$response = [ $response = [
"status" => true, "status" => true,
"message" => "Good Reqeust", "message" => "Good Reqeust",
"items" => $search, "items" => $active,
"terms" => $terms, "terms" => $rawSearch,
]; ];
} }

View file

@ -6,10 +6,20 @@
{% block main %} {% block main %}
<section role="listings"> <section role="listings">
<h1>The Bad Space Listings</h1> <h1>The Bad Space Listings</h1>
<h2>Page <div role="paginate">
{{ options.currentPage }} <a href="/listings/page/{{ options.prevPage }}" title="previous page">
of <i class="ti ti-arrow-left"></i>
{{ options.list.total }}</h2> </a>
<span>
Page
{{ options.currentPage }}
of
{{ options.list.total }}
</span>
<a href="/listings/page/{{ options.nextPage }}" title="next page">
<i class="ti ti-arrow-right"></i>
</a>
</div>
{% for location in options.list.locations %} {% for location in options.list.locations %}
<a href="/location/{{ location.uuid }}"> <a href="/location/{{ location.uuid }}">
@ -17,7 +27,21 @@
{{ location.name }}</a> {{ location.name }}</a>
<br/> <br/>
{% endfor %} {% endfor %}
<a href="/listings/page/{{ options.prevPage }}">Previous</a>
<a href="/listings/page/{{ options.nextPage }}">Next</a> <div role="paginate">
<a href="/listings/page/{{ options.prevPage }}" title="previous page">
<i class="ti ti-arrow-left"></i>
</a>
<span>
Page
{{ options.currentPage }}
of
{{ options.list.total }}
</span>
<a href="/listings/page/{{ options.nextPage }}" title="next page">
<i class="ti ti-arrow-right"></i>
</a>
</div>
</section> </section>
{% endblock %} {% endblock %}