# 更改视图以创建日期？

**URL:** https://meta.discourse.org/t/changing-views-to-creating-date/253460
**Category:** UX
**Created:** [2023年一月31日 07:44 UTC](https://meta.discourse.org/t/changing-views-to-creating-date/253460 "2023-01-31T07:44:59Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [2023年三月25日 00:57 UTC](https://meta.discourse.org/t/changing-views-to-creating-date/253460/2 "2023-03-25T00:57:21Z")

</div>

你好 Jakke,

不确定你是否还需要这个，但这是你要找的！  
你可以通过覆盖相关的模板来替换“views”列（[topic-list-header](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/templates/topic-list-header.hbr) 和 [topic-list-item](https://github.com/discourse/discourse/blob/main/app/assets/javascripts/discourse/app/templates/list/topic-list-item.hbr)）。

不幸的是，它有一个缺点，就是你必须复制粘贴大量的原始代码，这可能会根据你的主题/插件/组件而无法正常工作。另外，如果 Discourse 更新了这些部分，你可能也需要更新它。

这是你可以复制粘贴到 [component](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966#create-new-themes-and-theme-components-7) 中的代码：

> **Head**
>
> ```js
> 
> <script type='text/x-handlebars' data-template-name='topic-list-header.raw'>
> {{raw-plugin-outlet name="topic-list-header-before"}}
> {{#if bulkSelectEnabled}}
> <th class="bulk-select topic-list-data">
> {{#if canBulkSelect}}
> {{raw "flat-button" class="bulk-select" icon="list" title="topics.bulk.toggle"}}
> {{/if}}
> </th>
> {{/if}}
> {{raw "topic-list-header-column" order='default' name=listTitle bulkSelectEnabled=bulkSelectEnabled showBulkToggle=toggleInTitle canBulkSelect=canBulkSelect canDoBulkActions=canDoBulkActions}}
> {{raw-plugin-outlet name="topic-list-header-after-main-link"}}
> {{#if showPosters}}
> {{raw "topic-list-header-column" order='posters' ariaLabel=(i18n "category.sort_options.posters")}}
> {{/if}}
> {{raw "topic-list-header-column" sortable=sortable number='true' order='posts' name='replies' ariaLabel=(i18n "sr_replies")}}
> {{#if showLikes}}
> {{raw "topic-list-header-column" sortable=sortable number='true' order='likes' name='likes' ariaLabel=(i18n "sr_likes")}}
> {{/if}}
> {{#if showOpLikes}}
> {{raw "topic-list-header-column" sortable=sortable number='true' order='op_likes' name='likes' ariaLabel=(i18n "sr_op_likes")}}
> {{/if}}
> {{raw "topic-list-header-column" sortable=sortable number='true' order='created' name='created' ariaLabel=(i18n "sr_created")}}
> {{raw "topic-list-header-column" sortable=sortable number='true' order='activity' name='activity' ariaLabel=(i18n "sr_activity")}}
> {{raw-plugin-outlet name="topic-list-header-after"}}
> </script>
> 
> <script type='text/x-handlebars' data-template-name='list/topic-list-item.raw'>
> {{raw-plugin-outlet name="topic-list-before-columns"}}
>     
> {{#if bulkSelectEnabled}}
> <td class="bulk-select topic-list-data">
> <label for="bulk-select-{{topic.id}}">
> <input type="checkbox" class="bulk-select" id="bulk-select-{{topic.id}}">
> </label>
> </td>
> {{/if}}
>     
> {{!--
> The `~` syntax strip spaces between the elements, making it produce
> `<a>Some text</span>`
> with no space between them.
> This causes the topic-post-badge to be considered the same word as "text"
> at the end of the link, preventing it from line wrapping onto its own line.
> --}}
> <td class='main-link clearfix topic-list-data' colspan="1">
> {{raw-plugin-outlet name="topic-list-before-link"}}
> <span class='link-top-line'>
> {{raw-plugin-outlet name="topic-list-before-status"}}
> {{raw "topic-status" topic=topic}}
> {{topic-link topic class="raw-link raw-topic-link"}}
> {{#if topic.featured_link}}
> {{topic-featured-link topic}}
> {{/if}}
> {{raw-plugin-outlet name="topic-list-after-title"}}
> {{raw "list/unread-indicator" includeUnreadIndicator=includeUnreadIndicator
> topicId=topic.id
> unreadClass=unreadClass}}
> {{#if showTopicPostBadges}}
> {{raw "topic-post-badges" unreadPosts=topic.unread_posts unseen=topic.unseen url=topic.lastUnreadUrl newDotText=newDotText}}
> {{/if}}
> </span>
> <div class="link-bottom-line">
> {{#unless hideCategory}}
> {{#unless topic.isPinnedUncategorized}}
> {{raw-plugin-outlet name="topic-list-before-category"}}
> {{category-link topic.category}}
> {{/unless}}
> {{/unless}}
> {{discourse-tags topic mode="list" tagsForUser=tagsForUser}}
> {{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
> </div>
> {{#if expandPinned}}
> {{raw "list/topic-excerpt" topic=topic}}
> {{/if}}
>     
> {{raw-plugin-outlet name="topic-list-main-link-bottom"}}
> </td>
>     
> {{raw-plugin-outlet name="topic-list-after-main-link"}}
>     
> {{#if showPosters}}
> {{raw "list/posters-column" posters=topic.featuredUsers}}
> {{/if}}
>     
> {{raw "list/posts-count-column" topic=topic}}
>     
> {{#if showLikes}}
> <td class="num likes topic-list-data">
> {{#if hasLikes}}
> <a href='{{topic.summaryUrl}}'>
> {{number topic.like_count}} {{d-icon "heart"}}
> </a>
> {{/if}}
> </td>
> {{/if}}
>     
> {{#if showOpLikes}}
> <td class="num likes">
> {{#if hasOpLikes}}
> <a href='{{topic.summaryUrl}}'>
> {{number topic.op_like_count}} {{d-icon "heart"}}
> </a>
> {{/if}}
> </td>
> {{/if}}
> 
> <td class="num topic-list-data {{cold-age-class topic.createdAt startDate=topic.bumpedAt class=""}} activity" title="{{html-safe topic.bumpedAtTitle}}">
> <a class="post-activity" href="{{topic.url}}">
> {{raw-plugin-outlet name="topic-list-before-relative-date"}}
> {{format-date topic.createdAt format="tiny" noTitle="true"}}
> </a>
> </td>
> 
> {{raw "list/activity-column" topic=topic class="num topic-list-data" tagName="td"}}
> </script>
> 
> ```

* * *

 ![image](https://global.discourse-cdn.com/meta/original/4X/0/b/2/0b28857776cc170b86223e19210e2974210ec934.png)

_注意：它在悬停时的标题与“Activity”相同，单击日期会重定向到帖子的开头。_

---

_[View the full topic](https://meta.discourse.org/t/changing-views-to-creating-date/253460)._
