refactor: the author of the post uses the owner field

Fixes https://github.com/halo-dev/theme-earth/issues/18
This commit is contained in:
Ryan Wang
2022-11-16 10:52:33 +08:00
parent 58fb80b0e2
commit f260f28db2
4 changed files with 22 additions and 22 deletions

View File

@@ -39,17 +39,17 @@
<a th:href="@{${post.status.permalink}}" th:text="${post.spec.title}"></a>
</h1>
<p class="font-sm font-light line-clamp-6 dark:text-slate-200" th:text="${post.status.excerpt}"></p>
<div class="mt-4 flex flex-1 items-center justify-start gap-2" th:with="contributor = ${post.contributors[0]}">
<div class="mt-4 flex flex-1 items-center justify-start gap-2">
<img
th:src="${contributor.avatar ?: #theme.assets('/images/default-avatar.svg')}"
th:title="${contributor.displayName}"
th:alt="${contributor.displayName}"
th:src="${post.owner.avatar ?: #theme.assets('/images/default-avatar.svg')}"
th:title="${post.owner.displayName}"
th:alt="${post.owner.displayName}"
class="h-8 w-8 rounded-full border drop-shadow-sm dark:border-slate-700"
/>
<span
class="text-sm font-medium text-gray-900 dark:text-slate-100"
th:if="${#strings.isEmpty(contributor.avatar)}"
th:text="${contributor.displayName}"
th:if="${#strings.isEmpty(post.owner.avatar)}"
th:text="${post.owner.displayName}"
></span>
<span
class="text-sm tabular-nums text-gray-600 dark:text-slate-300"

View File

@@ -57,17 +57,17 @@
th:text="${post.status.excerpt}"
th:classappend="${list_layout == 'grid_3' ? ' sm:line-clamp-8' : ''}"
></p>
<div class="mt-4 flex flex-1 items-center justify-start gap-2" th:with="contributor = ${post.contributors[0]}">
<div class="mt-4 flex flex-1 items-center justify-start gap-2">
<img
th:src="${contributor.avatar ?: #theme.assets('/images/default-avatar.svg')}"
th:title="${contributor.displayName}"
th:alt="${contributor.displayName}"
th:src="${post.owner.avatar ?: #theme.assets('/images/default-avatar.svg')}"
th:title="${post.owner.displayName}"
th:alt="${post.owner.displayName}"
class="h-8 w-8 rounded-full border drop-shadow-sm dark:border-slate-700"
/>
<span
class="text-sm font-medium text-gray-900 dark:text-slate-100"
th:if="${#strings.isEmpty(contributor.avatar)}"
th:text="${contributor.displayName}"
th:if="${#strings.isEmpty(post.owner.avatar)}"
th:text="${post.owner.displayName}"
></span>
<span
class="text-sm tabular-nums text-gray-600 dark:text-slate-300"

View File

@@ -11,17 +11,17 @@
<th:block th:fragment="content">
<div class="rounded-xl bg-white p-4 dark:bg-slate-800">
<div class="flex items-center justify-between">
<div class="inline-flex items-center justify-start gap-2" th:with="contributor = ${singlePage.contributors[0]}">
<div class="inline-flex items-center justify-start gap-2">
<img
th:if="${not #strings.isEmpty(contributor.avatar)}"
th:src="${contributor.avatar}"
th:alt="${contributor.displayName}"
th:if="${not #strings.isEmpty(singlePage.owner.avatar)}"
th:src="${singlePage.owner.avatar}"
th:alt="${singlePage.owner.displayName}"
class="h-10 w-10 rounded-full"
/>
<div class="flex flex-col gap-0.5">
<span
class="text-sm font-semibold text-gray-900 dark:text-slate-100"
th:text="${contributor.displayName}"
th:text="${singlePage.owner.displayName}"
></span>
<div class="flex items-center gap-2 text-xs font-light text-gray-600 dark:text-slate-100">
<span th:text="${'发布于 '+#dates.format(singlePage.spec.publishTime,'yyyy-MM-dd')}"></span>

View File

@@ -30,17 +30,17 @@
<th:block th:fragment="content">
<div class="rounded-xl bg-white p-4 dark:bg-slate-800">
<div class="flex items-center justify-between">
<div class="inline-flex items-center justify-start gap-2" th:with="contributor = ${post.contributors[0]}">
<div class="inline-flex items-center justify-start gap-2">
<img
th:if="${not #strings.isEmpty(contributor.avatar)}"
th:src="${contributor.avatar}"
th:if="${not #strings.isEmpty(post.owner.avatar)}"
th:src="${post.owner.avatar}"
class="h-10 w-10 rounded-full"
th:alt="${contributor.displayName}"
th:alt="${post.owner.displayName}"
/>
<div class="flex flex-col gap-0.5">
<span
class="text-sm font-semibold text-gray-900 dark:text-slate-100"
th:text="${contributor.displayName}"
th:text="${post.owner.displayName}"
></span>
<div class="flex items-center gap-2 text-xs font-light text-gray-600 dark:text-slate-100">
<span th:text="${'发布于 '+#dates.format(post.spec.publishTime,'yyyy-MM-dd')}"></span>