Jagster
(Jakke Lehtonen)
31. Januar 2023 um 07:44
1
/latest (und alles andere) sieht ungefähr so aus:
Antworten zeigt, wie aktiv ein Thema ist, und Aktivität , wann zuletzt etwas passiert ist. Das sind nützliche Daten. Aber Aufrufe … das kann ein interessanter Wert für Administratoren und den Ersteller sein, aber es bietet dem normalen Benutzer keinen Wert – er schaut nicht darauf und denkt: „Nun, das kann kein interessantes Thema sein, weil es so wenige geöffnet haben“ (oder umgekehrt).
Aber wenn wir dort den Erstellungs-/Starttag hätten, würde er sofort zeigen, ob ein Thema alt oder brandneu ist.
Ich habe diesen Screenshot gemacht, weil ich auf das Thema geantwortet habe. Ich hätte es in Ruhe lassen können, wenn ich gewusst hätte, dass es ein anständig altes Thema ist – also, für Diskussionen kann die Anzeige dieses Datums ein zweischneidiges Schwert sein, das weiß ich.
Es kann mit einer Theme-Komponente geändert werden, würde ich schätzen. Aber wie schwierig ist die Aufgabe?
Und mit schwierig meine ich… Gibt es jemanden, der es pro bono machen möchte Ich kann nicht programmieren. Ich bin promoviert im Kopieren & Einfügen, sonst nichts. Und definitiv habe ich kein Budget.
Aber ich würde auch gerne wissen, ob ich der Einzige bin, der der Meinung ist, dass die Anzeige der Anzahl der Aufrufe hauptsächlich der Neugier des Administrators dient (wir können Protokolle und Aufrufe besser über SQL abrufen, zum Beispiel) und um leeren Platz zu füllen, und dass wir deshalb denselben Platz etwas … produktiver nutzen könnten
3 „Gefällt mir“
Hallo Jakke,
Ich bin mir nicht sicher, ob du das noch brauchst, aber hier ist es!
Du kannst die Spalte „Ansichten“ ersetzen, indem du die zugehörigen Vorlagen überschreibst (topic-list-header und topic-list-item ).
Leider hat dies den Nachteil, dass du viel vom ursprünglichen Code kopieren und einfügen musst, was je nach deinem Theme/Plugins/Komponenten möglicherweise nicht korrekt funktioniert. Außerdem musst du ihn möglicherweise aktualisieren, wenn Discourse diese Teile aktualisiert.
Hier ist der Code, den du in eine Komponente kopieren und einfügen kannst:
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}}
{{!--
Die `~`-Syntax entfernt Leerzeichen zwischen den Elementen, wodurch
`<a>class=topic-post-badges</a><span>`
ohne Leerzeichen dazwischen erzeugt wird.
Dadurch wird das Topic-Post-Badge als dasselbe Wort wie „text“ am Ende des Links betrachtet,
was verhindert, dass es in eine eigene Zeile umgebrochen wird.
--}}
<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>
Hinweis: Der Titel beim Hovern ist derselbe wie bei „Aktivität“, und das Klicken auf das Datum leitet zum Anfang des Themas weiter.
1 „Gefällt mir“
Jagster
(Jakke Lehtonen)
25. März 2023 um 06:50
3
Danke!
Funktioniert einwandfrei.
Kleine Einschränkung, aber
Es schaltet irgendwie das Topic List Preview Plugin ab.
Erstens – dieser Code war wirklich eine nette Geste und tut, was erwartet wurde. Das ist wirklich mehr, als ich erhofft hatte.
Zweitens – je nachdem, wie ein Forum längere Daten anzeigt (ich verwende dd.mm.yy), gibt es nicht viel freien Speicherplatz, wenn dieses und TLP gleichzeitig aktiv sind. Es ist entweder das eine oder das andere, aber nicht beides.
Drittens – Topic List Preview ist ein wirklich komplexes Plugin, schätze ich. Konflikte damit sind wirklich einfach zu erstellen und zu bekommen. Nochmals: eine Frage der Wahl.
1 „Gefällt mir“
Danke fürs Testen!
Wenn Sie Topic List Previews (TLP) (Plugin-Version ist veraltet) verwenden, können Sie Folgendes kopieren und einfügen, indem Sie topic-list-item code aus dem Repository verwenden.
Kopf
<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>Some text</a><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">
{{#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>
Lassen Sie mich wissen, ob das für Sie funktioniert.
Jagster
(Jakke Lehtonen)
25. März 2023 um 14:46
5
[quote=„Arkshine, Beitrag:4, Thema:253460″]
Wenn du benutzt
[/quote]
Beides. Das Sidecar-Plugin ist nicht veraltet, oder?
Aber ich werde das später heute Abend ausprobieren. Es ist hier fast 17 Uhr und das bedeutet, ich muss die Sauna aufheizen Also, die wichtigsten Dinge zuerst
(Und für Mods und Admins: Das ist NICHT Off-Topic, sondern reale Benutzererfahrung…)
Ja, das Sidecar-Plugin ergänzt die Theme-Komponente, hier gibt es keine Probleme.
1 „Gefällt mir“