From 4ae19c6fa773ab1b0fb96a3beecb2778fd52477c Mon Sep 17 00:00:00 2001 From: Stephen Burgess Date: Mon, 11 Jun 2018 18:30:31 -0500 Subject: [PATCH 1/6] feat(Posts): Show username if no display name is present --- templates/posts/details.html.tera | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/templates/posts/details.html.tera b/templates/posts/details.html.tera index 5c658d37..e126f223 100644 --- a/templates/posts/details.html.tera +++ b/templates/posts/details.html.tera @@ -9,8 +9,13 @@ {% endblock header %} {% block content %} +{% if author.display_name %} + {% set name = author.display_name %} +{% else %} + {% set name = author.username %} +{% endif %}

- Written by {{ author.display_name }} + Written by {{name }}{{ date | date(format="%B %e, %Y") }}

@@ -49,8 +54,13 @@

Comments

{% for comment in comments %} + {% if comment.author.display_name %} + {% set commentAuthorName = comment.author.display_name %} + {% else %} + {% set commentAuthorName = comment.author.username %} + {% endif %}
- {{ comment.author.display_name }} + {{ name }}
{{ comment.content | safe }}
Respond
From 4b0114917d603c7ed204aeabcb2967106351be37 Mon Sep 17 00:00:00 2001 From: Stephen Burgess Date: Mon, 11 Jun 2018 18:31:44 -0500 Subject: [PATCH 2/6] chore(Posts): Fix typo --- templates/posts/details.html.tera | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/posts/details.html.tera b/templates/posts/details.html.tera index e126f223..1935da0c 100644 --- a/templates/posts/details.html.tera +++ b/templates/posts/details.html.tera @@ -15,7 +15,7 @@ {% set name = author.username %} {% endif %}

- Written by {{name }} + Written by {{ name }}{{ date | date(format="%B %e, %Y") }}

From df0fcb886d19a756986ddd97bc9810d1317e1ed1 Mon Sep 17 00:00:00 2001 From: Stephen Burgess Date: Tue, 12 Jun 2018 07:17:02 -0500 Subject: [PATCH 3/6] feat(UI): Fallback to username where ever display name is shown --- templates/macros.html.tera | 7 ++++++- templates/posts/details.html.tera | 6 +++--- templates/users/details.html.tera | 8 ++++++-- templates/users/followers.html.tera | 17 ++++++++++++++--- 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/templates/macros.html.tera b/templates/macros.html.tera index 49432656..900f96c3 100644 --- a/templates/macros.html.tera +++ b/templates/macros.html.tera @@ -1,7 +1,12 @@ {% macro post_card(article) %} +{% if article.author.display_name %} + {% set name = article.author.display_name %} +{% else %} + {% set name = article.author.username %} +{% endif %}

{{ article.post.title }}

{{ article.post.content | striptags | truncate(length=200) }}

-

By {{ article.author.display_name }} ⋅ {{ article.date | date(format="%B %e") }}

+

By {{ name }} ⋅ {{ article.date | date(format="%B %e") }}

{% endmacro post_card %} diff --git a/templates/posts/details.html.tera b/templates/posts/details.html.tera index 1935da0c..13e3e5ab 100644 --- a/templates/posts/details.html.tera +++ b/templates/posts/details.html.tera @@ -55,12 +55,12 @@
{% for comment in comments %} {% if comment.author.display_name %} - {% set commentAuthorName = comment.author.display_name %} + {% set comment_author_name = comment.author.display_name %} {% else %} - {% set commentAuthorName = comment.author.username %} + {% set comment_author_name = comment.author.username %} {% endif %}
- {{ name }} + {{ comment_author_name }}
{{ comment.content | safe }}
Respond
diff --git a/templates/users/details.html.tera b/templates/users/details.html.tera index d225a300..1eb6325d 100644 --- a/templates/users/details.html.tera +++ b/templates/users/details.html.tera @@ -2,13 +2,17 @@ {% import "macros" as macros %} {% block title %} -{{ user.display_name }} +{% if author.display_name %} + {% set name = author.display_name %} +{% else %} + {% set name = user.username %} +{% endif %} {% endblock title %} {% block content %}

- {{ user.display_name }} + {{ name }} {% if user.is_admin %} Admin {% endif %} diff --git a/templates/users/followers.html.tera b/templates/users/followers.html.tera index 5d6a956e..9b0bdf28 100644 --- a/templates/users/followers.html.tera +++ b/templates/users/followers.html.tera @@ -1,13 +1,19 @@ {% extends "base" %} {% block title %} -{{ user.display_name }}'s Followers +{% if user.display_name %} + {% set name = user.display_name %} +{% else %} + {% set name = user.username %} +{% endif %} + +{{ name }}'s Followers {% endblock title %} {% block content %}

- {{ user.display_name }} + {{ name }} {% if user.is_admin %} Admin {% endif %} @@ -21,8 +27,13 @@

Followers

{% for follower in followers %} + {% if follower.display_name %} + {% set follower_name = follower.display_name %} + {% else %} + {% set follower_name = follower.username %} + {% endif %}
-

{{ follower.display_name }} — @{{ follower.fqn }}

+

{{ follower_name }} — @{{ follower.fqn }}

{{ follower.summary | safe }}

{% endfor %} From 23bb405c92d98a6b0c3966090f865376a2ce27dc Mon Sep 17 00:00:00 2001 From: Stephen Burgess Date: Tue, 12 Jun 2018 07:42:34 -0500 Subject: [PATCH 4/6] fix(User/Details): Use user variable --- templates/users/details.html.tera | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/users/details.html.tera b/templates/users/details.html.tera index 1eb6325d..6e091c35 100644 --- a/templates/users/details.html.tera +++ b/templates/users/details.html.tera @@ -2,8 +2,8 @@ {% import "macros" as macros %} {% block title %} -{% if author.display_name %} - {% set name = author.display_name %} +{% if user.display_name %} + {% set name = user.display_name %} {% else %} {% set name = user.username %} {% endif %} From d32c7e4b66ea85032155ea9d7722ddb8a89adca9 Mon Sep 17 00:00:00 2001 From: Stephen Burgess Date: Tue, 12 Jun 2018 07:45:53 -0500 Subject: [PATCH 5/6] fix(User/Details): Display name --- templates/users/details.html.tera | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/users/details.html.tera b/templates/users/details.html.tera index 6e091c35..15d44045 100644 --- a/templates/users/details.html.tera +++ b/templates/users/details.html.tera @@ -7,6 +7,7 @@ {% else %} {% set name = user.username %} {% endif %} +{{ name }} {% endblock title %} {% block content %} From 438778db398c5b0700683ea25ba52928afac05f4 Mon Sep 17 00:00:00 2001 From: Stephen Burgess Date: Tue, 12 Jun 2018 12:05:33 -0500 Subject: [PATCH 6/6] fix(Style): Adjust code style for consistency --- templates/macros.html.tera | 10 +++++----- templates/posts/details.html.tera | 3 ++- templates/users/details.html.tera | 3 ++- templates/users/followers.html.tera | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/templates/macros.html.tera b/templates/macros.html.tera index 900f96c3..3cce7285 100644 --- a/templates/macros.html.tera +++ b/templates/macros.html.tera @@ -1,9 +1,9 @@ {% macro post_card(article) %} -{% if article.author.display_name %} - {% set name = article.author.display_name %} -{% else %} - {% set name = article.author.username %} -{% endif %} + {% if article.author.display_name %} + {% set name = article.author.display_name %} + {% else %} + {% set name = article.author.username %} + {% endif %}

{{ article.post.title }}

{{ article.post.content | striptags | truncate(length=200) }}

diff --git a/templates/posts/details.html.tera b/templates/posts/details.html.tera index 13e3e5ab..52e71b30 100644 --- a/templates/posts/details.html.tera +++ b/templates/posts/details.html.tera @@ -8,12 +8,13 @@ {{ blog.title }} {% endblock header %} -{% block content %} {% if author.display_name %} {% set name = author.display_name %} {% else %} {% set name = author.username %} {% endif %} + +{% block content %}

Written by {{ name }} — diff --git a/templates/users/details.html.tera b/templates/users/details.html.tera index 15d44045..51d6f94e 100644 --- a/templates/users/details.html.tera +++ b/templates/users/details.html.tera @@ -1,12 +1,13 @@ {% extends "base" %} {% import "macros" as macros %} -{% block title %} {% if user.display_name %} {% set name = user.display_name %} {% else %} {% set name = user.username %} {% endif %} + +{% block title %} {{ name }} {% endblock title %} diff --git a/templates/users/followers.html.tera b/templates/users/followers.html.tera index 9b0bdf28..595f6ae1 100644 --- a/templates/users/followers.html.tera +++ b/templates/users/followers.html.tera @@ -1,12 +1,12 @@ {% extends "base" %} -{% block title %} {% if user.display_name %} {% set name = user.display_name %} {% else %} {% set name = user.username %} {% endif %} +{% block title %} {{ name }}'s Followers {% endblock title %}