Yes you can use them inside the AMD module but keep in mind once you add an event listener on the window object it will be called everytime there is an action:ajaxify.end. If you don't want it triggered after you leave that page you need to turn it off with $(window).off('eventName', myMethod)
How can I make my own plugin which has a setting page?
-
I added ./templates/admin/plugins/sort-by-votes.tpl. But it does not show at admin/plugin tab. What else thing should I do?
This is my plugin.json:
{ "id": "nodebb-plugin-category-sort-by-votes", "name": "Sort by Votes", "description": "Adds functionality to sort topics by votes in category list view", "url": "https://bitbucket.org/wktang/nodebb-plugin-category-sort-by-votes", "library": "./library.js", "hooks": [ { "hook": "filter:topics.get", "method": "addTopicsVotesInCategory" } ], "templates": "public/templates", "staticDirs": { "sortbyvotes": "public" } }
-
Two things. You need to add the route and controller for that url, and you need to add a link to the admin header.
Look at nodebb-plugin-quickstart
Add the routes in the load hook. The controller function is defined here, here is also where you render the template and can add additional data if you wish.
Use the hook
filter:admin.header.build
to add a link to the admin header. Like shown here. -
@yariplus
Thanks your tips works for me.
Suggested Topics
Copyright © 2022 NodeBB | Contributors