I’m trying to create a theme component that adds a custom button to tagged topics. For example: Topics tagged with event-tag will have a button next to the category named Event which will link to the events page.
<script type="text/discourse-plugin" version="0.8">
api.modifyClass("component:topic-category", {
didInsertElement: function() {
this._super();
console.log("Welcome to the topics page!")
}
});
</script>
I can get to the topic page and get a response saying “welcome”, but I’m still not sure how I can pull the current pages tags to see if I should populate the button or not…
and found that if I just console.log(this) it was able to spew out all data on the page, including tags. I think I can go from here now by pulling the tag data on the page and checking if it’s in the settings or not. Once I polish this and think it’s ready for the public, I’ll post it on the theme components category. Just thought I’d share my findings in case anyone else is learning how to make theme components!