How do I use api.registerTopicFooterButton?

As mentioned in:

What do I put in action, if I wish to register a DButton there, that perhaps does an action as specified in the DButton’s @action?

Clone GitHub - discourse/all-the-themes

run ./reset-all-repos

grep -r registerTopicFooterButton 

Find these examples:

official/discourse-custom-topic-button-component/common/head_tag.html:  api.registerTopicFooterButton({
official/discourse-quick-whisper/javascripts/discourse/initializers/discourse-quick-whisper.js:      api.registerTopicFooterButton({
official/discourse-topic-group-button-component/javascripts/discourse/api-initializers/topic-group-button.js:  api.registerTopicFooterButton({

What do you want to happen when they click the button?

2 Likes

Let’s say, redirect the user to /about?
Wait: do I put the @action I specified into there? So if I have an action called redirectUserToAbout, I put action: action(context) { this.redirectUserToAbout() }?

Edit: Looks like we have a great example here: