From 1b9c3c080c39c63d36ed85ab059fa5c645e14302 Mon Sep 17 00:00:00 2001
From: Roan Horning <roan.horning@gmail.com>
Date: Sun, 7 Aug 2022 19:54:47 -0400
Subject: [PATCH] Add MACRO display_explicit

---
 templates/content-index.tpl.html          | 4 ++--
 templates/shared-episode-summary.tpl.html | 2 +-
 templates/shared-utils.tpl.html           | 4 ++++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/templates/content-index.tpl.html b/templates/content-index.tpl.html
index b4563fd..76add09 100644
--- a/templates/content-index.tpl.html
+++ b/templates/content-index.tpl.html
@@ -26,7 +26,7 @@
 <!--% FOREACH latest_episodes IN DBI.query('
 	SELECT 
 	eps.id, 
-	CASE eps.explicit WHEN 1 THEN \'Explicit\' ELSE \'Clean\' END AS explicit , 
+	eps.explicit, 
 	eps.date, eps.license, eps.duration,
 	eps.title, eps.summary, eps.tags, 
 	eps.notes,
@@ -49,7 +49,7 @@
 		<h3><!--% latest_episodes.summary%--></h3>
 		<p class="meta"$><!--% IF get_avatar(latest_episodes.hostid) != 'hpr_logo.png' %-->
 		<img src="<!--% absolute_path(baseurl) %-->images/<!--% get_avatar(latest_episodes.hostid) %-->" height="80" width="80" alt="" /></a><!--% END %-->
-	<br>Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->/index.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% latest_episodes.explicit %--> and released under a <!--% latest_episodes.license %--> license. <br>
+	<br>Hosted by <a href="<!--% absolute_path(baseurl) %-->correspondents/<!--% zero_pad_left(latest_episodes.hostid) %-->/index.html"><!--% latest_episodes.host %--></a> on <!--% latest_episodes.date %--> is flagged as <!--% display_explicit(latest_episodes.explicit) %--> and released under a <!--% latest_episodes.license %--> license. <br>
 <strong>Tags:</strong> <!--% latest_episodes.tags %--><em></em>.<br>
 <small>listen in <a href="local/hpr<!--% latest_episodes.id %-->.ogg">ogg</a>, <a href="local/hpr<!--% latest_episodes.id %-->.spx">spx</a>, or <a href="local/hpr<!--% latest_episodes.id %-->.mp3">mp3</a> format. <!--% show_series(latest_episodes.series, latest_episodes.seriesid) %-->
  <a href="eps.php?id=3628#comments">comments (0)</a></small>
diff --git a/templates/shared-episode-summary.tpl.html b/templates/shared-episode-summary.tpl.html
index 46e4269..95f1db9 100644
--- a/templates/shared-episode-summary.tpl.html
+++ b/templates/shared-episode-summary.tpl.html
@@ -5,7 +5,7 @@
 <!--% END %-->
 
 <!--% MACRO show_meta(show) BLOCK %-->
-	<span><label>Released:</label> <!--% show.date %-->.</span> <span><label>Duration:</label> <!--% show.duration %-->.</span> <span><label>Flag:</label> <!--% show.explicit %-->.</span> <span><!--% show_series(show.series, show.seriesid) %--></span>  <br>
+	<span><label>Released:</label> <!--% show.date %-->.</span> <span><label>Duration:</label> <!--% show.duration %-->.</span> <span><label>Flag:</label> <!--% display_explicit(show.explicit) %-->.</span> <span><!--% show_series(show.series, show.seriesid) %--></span>  <br>
 	<span><label>Tags:</label> <em><!--% show.tags %--></em>.</span>
 <!--% END %-->
 
diff --git a/templates/shared-utils.tpl.html b/templates/shared-utils.tpl.html
index e433c42..8143cb4 100644
--- a/templates/shared-utils.tpl.html
+++ b/templates/shared-utils.tpl.html
@@ -8,6 +8,10 @@
 <!--% ELSE %--><!--% display_when_false %--><!--% END %-->
 <!--% END %-->
 
+<!--% MACRO display_explicit(is_explicit) BLOCK %-->
+<!--% display_choice(is_explicit, 'Explicit', 'Clean') %-->
+<!--% END %-->
+
 <!--% MACRO absolute_path(baseurl) BLOCK %-->
 <!--% IF baseurl %-->./<!--% ELSE %-->/<!--% END %-->
 <!--% END %-->