뷰를 생성일로 변경할 수 있나요?

/latest (그리고 다른 모든 것)은 다음과 같은 형태입니다:

Replies는 주제의 활성도를, Activity는 마지막으로 활동이 발생한 시점을 나타냅니다. 이 둘은 유용한 데이터입니다. 하지만 Views는… 관리자나 주제 작성자(OP)에게는 흥미로운 값일 수 있지만, 일반 사용자에게는 아무런 가치가 없습니다. 그들은 이를 보고 “이렇게 적은 수의 사람이 열었으니 흥미로운 주제가 아니겠구나”(또는 그 반대)라고 생각하지 않기 때문입니다.

하지만 주제 생성/시작 날짜가在那里 있었다면, 주제가 오래된 것인지 완전히 새로운 것인지 바로 알 수 있을 것입니다.

그 주제를 답변했기 때문에 이 스크린샷을 찍었습니다. 적당히 오래된 주제라는 것을 알았더라면 그냥 지나쳤을 텐데요. 그래서 토론 게시판에서 그 날짜를 표시하는 것은 양날의 검이 될 수 있다고 생각합니다.

테마 컴포넌트로 변경할 수 있을 것 같습니다. 하지만 얼마나 어려운 작업일까요?

여기서 hard라고 한 것은… 누가 자발적으로(pro bono) 이 일을 하고 싶어 하는지 묻는 것입니다 :wink: 저는 코딩을 못 합니다. 저는 복사&붙여넣기 박사일 뿐, 그 외에는 아무것도 할 수 없습니다. 그리고 당연히 예산도 없습니다.

하지만 저도 알고 싶습니다. 제가 views 수를 표시하는 것이 주로 관리자의 호기심(예를 들어 SQL을 통해 로그와 views를 더 잘 가져올 수 있으므로)과 빈 공간을 채우기 위한 것이라고 생각하는 유일한 사람인지요. 그렇다면 같은 공간을 조금 더… 생산적인 방식으로 활용할 수 있지 않을까 하는 생각에서입니다 :wink:

3개의 좋아요

Jakke님, 안녕하세요.

아직 이 정보가 필요하신지 모르겠지만, 여기 있습니다!
관련 템플릿(topic-list-header 및 topic-list-item)을 덮어쓰기하여 views 열을 대체할 수 있습니다.

불행히도, 상당량의 기존 코드를 복사-붙여넣기해야 한다는 단점이 있습니다. 이는 테마/플러그인/컴포넌트에 따라 올바르게 작동하지 않을 수 있습니다. 또한 Discourse가 해당 부분을 업데이트할 경우 업데이트해야 할 수도 있습니다.

컴포넌트에 복사-붙여넣기할 수 있는 코드는 다음과 같습니다:

Head
<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 class=topic-post-badges>Some text</a><span class=topic-post-badges>`,
      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>

참고: Activity와 동일한 제목이 호버 시 표시되며, 날짜를 클릭하면 토론의 처음으로 이동합니다.

1개의 좋아요

감사합니다!

잘 작동합니다.

다만, 작은 주의사항이 있습니다

Topic List Preview 플러그인이 꺼지는 현상이 발생합니다.

  • 첫째 — 해당 코드는 정말 멋진 배려였고, 기대했던 대로 작동합니다. 정말로 기대 이상입니다.
  • 둘째 — 포럼이 긴 날짜 형식(저는 dd.mm.yy를 사용 중입니다)을 어떻게 표시하느냐에 따라, 이 기능과 TLP를 동시에 켜면 여유 공간이 거의 없습니다. 결국 둘 중 하나만 선택해야 하는 상황입니다.
  • 셋째 — Topic List Preview는 상당히 복잡한 플러그인인 것 같습니다. 이로 인해 충돌이 발생하기 쉽습니다. 다시 한번 말씀드리지만, 선택의 문제입니다.
1개의 좋아요

테스트해 주셔서 감사합니다!

Topic List Previews (TLP) (플러그인 버전은 비추천)를 사용 중이라면, 저장소의 topic-list-item 코드에서 다음 내용을 복사하여 붙여넣을 수 있습니다.

Head
<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'>
    {{#if bulkSelectEnabled}}
      <td class='star'>
        <input type="checkbox" class="bulk-select">
      </td>
    {{/if}}
    
    {{#if tilesStyle}}
      <div class="tiles-grid-item-content main-link">
        <div class="image">
          {{#if hasThumbnail}}
            {{raw "list/topic-thumbnail" topic=topic thumbnails=thumbnails currentUser=currentUser site=site category=category opts=thumbnailOpts}}
          {{/if}}
          <a href='{{topic.url}}'>
            <div class="image-mask" style="{{backgroundGradient}}"></div>
          </a>
        </div>
        <div class="topic-details">
          <div class="topic-header-grid">
            {{raw "list/topic-list-title" topic=topic tilesStyle=tilesStyle showTopicPostBadges=showTopicPostBadges}}
            <div class="topic-category">
              {{#if showCategoryBadge}}
                {{category-link topic.category}}
              {{/if}}
              {{#if topic.tags}}
                {{discourse-tags topic mode="list"}}
              {{/if}}
            </div>
          </div>
          {{#if showExcerpt}}
            <a href='{{topic.url}}'>
              {{raw "list/topic-excerpt" topic=topic}}
            </a>
          {{/if}}
          <div class="topic-footer">
            {{raw 'list/topic-meta' likesHeat=likesHeat title=view.title topic=topic}}
            {{raw "list/topic-users" tilesStyle=tilesStyle abbreviatePosters=abbreviatePosters posters=abbreviatedPosters posterNames=posterNames}}
            {{#if showActions}}
              {{raw "list/topic-actions" likeCount=likeCount topicActions=topicActions topic=topic}}
            {{/if}}
          </div>
        </div>
      </div>
    {{else}}
      {{~raw-plugin-outlet name="topic-list-before-columns"}}
      {{!--
        The `~` syntax strip spaces between the elements, making it produce
        `<a class=topic-post-badges>Some text</a><span class=topic-post-badges>`,
        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">
        {{#if hasThumbnail}}
          {{raw "list/topic-thumbnail" topic=topic thumbnails=thumbnails category=category opts=thumbnailOpts}}
        {{/if}}
        {{~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}}
          {{#if expandPinned}}
            {{raw "list/topic-excerpt" topic=topic}}
          {{/if}}
          {{#if showActions}}
            {{raw "list/topic-actions" likeCount=likeCount topicActions=topicActions}}
          {{/if}}
          {{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
        </div>
      </td>
    
      {{#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"}}
    {{/if}}
</script>

이 방법으로 작동하는지 알려주세요. :slight_smile:

둘 다입니다. 사이드카 플러그인이 비추천(deprecated) 상태가 아니죠?

오늘 밤에 좀 더 시간을 내서 시도해 볼 예정입니다. 여기는 거의 오후 5시라 사우나를 데워야 합니다. :wink: 그래서 가장 중요한 것부터 먼저 해야 하죠 :rofl:

(모더레이터와 관리자분들께: 이건 오프토ピック이 아니라 실제 사용 경험(UX)에 관한 것입니다…)

네, 사이드카 플러그인은 테마 구성 요소를 보완하므로 문제없습니다.

1개의 좋아요