Skip to content

Commit 62db6a1

Browse files
committed
Refactor tool list item templates for improved URL handling
- Updated _tool_categorized_list_item.html, _tool_grid_list_item.html, and _tool_vertical_list_item.html to conditionally render tool URLs, allowing for clickable rows and cards. - Simplified the display logic for tool names and descriptions, ensuring consistent styling and behavior across different list formats. - Enhanced accessibility by adding cursor pointer styles for clickable elements.
1 parent ec7e44c commit 62db6a1

File tree

3 files changed

+25
-40
lines changed

3 files changed

+25
-40
lines changed

templates/libraries/_tool_categorized_list_item.html

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-200 ease-in-out">
1+
{% if tool.url %}
2+
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-200 ease-in-out cursor-pointer" onclick="window.open('{{ tool.url }}', '_blank', 'noopener,noreferrer')">
3+
{% else %}
4+
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-200 ease-in-out">
5+
{% endif %}
26
<td class="py-2 align-top md:w-1/5">
3-
{% if tool.url %}
4-
<a class="mr-1 font-bold capitalize text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange"
5-
href="{{ tool.url }}" target="_blank" rel="noopener noreferrer">{{ tool.name }}</a>
6-
{% else %}
7-
<span class="mr-1 font-bold capitalize text-sky-600 dark:text-sky-300">{{ tool.name }}</span>
8-
{% endif %}
7+
<span class="mr-1 font-bold capitalize text-sky-600 dark:text-sky-300">{{ tool.name }}</span>
98
</td>
109

1110
<td class="w-12 align-top pt-2.5 pr-2">
@@ -15,13 +14,9 @@
1514
{# Empty cell for alignment with library rows #}
1615
</td>
1716
<td class="w-8 text-center align-top">
18-
{% if tool.url %}
19-
<a class="text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange text-base block py-3 text-center" href="{{ tool.url }}" target="_blank" rel="noopener noreferrer" title="Website">
20-
<i class="fa fa-globe align-top"></i>
21-
</a>
22-
{% endif %}
17+
{# Empty cell for alignment with library rows #}
2318
</td>
24-
<td class="hidden md:block py-2 pl-3 align-top">{{ tool.description }}</td>
19+
<td class="hidden md:block py-2 pl-3 align-top" style="min-height: 3rem;">{{ tool.description }}</td>
2520
</tr>
2621
<tr class="block md:hidden">
2722
<td>{{ tool.description }}</td>
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
{% load static %}
22

3-
<div class="relative content-between p-3 bg-white md:rounded-lg md:shadow-lg md:p-5 dark:bg-charcoal hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-200 ease-in-out">
3+
{% if tool.url %}
4+
<a href="{{ tool.url }}" target="_blank" rel="noopener noreferrer" class="block h-full">
5+
{% endif %}
6+
<div class="relative flex flex-col h-full p-3 bg-white md:rounded-lg md:shadow-lg md:p-5 dark:bg-charcoal hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-200 ease-in-out {% if tool.url %}cursor-pointer{% endif %}">
47
<div class="">
58
<h3 class="pb-2 text-xl md:text-2xl capitalize border-b border-gray-700">
6-
<div class="flex justify-between">
7-
{% if tool.url %}
8-
<a class="link-header" href="{{ tool.url }}" target="_blank" rel="noopener noreferrer">{{ tool.name }}</a>
9-
{% else %}
10-
<span class="link-header">{{ tool.name }}</span>
11-
{% endif %}
12-
{% if tool.url %}
13-
<a class="text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange text-base block py-3 text-center" href="{{ tool.url }}" target="_blank" rel="noopener noreferrer" title="Website">
14-
<i class="fa fa-globe align-top"></i>
15-
</a>
16-
{% endif %}
17-
</div>
9+
<span class="link-header">{{ tool.name }}</span>
1810
</h3>
1911
</div>
20-
<div class="mb-3 pb-3">
12+
<div class="mb-3 pb-3 flex-grow">
2113
<p class="mb-3 text-gray-700 dark:text-gray-300">{{ tool.description }}</p>
2214
</div>
2315
</div>
16+
{% if tool.url %}
17+
</a>
18+
{% endif %}

templates/libraries/_tool_vertical_list_item.html

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-300 ease-in-out">
1+
{% if tool.url %}
2+
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-300 ease-in-out cursor-pointer" onclick="window.open('{{ tool.url }}', '_blank', 'noopener,noreferrer')">
3+
{% else %}
4+
<tr class="border-0 md:border border-gray-200/10 border-dotted md:border-t-0 md:border-r-0 md:border-l-0 md:border-b-1 hover:bg-gray-100 dark:hover:bg-gray-700 transition-all duration-300 ease-in-out">
5+
{% endif %}
26
<td class="align-top md:w-1/5 pt-3">
3-
{% if tool.url %}
4-
<a class="mr-1 pl-1 font-bold capitalize text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange"
5-
href="{{ tool.url }}" target="_blank" rel="noopener noreferrer">{{ tool.name }}</a>
6-
{% else %}
7-
<span class="mr-1 pl-1 font-bold capitalize text-sky-600 dark:text-sky-300">{{ tool.name }}</span>
8-
{% endif %}
7+
<span class="mr-1 pl-1 font-bold capitalize text-sky-600 dark:text-sky-300">{{ tool.name }}</span>
98
</td>
109
<td class="w-12 align-top pt-3 pr-2">
1110
{# Empty cell for alignment with library rows #}
@@ -14,13 +13,9 @@
1413
{# Empty cell for alignment with library rows #}
1514
</td>
1615
<td class="w-8 align-top">
17-
{% if tool.url %}
18-
<a class="text-sky-600 dark:text-sky-300 hover:text-orange dark:hover:text-orange text-base block py-3 text-center" href="{{ tool.url }}" target="_blank" rel="noopener noreferrer" title="Website">
19-
<i class="fa fa-globe align-top"></i>
20-
</a>
21-
{% endif %}
16+
{# Empty cell for alignment with library rows #}
2217
</td>
23-
<td class="align-top hidden md:block mt-2 pl-3 md:items-center h-full">{{ tool.description }}</td>
18+
<td class="align-top hidden md:block mt-2 pl-3 md:items-center" style="min-height: 3rem;">{{ tool.description }}</td>
2419
</tr>
2520
<tr class="block md:hidden pl-1 align-top">
2621
<td>{{ tool.description }}</td>

0 commit comments

Comments
 (0)