Jagster
(Jakke Lehtonen)
Janvier 31, 2023, 7:44
1
/latest (et tout le reste) ressemble à ceci :
Replies indique à quel point un sujet est actif et Activity quand quelque chose s’est passé pour la dernière fois. Ce sont des données utiles. Mais Views … cela peut être une valeur intéressante pour les administrateurs et l’OP, mais cela n’apporte aucune valeur à un utilisateur régulier — il ne le regarde pas et ne pense pas “eh bien, ce ne peut pas être un sujet intéressant car si peu l’ont ouvert” (ou vice versa).
Mais si nous pouvions y avoir la date de création/début, cela indiquerait immédiatement si un sujet est ancien ou totalement nouveau.
J’ai pris cette capture d’écran parce que j’ai répondu à ce sujet. Je pourrais le laisser tranquille si je savais que c’était un sujet assez ancien — donc, pour la discussion, l’affichage de cette date peut être une arme à double tranchant, je sais.
Cela peut être modifié avec un composant de thème, je suppose. Mais quelle est la difficulté du travail ?
Et par difficile , je veux dire… Y a-t-il quelqu’un qui veut le faire bénévolement Je ne sais pas coder. Je suis titulaire d’un doctorat en copier-coller, rien d’autre. Et je n’ai certainement pas de budget.
Mais j’aimerais aussi savoir si je suis le seul à penser que l’affichage du nombre de vues est principalement fait pour la curiosité de l’administrateur (nous pouvons obtenir des journaux et des vues via SQL, par exemple) et pour remplir un espace vide, et que c’est pourquoi nous pourrions utiliser le même espace un peu plus… d’une manière plus productive
3 « J'aime »
Salut Jakke,
Je ne sais pas si tu en as toujours besoin, mais voilà !
Tu peux remplacer la colonne des vues en écrasant les modèles associés (topic-list-header et topic-list-item ).
Malheureusement, cela a l’inconvénient de devoir copier-coller beaucoup de code d’origine, ce qui peut ne pas fonctionner correctement en fonction de ton thème/plugins/composants. De plus, tu devras peut-être le mettre à jour si Discourse met à jour ces parties.
Voici le code que tu peux copier-coller dans un composant :
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>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">
{{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>
Note : Le titre au survol est le même que celui de l’activité, et cliquer sur la date redirige vers le début du sujet.
1 « J'aime »
Merci d’avoir testé !
Si vous utilisez Topic List Previews (TLP) (la version plugin est obsolète), vous pouvez copier-coller le code suivant en utilisant topic-list-item code depuis le dépôt.
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>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>
Faites-moi savoir si cela fonctionne pour vous.
Jagster
(Jakke Lehtonen)
Mars 25, 2023, 2:46
5
Arkshine:
Si vous utilisez
Les deux. Le plugin sidecar n’est pas obsolète, n’est-ce pas ?
Mais je vais essayer ça un peu plus tard ce soir. Il est presque 17h ici et cela signifie que je dois commencer à chauffer le sauna Donc, les choses les plus importantes d’abord
(Et pour les mods et admins : ce n’est PAS hors sujet, mais une expérience utilisateur du monde réel…)
Oui, le plugin Sidecar complète le composant de thème, pas de problème ici.
1 « J'aime »