Browse Source

Move link topic domain to topic footer in listings

This tests rearranging the info shown on link topics in listings a
little, including no longer showing the name of the submitter of links
in listings at all. The domain (previously shown after the title in
parentheses) is moved into the space previously showing the submitter's
name, and we start showing the word count for link topics in that space
when we have it (which is most of the time).
merge-requests/55/head
Deimos 6 years ago
parent
commit
7b2eafdb63
  1. 5
      tildes/scss/modules/_topic.scss
  2. 5
      tildes/tildes/models/topic/topic.py
  3. 6
      tildes/tildes/templates/macros/topics.jinja2

5
tildes/scss/modules/_topic.scss

@ -193,11 +193,10 @@
.topic-info {
display: grid;
grid-auto-columns: 1fr;
grid-auto-flow: column;
grid-template-columns: 1fr 1.2fr 1fr;
grid-column-gap: 0.4rem;
max-width: 30rem;
max-width: 32rem;
margin-top: 0.2rem;
white-space: nowrap;

5
tildes/tildes/models/topic/topic.py

@ -379,16 +379,15 @@ class Topic(DatabaseModel):
# pylint: disable=too-many-branches
metadata_strings = []
if self.is_text_type:
# display word count (if we have it) with either type of topic
word_count = self.get_content_metadata("word_count")
if word_count is not None:
if word_count == 1:
metadata_strings.append("1 word")
else:
metadata_strings.append(f"{word_count} words")
elif self.is_link_type:
metadata_strings.append(f"{self.link_domain}")
if self.is_link_type:
# display the published date if it's more than 3 days before the topic
published_timestamp = self.get_content_metadata("published")
if published_timestamp:

6
tildes/tildes/templates/macros/topics.jinja2

@ -28,7 +28,9 @@
>{{ topic.title }}</a>
{% endif %}
</h1>
{% if topic.content_metadata_for_display %}
<span class="topic-content-metadata">({{ topic.content_metadata_for_display }})</span>
{% endif %}
</div>
</header>
@ -74,7 +76,11 @@
</a>
</div>
{% if topic.is_text_type %}
<div aria-label="Posted by">{{ username_linked(topic.user.username) }}</div>
{% elif topic.is_link_type %}
<div aria-label="Link domain">{{ topic.link_domain }}</div>
{% endif %}
<div aria-label="Post time">{{ adaptive_date_responsive(topic.created_time) }}</div>
</footer>

Loading…
Cancel
Save