Jagster
(Jakke Lehtonen)
31 Gennaio 2023, 7:44am
1
/latest (e tutto il resto) assomiglia a questo:
Replies indica quanto è attivo un argomento e Activity quando è successo qualcosa l’ultima volta. Sono dati utili. Ma Views … può essere un valore interessante per amministratori e OP, ma non dà alcun valore all’utente normale — non lo guardano e pensano “beh, non può essere un argomento interessante perché pochi l’hanno aperto” (o viceversa).
Ma se potessimo avere lì il giorno di creazione/inizio, capiremmo subito se un argomento è antico o completamente nuovo.
Ho fatto quello screenshot perché ho risposto a quell’argomento. Avrei potuto lasciarlo perdere se avessi saputo che era un argomento abbastanza vecchio — quindi, per la discussione, mostrare quella data può essere un’arma a doppio taglio, lo so.
Si può cambiare con un componente tematico, immagino. Ma quanto è difficile?
E con difficile intendo… C’è qualcuno che vuole farlo pro bono Non so programmare. Sono un dottorato in copia e incolla, nient’altro. E di certo non ho un budget.
Ma mi piacerebbe anche sapere se sono l’unico a pensare che mostrare il numero di visualizzazioni sia per lo più fatto per la curiosità dell’amministratore (possiamo ottenere log e visualizzazioni migliori tramite SQL, ad esempio) e per riempire spazio vuoto, e che per questo potremmo usare lo stesso spazio in modo un po’ più… produttivo
3 Mi Piace
Ciao Jakke,
Non sono sicuro se ti serva ancora, ma eccoti qui!
Puoi sostituire la colonna delle visualizzazioni sovrascrivendo i relativi template (topic-list-header e topic-list-item ).
Sfortunatamente, presenta lo svantaggio di dover copiare e incollare gran parte del codice originale, che potrebbe non funzionare correttamente a seconda del tuo tema/plugin/componenti. Inoltre, potresti doverlo aggiornare se Discourse aggiorna quelle parti.
Ecco il codice che puoi copiare e incollare in un componente :
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>`
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>
Nota: Ha lo stesso titolo al passaggio del mouse di Activity e fare clic sulla data reindirizza all’inizio dell’argomento.
1 Mi Piace
Grazie per il test!
Se utilizzi Topic List Previews (TLP) (la versione plugin è deprecata), puoi copiare e incollare quanto segue utilizzando topic-list-item code dal repository.
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>
Fammi sapere se funziona per te.
Jagster
(Jakke Lehtonen)
25 Marzo 2023, 2:46pm
5
Arkshine:
Se usi
Entrambi. Il plugin sidecar non è deprecato, vero?
Ma ci darò un’occhiata più tardi stasera. Sono quasi le 17:00 qui e questo significa che devo iniziare a scaldare la sauna Quindi, le cose più importanti prima
(E per mod e admin: questo NON è OT, ma UX del mondo reale…)
Sì, il plugin Sidecar integra il componente del tema, nessun problema qui.
1 Mi Piace