feat(*.php, *.psql): deduplicate API code + performance improvements
This commit is contained in:
parent
cf3dac8a46
commit
4bad005e58
31 changed files with 502 additions and 666 deletions
|
@ -84,7 +84,7 @@ schema: artist
|
|||
$dialogId = "dialog-" . htmlspecialchars($concert["id"]);
|
||||
?>
|
||||
<li class="concerts">
|
||||
On <mark><?php echo date("F j, Y", strtotime($concert["date"])); ?></mark>
|
||||
On <mark><?php echo date("F j, Y", strtotime($concert["date"])); ?></mark> 
|
||||
<?php if (!empty($venue)): ?>
|
||||
at <?php echo $venue; ?>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -41,7 +41,7 @@ schema: book
|
|||
<span class="sub-meta tattoo">{% tablericon "needle" %} I have a tattoo inspired by this book!</span>
|
||||
<?php endif; ?>
|
||||
<?php if ($book["status"] == 'finished'): ?>
|
||||
<span class="sub-meta">Finished on: <mark><?= date('F j, Y', strtotime($book["date_finished"])) ?></mark></span>
|
||||
<span class="sub-meta">Finished on: <mark><?= date('F j, Y', strtotime($book["date_finished"])) ?></mark></span>
|
||||
<?php elseif ($book["status"] == 'started'): ?>
|
||||
<progress value="<?= htmlspecialchars($book["progress"]) ?>" max="100"><?php $book["progress"] . '%'; ?></progress>
|
||||
<?php endif; ?>
|
||||
|
|
|
@ -8,7 +8,7 @@ schema: genre
|
|||
<article class="genre-focus">
|
||||
<?php $artistCount = count($genre["artists"]); ?>
|
||||
<?php if ($artistCount > 0): ?>
|
||||
<p>My top <mark><?= htmlspecialchars($genre["name"]) ?></mark> artists are
|
||||
<p>My top <mark><?= htmlspecialchars($genre["name"]) ?></mark> artists are
|
||||
<?php
|
||||
$artists = array_slice($genre["artists"], 0, 5);
|
||||
$artistLinks = [];
|
||||
|
@ -16,7 +16,7 @@ schema: genre
|
|||
$artistLinks[] = '<a href="' . htmlspecialchars($artist["url"]) . '">' . htmlspecialchars($artist["name"]) . '</a>';
|
||||
}
|
||||
echo implode(', ', $artistLinks);
|
||||
?>. I've listened to <mark><?= $genre["total_plays"] . ' ' . pluralize($genre["total_plays"], "play") ?></mark> tracks from this genre.</p>
|
||||
?>. I've listened to <mark><?= $genre["total_plays"] . ' ' . pluralize($genre["total_plays"], "play") ?></mark> tracks from this genre.</p>
|
||||
<hr />
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
|
|
|
@ -33,10 +33,7 @@ schema: show
|
|||
<span class="sub-meta tattoo">{% tablericon "needle" %} I have a tattoo inspired by this show!</span>
|
||||
<?php endif; ?>
|
||||
<?php if (!empty($show["episode"]["formatted_episode"])): ?>
|
||||
<span class="sub-meta">I last watched
|
||||
<mark><?= htmlspecialchars($show["episode"]["formatted_episode"]) ?></mark> 
|
||||
on <?= date('F j, Y', strtotime($show["episode"]["last_watched_at"])) ?>.
|
||||
</span>
|
||||
<span class="sub-meta">I last watched <mark><?= htmlspecialchars($show["episode"]["formatted_episode"]) ?></mark> on <?= date('F j, Y', strtotime($show["episode"]["last_watched_at"])) ?>.</span>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (!empty($show["review"])): ?>
|
||||
|
|
|
@ -5,7 +5,7 @@ schema: tags
|
|||
---
|
||||
<a class="back-link" href="/tags" title="Go back to the tags index page">{% tablericon "arrow-left" %} Back to tags</a>
|
||||
<h2 class="page-title">#<?= htmlspecialchars($tag) ?></h2>
|
||||
<p><mark><?= number_format($totalCount) ?> item<?= $totalCount === 1 ? '' : 's' ?></mark> items tagged with <mark>#<?= htmlspecialchars($tag) ?></mark>. <a class="search" href="/search">You can search my site as well</a>.</p>
|
||||
<p><mark><?= number_format($totalCount) ?> item<?= $totalCount === 1 ? '' : 's' ?></mark> items tagged with <mark>#<?= htmlspecialchars($tag) ?></mark>. <a class="search" href="/search">You can search my site as well</a>.</p>
|
||||
<hr />
|
||||
<?php foreach ($tagged as $item): ?>
|
||||
<article class="<?= $item['type'] ?>">
|
||||
|
@ -19,9 +19,9 @@ schema: tags
|
|||
• <?= $item['label'] ?>
|
||||
</aside>
|
||||
<h3>
|
||||
<a href="<?= htmlspecialchars($item['url']) ?>"><?= htmlspecialchars($item['title']) ?><?php if (!empty($item['rating'])): ?> (<?= $item['rating'] ?>)<?php endif; ?></a>
|
||||
<a href="<?= htmlspecialchars($item['url']) ?>"><?= htmlspecialchars($item['title']) ?><?php if (!empty($item['rating'])): ?> (<?= $item['rating'] ?>)<?php endif; ?></a>
|
||||
<?php if (!empty($item['author'])): ?>
|
||||
 via 
|
||||
 via 
|
||||
<?php if (!empty($item['author']['url'])): ?>
|
||||
<a href="<?= $item['author']['url'] ?>">
|
||||
<?= $item['author']['name'] ?>
|
||||
|
|
|
@ -33,12 +33,13 @@ permalink: "/music/concerts/{% if pagination.pageNumber > 0 %}{{ pagination.page
|
|||
<strong>{{ artistName }}</strong> on {{ concert.date | date: "%B %e, %Y" }}
|
||||
{% if venue %} at {{ venue }}{% endif %}
|
||||
<span class="client-side" style="display:inline">
|
||||
{%- if concert.notes -%}
|
||||
{% assign notes = concert.notes | prepend: "### Notes\n" | markdown %}
|
||||
{%- if concert.concert_notes -%}
|
||||
{% assign notes = concert.concert_notes | markdown %}
|
||||
{% render "blocks/dialog.liquid",
|
||||
icon:"info-circle",
|
||||
label:"View info about this concert"
|
||||
content:notes,
|
||||
dynamic:"optimized_concerts",
|
||||
markdown:"concert_notes",
|
||||
id:concert.id
|
||||
%}
|
||||
{%- endif -%}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue