danielabc
(Daniela)
13 Febbraio 2022, 11:33pm
1
Ho cercato qui, ma non ho trovato nulla, forse Google Translate usa un termine che non stai usando…
Volevo che le immagini degli avatar delle persone apparissero prima degli argomenti come questo
L’avatar degli argomenti mostra sempre la foto di chi è stato l’ultimo a commentare l’argomento, è un altare per chi ha creato l’argomento e lasciarlo fisso? Cioè, la foto che apparirà sarà quella della persona che ha creato l’argomento e rimarrà così per sempre.
1 Mi Piace
PaulinaMX
(ForosMX)
13 Febbraio 2022, 11:37pm
2
Ciao, dai un’occhiata a questo componente.
2 Mi Piace
danielabc
(Daniela)
14 Febbraio 2022, 8:29am
4
Questo è davvero ottimo, grazie per l’aiuto, ma come metto l’avatar prima dell’argomento?
1 Mi Piace
PaulinaMX
(ForosMX)
14 Febbraio 2022, 7:44pm
5
Non sono un esperto in questo, ma farò alcuni test nel mio forum per vedere se riesco a fare quello che chiedi.
PaulinaMX
(ForosMX)
15 Febbraio 2022, 4:36am
6
@danielabc Penso che questo possa esserti utile.
Desktop / Head
<script type='text/x-handlebars' data-template-name='list/topic-list-item.raw'>
{{#if showParticipants}}
{{raw "list/posters-column" posters=topic.participants}}
{{/if}}
<td class='author' style="width: 60px;"><a href="{{topic.creator.path}}" data-user-card="{{topic.creator.username}}">{{avatar topic.creator imageSize="55"}}</a></td>
{{#if bulkSelectEnabled}}
<td class="bulk-select">
<input type="checkbox" class="bulk-select">
</td>
{{/if}}
<td class='main-link clearfix topic-list-data'>
{{~raw-plugin-outlet name="topic-list-before-status"}}
{{raw "topic-status" topic=topic}}
{{~topic-link topic class="raw-link raw-topic-link"}}
{{~#if showTopicPostBadges}}
{{~raw "topic-post-badges" unreadPosts=topic.unread_posts unseen=topic.unseen url=topic.lastUnreadUrl newDotText=newDotText}}
{{~/if}}
{{discourse-tags topic mode="list" tagsForUser=tagsForUser}}
{{#if expandPinned}}
{{raw "list/topic-excerpt" topic=topic}}
{{/if}}
<div class='creator'>
{{#unless hideCategory}}
{{#unless topic.isPinnedUncategorized}}
{{category-link topic.category}}
{{/unless}}
{{/unless}}
{{~#if topic.creator ~}}
<a href="/users/{{topic.creator.username}}" data-auto-route="true" data-user-card="{{topic.creator.username}}">{{topic.creator.username}}</a> <a href={{topic.url}}></a>
{{~/if ~}}
{{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
</div>
</td>
{{raw "list/posts-count-column" topic=topic}}
{{#if showLikes}}
<td class="num likes">
{{#if hasLikes}}
<a href='{{topic.summaryUrl}}'>
{{number topic.like_count}} {{d-icon "heart"}}</td>
</a>
{{/if}}
{{/if}}
{{#if showOpLikes}}
<td class="num likes">
{{#if hasOpLikes}}
<a href='{{topic.summaryUrl}}'>
{{number topic.op_like_count}} {{d-icon "heart"}}</td>
</a>
{{/if}}
{{/if}}
<td class="num views {{topic.viewsHeat}}">{{number topic.views numberKey="views_long"}}</td>
<td class="activity" title="{{topic.bumpedAtTitle}}">
<span class='latest-info'>
<span class='name'>
</span>
{{format-date topic.bumpedAt format="medium"}}
</span>
</a>
</td>
</script>
<script type='text/x-handlebars' data-template-name='topic-list-header.raw'>
{{#if showPosters}}
{{raw "topic-list-header-column" order='posters' forceName='Author' style='width: 70px;' }}
{{/if}}
{{#if bulkSelectEnabled}}
<th class="bulk-select">
{{#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}}
{{raw "topic-list-header-column" sortable=sortable number='true' order='posts' name='replies'}}
{{#if showLikes}}
{{raw "topic-list-header-column" sortable=sortable number='true' order='likes' name='likes'}}
{{/if}}
{{#if showOpLikes}}
{{raw "topic-list-header-column" sortable=sortable number='true' order='op_likes' name='likes'}}
{{/if}}
{{raw "topic-list-header-column" sortable=sortable number='true' order='views' name='views'}}
{{raw "topic-list-header-column" sortable=sortable number='true' order='activity' name='activity'}}
</script>
<script type="text/x-handlebars" data-template-name="components/latest-topic-list-item">
<div class='topic-poster'>
{{#user-link user=topic.creator}}
{{avatar topic.creator imageSize="large"}}
{{/user-link}}
</div>
<div class='main-link'>
<div class='top-row'>
{{raw "topic-status" topic=topic}}
{{topic-link topic}}
{{#if topic.featured_link}}
{{topic-featured-link topic}}
{{/if}}
{{topic-post-badges newPosts=topic.totalUnread unseen=topic.unseen url=topic.lastUnreadUrl}}
</div>
<div class='bottom-row'>
{{category-link topic.category}}
{{discourse-tags topic mode="list"}}
</div>
</div>
<div class='topic-stats'>
{{raw "list/posts-count-column" topic=topic tagName="div"}}
<div class="topic-last-activity">
<a href="{{topic.lastPostUrl}}" title="{{topic.bumpedAtTitle}}">{{format-date topic.bumpedAt format="tiny" noTitle="true"}}</a>
</div>
</div>
</script>
<script>
Discourse._registerPluginCode('0.8', function (api) {
api.changeWidgetSetting('post-avatar', 'size', '80');
});
</script>
<script type='text/x-handlebars' data-template-name='list/topic_list_item.raw'>
<td class='main-link clearfix'>
{{raw "topic-status" topic=topic}}
{{topic-link topic}}
{{#if controller.showTopicPostBadges}}
{{raw "topic-post-badges" unread=topic.unread newPosts=topic.displayNewPosts unseen=topic.unseen url=topic.lastUnreadUrl}}
{{/if}}
{{raw "list/topic-excerpt" topic=model}}
<div class='creator'>
{{#if showCategory}}
{{category-link topic.category showParent="true" onlyStripe="true"}}
{{/if}}
{{~#if topic.creator ~}}
<a href="/users/{{topic.creator.username}}" data-auto-route="true" data-user-card="{{topic.creator.username}}">{{topic.creator.username}}</a>
{{format-date topic.createdAt format="medium-with-ago"}}
{{~/if ~}}
{{raw "list/action-list" topic=topic postNumbers=topic.bookmarked_post_numbers className="bookmarks" icon="bookmark"}}
{{raw "list/action-list" topic=topic postNumbers=topic.liked_post_numbers className="likes" icon="heart"}}
</div>
</td>
{{#if controller.showLikes}}
<td class="num likes">
{{number topic.like_count}} <i class='fa fa-heart'></i>
</td>
{{/if}}
{{#if controller.showOpLikes}}
<td class="num likes">
{{number topic.op_like_count}} <i class='fa fa-heart'></i>
</td>
{{/if}}
<td class="num replies">
{{topic.replyCount}}
</td>
<td class="last-post">
<a href="{{topic.lastPostUrl}}">
{{format-date topic.bumpedAt format="medium-with-ago"}}
</a>
</div>
</td>
</script>
Desktop / Css
.topic-list .posters {
width: 50px;
}
danielabc
(Daniela)
18 Febbraio 2022, 6:21pm
7
Ho adorato questo codice, grazie, ma ho solo alcuni problemi, sai come modificare questo codice? Voglio che l’avatar abbia la foto dell’ultima persona che ha commentato l’argomento, ho visto che il nome del creatore dell’argomento appare dopo il nome della categoria, puoi mettere una parola prima? Del tipo “Argomento creato da:”