Create clickable links on feature details pages
authorJonathan S. Katz <jonathan.katz@excoventures.com>
Sun, 30 Aug 2020 20:36:52 +0000 (16:36 -0400)
committerJonathan S. Katz <jonathan.katz@excoventures.com>
Sun, 30 Aug 2020 20:36:52 +0000 (16:36 -0400)
There are many feature matrix details pages that would have
just a plain URL that was not clickable, either due to someone
accessing a feature matrix details page directly, or due to an
old details pages with a description being converted to just a
link.

This ensures that such pages can have a clickable link to attempt
to create a better user experience. Doing so from the Django
template filters is a bit roundabout, but it does get the desired
effect.

templates/featurematrix/featuredetail.html

index 8472277b47a133f8ff875fbda386a5c75c10c33f..717eab8aeca92e8586afe034c96cf025b354be34 100644 (file)
@@ -5,6 +5,10 @@
 <h1>Feature Description</h1>
 <h2>{{feature.featurename}}</h2>
 <p>
-{{feature.featuredescription|markdown:"safe"}}
+{% if feature.featurelink|truncatechars:4 == "http" %}
+  For more information, please visit : <a href="{{ feature.featurelink }}">{{ feature.featurelink }}</a>
+{% else %}
+  {{ feature.featuredescription|markdown:"safe" }}
+{% endif %}
 </p>
 {%endblock%}