quetre/views/pug/pages/topic.pug
zyachel 595b720ee1 fix: fix outgoing url on error page
also refactor some related code
2023-01-15 21:41:09 +05:30

62 lines
2.7 KiB
Text

//-//////////////////////////////////////////////////////
//- INCLUDES/EXTENDS
//-//////////////////////////////////////////////////////
extends ../base
include ../mixins/_metadata
include ../mixins/_utils
//-//////////////////////////////////////////////////////
//- MAIN CONTENT
//-//////////////////////////////////////////////////////
block content
main#main.main.topic
//- TOPIC NAME AND METADATA
section.topic__stats.topic-stats
.metadata-primary
h1.heading.heading__primary.metadata-primary__heading.topic__name= data.name
+proxifyImg(data.image)(class='metadata-primary__image', alt='', aria-hidden='true')
p.metadata-primary__misc
if data.aliases.length
span Also known as: 
span= data.aliases.join(', ')
.metadata-secondary
+addMetadataSecondary('user','Followers', data.numFollowers)
+addMetadataSecondary('question','Questions', data.numQuestions)
if data.isAdult
+addMetadataSecondary('danger', 'Adult Topic', '18+', true)
+quorafyUrl(meta.url)(class='link')
//- AUTHORS RELATED TO THE TOPIC AND METADATA
.topic__famous-authors.famous-authors
h2.heading.heading__secondary Most viewed authors
.famous-authors__list
each author in data.mostViewedAuthors
.famous-authors__item
.metadata-primary
p.metadata-primary__heading
if author.isAnon
span Anonymous
else
a.link(href=author.profile)= author.name
if author.isVerified
svg.icon.metadata-primary__icon
title verified
use(href='/misc/sprite.svg#icon-verified')
+proxifyImg(author.image)(class='metadata-primary__image', alt='', aria-hidden='true')
p.metadata-primary__misc(aria-label=`${author.name}'s credentials`)= author.credential || ''
.metadata-secondary
+addMetadataSecondary('user', 'Followers', author.numFollowers)
+addMetadataSecondary('eye', 'Views', author.numViews)
+addMetadataSecondary('comments', 'Answers', author.numAnswers)
//- RELATED TOPICS
.topic__related-topics.related-topics
h2.heading.heading__secondary Related Topics
.related-topics__list
each topic in data.relatedTopics
.metadata-primary
a.link.metadata-primary__heading(href=topic.url)= topic.name
+proxifyImg(topic.image)(class='metadata-primary__image', aria-hidden='true', alt='')
p.metadata-primary__misc
+formatNumber(topic.numFollowers)
| Followers