Ungelesene Themen (Mobile Version)

Vor ein paar Tagen ist dieses Problem in meinem Forum aufgetreten, obwohl ich die Themen bereits aufgerufen habe, erscheinen sie mir als ungelesen. Ich hatte das gleiche Problem in der Desktop-Version, konnte es aber in der Vorlage lösen. Ehrlich gesagt, in der mobilen Version konnte ich es nicht lösen. Ich hoffe, jemand kann mir helfen. Dies ist die Vorlage, die ich verwende:

<script type='text/x-handlebars' data-template-name='mobile/list/topic-list-item.raw'>
    <td>
      {{#unless expandPinned}}
      <div class='pull-left'>
        <a href="/users/{{topic.creator.username}}">{{avatar topic.creator imageSize="50"}}</a>
              </div>
              
      <div class='right'>
      {{else}}
      <div>
            {{/unless~}}
            

<div class='main-link'>
          {{raw "topic-status" topic=topic}}
          {{topic-link topic}}
          {{#if topic.featured_link}}
            {{topic-featured-link topic}}
          {{/if}}
          
          
{{#if hideCategory}}
   <div class='category'>
          <span class="author-name"><a>{{topic.creator.username}}</a></span>
        </div>
{{else}}

{{/if}}
                    {{#if topic.unseen}}
                      <span class="badge-notification new-topic"></span>
                      
             {{/if}}
          {{~#if expandPinned}}
          {{raw "list/topic-excerpt" topic=topic}}
          {{/if~}}
        </div>
                <div class='pull-right'>
          {{raw "list/post-count-or-badges" topic=topic postBadgesEnabled=showTopicPostBadges}}
        </div>
    
        <div class="topic-item-stats clearfix">
          {{#unless hideCategory}}
            <div class='category'>
              {{category-link topic.category}}
            </div>
          {{/unless}}
    
          {{discourse-tags topic mode="list"}}
    
          <div class="pull-right">
            <div class='num activity last'>
            <span class="age activity" title="{{topic.bumpedAtTitle}}"><a>{{format-date topic.bumpedAt format="tiny" noTitle="true"}}</a></span>
            </div>
          </div>
              <div class="clearfix"></div>
        </div>
      </div>
    </td>
</script>

1 „Gefällt mir“

Es gibt einige Änderungen im Kern-Template, daher sollten Sie es damit vergleichen.

Wenn ich es richtig sehe, haben Sie den Profil-Avatar-Bereich mit diesem <a> href="/users/{{topic.creator.username}}">{{avatar topic.creator imageSize="50"}}</a> geändert. Ist der /users/-Pfad korrekt? Dies führt zum Benutzerprofil anstatt zum Öffnen der Benutzerkarte. Mit dem Standard-Benutzerpfad sollte es /u/ sein.

Die andere Änderung in Ihrem Template ist, dass der Benutzername angezeigt wird, wenn die Kategorie versteckt ist. Dies ist auf Ihrem Screenshot deutlich sichtbar. Ich habe diesen Abschnitt wie folgt geändert:

Entfernen Sie dies aus Ihrem Template:

{{#if hideCategory}}
   <div>
          <span class="author-name"><a>{{topic.creator.username}}</a></span>
   </div>
{{else}}

{{/if}}

Und fügen Sie dies hinzu zum Standard {{#unless hideCategory}} mit {{else}}.

{{#unless hideCategory}}
{{~raw-plugin-outlet name="topic-list-before-category"}}
<div>
  {{category-link topic.category}}
</div>
{{else}}
<span class="author-name">
  <a href="{{topic.creator.path}}" data-user-card="{{topic.creator.username}}">{{topic.creator.username}}</a>
</span>
{{/unless}}

Daher schlage ich vor, das gesamte Template zu importieren und es wie folgt an Ihre Bedürfnisse anzupassen.

<script type='text/x-handlebars' data-template-name='mobile/list/topic-list-item.raw'>
<td class="topic-list-data">
  {{~raw-plugin-outlet name="topic-list-before-columns"}}
  <div class='pull-left'>
    <a href="/users/{{topic.creator.username}}">{{avatar topic.creator imageSize="50"}}</a>
  </div>
  <div class='right'>
    {{~raw-plugin-outlet name="topic-list-before-link"}}
    <div class='main-link'>
      {{~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"}}
      {{~#if topic.unseen~}}
        <span class="topic-post-badges">&nbsp;<span class="badge-notification new-topic"></span></span>
      {{~/if~}}
      {{~#if expandPinned~}}
      {{~raw "list/topic-excerpt" topic=topic~}}
      {{~/if~}}
    </div>
    <div class='pull-right'>
      {{raw "list/post-count-or-badges" topic=topic postBadgesEnabled=showTopicPostBadges}}
    </div>
    <div class="topic-item-stats clearfix">
      {{#unless hideCategory}}
        {{~raw-plugin-outlet name="topic-list-before-category"}}
        <div class='category'>
          {{category-link topic.category}}
        </div>
        {{else}}
        <span class="author-name">
          <a href="{{topic.creator.path}}" data-user-card="{{topic.creator.username}}">{{topic.creator.username}}</a>
        </span>
      {{/unless}}
      {{discourse-tags topic mode="list"}}
      <div class="pull-right">
        <div class='num activity last'>
          <span class="age activity" title="{{topic.bumpedAtTitle}}"><a
              href="{{topic.lastPostUrl}}">{{format-date topic.bumpedAt format="tiny" noTitle="true"}}</a>
          </span>
        </div>
      </div>
      <div class="clearfix"></div>
    </div>
  </div>
</td>
</script>

Das sieht in meinem Theme-Creator gut aus. Entschuldigen Sie, wenn ich etwas übersehen habe.


Ein kleiner CSS-Fix, um den Titel-Padding dünner zu machen, damit der Benutzername klickbar ist.

.topic-list .main-link a.title {
  padding: 0.5em 0;
}
3 „Gefällt mir“

Vielen Dank, es ist jetzt gelöst, es sieht großartig aus. :heart:

Eine weitere Sache: Gibt es CSS, um die Textschrift des Autorennamens größer zu machen und ihr Farbe zu geben?

1 „Gefällt mir“

Ich freue mich, dass es geklappt hat. Sicher können Sie es ändern. So :arrow_double_down:
Ändern Sie Größe und Farbe, was immer Sie wollen.

.topic-list .topic-item-stats .author-name a {
  font-size: var(--font-up-1);
  color: red;
}
2 „Gefällt mir“

Vielen Dank nochmals, es sieht genau so aus, wie ich es wollte. :heart:

Jennifer Lopez Reaction GIF by NBC World Of Dance

2 „Gefällt mir“

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.