Forum Discussion
Rtoluchuri to be precise: you mean the topics list right? (e.g. the recent threads/topics displayed on a ForumPage)
It's correct that this is not "easily" possible by checking some checkbox, on the other hand it's also not too hard to do with a dirty hack =), basically you loop trough each topic with JavaScript, extract the topic ID (which is the same as the ID for the first message) and query the REST API with AJAX in the background to fetch the kudos count for the topic, then insert it at an appropriate position in each item.
Something like this could work (probably not working out of the box with your community as the one I just tried this on looks somehow customized by professional services, but you'll get the idea):
jQuery('.lia-component-message-list .lia-list-row .page-link').each(function() { var $el = jQuery(this); var link = $el.prop('href'); var topicid = link.split('td-p/')[1] || false; if ( topicid ) { var query = '/restapi/v1/threads/id/' + topicid + '/kudos/count?restapi.response_format=json' jQuery.get(query) .done(function(response) { // yeah, REST v1 responses contain a node called "response"...not a mistake console.log(response.response.value.$); // now you just create some HTML to your liking // if you wanna go with the "beautiful" markup Lithium provides by default // it would look something like this: var $markup = jQuery([ '<td class="cKudosCountColumn lia-data-cell-secondary lia-data-cell-integer">', '<div class="lia-component-messages-column-message-kudos-count">', '<span class="lia-message-stats-count">' + response.response.value.$ + '</span> Kudos', '</div>', '</td>' ].join("\n")); // and inject it where you need it $markup.insertBefore($el.parents('.lia-list-row').find('.cRepliesCountColumn')); }) .fail(function(error) { console.log(error); }); } });
hope that helps =)!
Related Content
- 2 years ago
- 4 years ago