From 847d4ab7cb577c8e1292af3cc72b56f11091b61f Mon Sep 17 00:00:00 2001 From: Digitalcraftsman Date: Fri, 16 Oct 2020 09:05:21 -0700 Subject: [PATCH] Link categories in threadlist on homepage --- public/css/nimforum.scss | 10 ++++++++++ src/frontend/category.nim | 3 ++- tests/browsertests/categories.nim | 6 +++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/public/css/nimforum.scss b/public/css/nimforum.scss index 2daecdb0..0f06fe90 100644 --- a/public/css/nimforum.scss +++ b/public/css/nimforum.scss @@ -143,6 +143,16 @@ $logo-height: $navbar-height - 20px; white-space: nowrap; } +.category-name { + a:link, + a:hover, + a:active, + a:visited { + color: $body-font-color; + text-decoration: none; + } +} + #new-thread { .modal-container .modal-body { max-height: none; diff --git a/src/frontend/category.nim b/src/frontend/category.nim index 314720d4..76cf59d8 100644 --- a/src/frontend/category.nim +++ b/src/frontend/category.nim @@ -39,7 +39,8 @@ when defined(js): kstring"0.25rem solid #" & category.color) )) span(class="category-name"): - text category.name + a(href=makeUri("/c/" & $category.id)): + text category.name if not compact: span(class="topic-count"): text "× " & $category.numTopics diff --git a/tests/browsertests/categories.nim b/tests/browsertests/categories.nim index 8c27a87a..139eed8d 100644 --- a/tests/browsertests/categories.nim +++ b/tests/browsertests/categories.nim @@ -137,18 +137,18 @@ proc categoriesUserTests(session: Session, baseUrl: string) = click "#category-unsorted" checkText "#threads-list .thread-title a", "Post 3" - for element in session.waitForElements("#threads-list .category-name"): + for element in session.waitForElements("#threads-list .category-name a"): # Have to user "innerText" because elements are hidden on this page assert element.getProperty("innerText") == "Unsorted" selectCategory "announcements" checkText "#threads-list .thread-title a", "Post 2" - for element in session.waitForElements("#threads-list .category-name"): + for element in session.waitForElements("#threads-list .category-name a"): assert element.getProperty("innerText") == "Announcements" selectCategory "fun" checkText "#threads-list .thread-title a", "Post 1" - for element in session.waitForElements("#threads-list .category-name"): + for element in session.waitForElements("#threads-list .category-name a"): assert element.getProperty("innerText") == "Fun" session.logout()