# Add like\_count column to topic list

**URL:** <https://meta.discourse.org/t/add-like-count-column-to-topic-list/43376>\
**Category:** Development\
**Created:** [28 Abril, 2016 11:12 UTC](https://meta.discourse.org/t/add-like-count-column-to-topic-list/43376 "2016-04-28T11:12:36Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Anthony\_Hopkins](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anthony_hopkins/32/121811_2.png) [@Anthony\_Hopkins](https://meta.discourse.org/u/Anthony_Hopkins)\
**Post date:** [6 Mayo, 2016 07:12 UTC](https://meta.discourse.org/t/add-like-count-column-to-topic-list/43376/3 "2016-05-06T07:12:27Z")

</div>

Thank you,

After many many tries I prepared working extension of ‘discourse/views/topic-list-item’ and `click(e)` event:

```plaintext
if (target.hasClass('like-count') || target.parents('.like-count').length > 0) {
  const topic = this.get('topic');
  Discourse.ajax(`/posts/by_number/${topic.id}/1`).then(result => {
    const post = Post.create(result);
    if(post.user_id == Discourse.User.current().id){
      bootbox.alert(I18n.t('cant_thumb_up'))
      return false;
    }
    post.get('likeAction').togglePromise(post).then(resultLike => {
      if(resultLike.acted) {
        target.closest('.like-count').toggleClass('liked');
        topic.like_count = topic.like_count+1;
        target.closest('.like-count').find('span').text(topic.like_count);
      }else{
        target.closest('.like-count').removeClass('liked');
        topic.like_count = topic.like_count-1;
        target.closest('.like-count').find('span').text(topic.like_count);
      }
    })
  });
  return false;
}

```

+ CSS + view extension.

I know it’s not perfect solution but Base works very well.

---

_[View the full topic](https://meta.discourse.org/t/add-like-count-column-to-topic-list/43376)._
