From 27533483b2c50a635d807fe8862485974dd6d4df Mon Sep 17 00:00:00 2001
From: rr- <rr-@sakuya.pl>
Date: Tue, 10 May 2016 14:06:52 +0200
Subject: [PATCH] client/tags: make headers clickable

---
 client/css/tags.styl          |  2 ++
 client/html/tag_list_page.hbs | 32 ++++++++++++++++++++++++++++----
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/client/css/tags.styl b/client/css/tags.styl
index 5f4af2e..db56f79 100644
--- a/client/css/tags.styl
+++ b/client/css/tags.styl
@@ -10,6 +10,8 @@
             background: $top-nav-color
         th, td
             padding: 0.1em 0.5em
+        th
+            background: $top-nav-color
         .names
             width: 30%
         .implications
diff --git a/client/html/tag_list_page.hbs b/client/html/tag_list_page.hbs
index 2243866..3f9a487 100644
--- a/client/html/tag_list_page.hbs
+++ b/client/html/tag_list_page.hbs
@@ -2,10 +2,34 @@
     <% if (results) { %>
         <table>
             <thead>
-                <th class='names'>Tag name(s)</th>
-                <th class='implications'>Implications</th>
-                <th class='suggestions'>Suggestions</th>
-                <th class='usages'>Usages</th>
+                <th class='names'>
+                    <% if (query == 'sort:name' || !query) { %>
+                        <a href='/tags/text=-sort:name'>Tag name(s)</a>
+                    <% } else { %>
+                        <a href='/tags/text=sort:name'>Tag name(s)</a>
+                    <% } %>
+                </th>
+                <th class='implications'>
+                    <% if (query == 'sort:implication-count') { %>
+                        <a href='/tags/text=-sort:implication-count'>Implications</a>
+                    <% } else { %>
+                        <a href='/tags/text=sort:implication-count'>Implications</a>
+                    <% } %>
+                </th>
+                <th class='suggestions'>
+                    <% if (query == 'sort:suggestion-count') { %>
+                        <a href='/tags/text=-sort:suggestion-count'>Suggestions</a>
+                    <% } else { %>
+                        <a href='/tags/text=sort:suggestion-count'>Suggestions</a>
+                    <% } %>
+                </th>
+                <th class='usages'>
+                    <% if (query == 'sort:usages') { %>
+                        <a href='/tags/text=-sort:usages'>Usages</a>
+                    <% } else { %>
+                        <a href='/tags/text=sort:usages'>Usages</a>
+                    <% } %>
+                </th>
             </thead>
             <tbody>
                 <% _.each(results, tag => { %>