I’m trying to modify the default behavior of the “New Topic” button in Discourse 2.6.1. I have a custom plugin that modifies the default Ember actions to run my function. It worked properly when using a previous version of Discourse (1.8.0) but I can’t find how to get the same result in the new version. The code is the following one:
The first controller controller defined the main site’s actions (which doesn’t work in the new version) and the second one defined the actions to run when running a search in the app (and it works in the new version as well).
I saw that the “New Topic” buttons are created using the “createTopic” and “clickCreateTopicButton” actions but none of them work in the main site. Do I need to modify another action or do we need to use a different controller?
Thank you for the suggestion. However, if I’m not mistaken, that plugin allows you add a new custom field to a topic but what I want to do is to run my own javascript code when clicking on the “New Topic” button. I think my issue is basically related to the Discourse’s controller to use, the name of the function that is run and how to overwrite that function. Can you shed some light here?
Well, darn. Sorry. I was thinking that it had some javascript code in it (e.g., in discourse-topic-custom-fields/assets/javascripts/discourse) that might be helpful in seeing how to wire that stuff up. I’m still not very good at the front end stuff, so I’m afraid that was my best free answer.