From 7b2eafdb63ffda4068698ff7714ccb63d70c5b2b Mon Sep 17 00:00:00 2001 From: Deimos Date: Wed, 30 Jan 2019 17:03:10 -0700 Subject: [PATCH] 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). --- tildes/scss/modules/_topic.scss | 5 ++--- tildes/tildes/models/topic/topic.py | 19 +++++++++---------- tildes/tildes/templates/macros/topics.jinja2 | 10 ++++++++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/tildes/scss/modules/_topic.scss b/tildes/scss/modules/_topic.scss index 929e433..3c1647d 100644 --- a/tildes/scss/modules/_topic.scss +++ b/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; diff --git a/tildes/tildes/models/topic/topic.py b/tildes/tildes/models/topic/topic.py index fb926be..5c84426 100644 --- a/tildes/tildes/models/topic/topic.py +++ b/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: - 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}") - + # 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") + + 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: diff --git a/tildes/tildes/templates/macros/topics.jinja2 b/tildes/tildes/templates/macros/topics.jinja2 index aeca60a..20e3f72 100644 --- a/tildes/tildes/templates/macros/topics.jinja2 +++ b/tildes/tildes/templates/macros/topics.jinja2 @@ -28,7 +28,9 @@ >{{ topic.title }} {% endif %} - ({{ topic.content_metadata_for_display }}) + {% if topic.content_metadata_for_display %} + ({{ topic.content_metadata_for_display }}) + {% endif %} @@ -74,7 +76,11 @@ -
{{ username_linked(topic.user.username) }}
+ {% if topic.is_text_type %} +
{{ username_linked(topic.user.username) }}
+ {% elif topic.is_link_type %} +
{{ topic.link_domain }}
+ {% endif %}
{{ adaptive_date_responsive(topic.created_time) }}