What's the best practice to make tpl, back-end function work together in plugin?
-
Hi guys,
What I want is a custom page with some form to submit data to the db. I have learnt quite a few about the plugin system and start with the nodebb-plugin-quickstart, then modify it and make my own custom page visible. But the quickstart's page is for the admin and I guess this is the submit data handling funciton in static/lib/admin.js:
define('admin/plugins/quickstart', ['settings'], function(Settings) { var ACP = {}; ACP.init = function() { Settings.load('quickstart', $('.quickstart-settings')); $('#save').on('click', function() { Settings.save('quickstart', $('.quickstart-settings'), function() { app.alert({ type: 'success', alert_id: 'quickstart-saved', title: 'Settings Saved', message: 'Please reload your NodeBB to apply these settings', clickfn: function() { socket.emit('admin.reload'); } }); }); }); }; return ACP; });
But obviously it's for a ACP page, and I want a form page for all users. So may you tell me how to add the $('#save').on('click', function()... for my form page, and where to write the post function? Thank you very much!
-
@Tivon Hm, maybe the shoutbox plugin could get you pointed in the right direction?
Copyright © 2024 NodeBB | Contributors