Thank you!
I am a super noob to require JS and I had a feeling it was something related to calling a require but just am still trying to get used to the frameworks in play 😛
I'm developing a simple widget here:
https://github.com/FezVrasta/nodebb-widget-steamserverstatus
But the function to render the widget doesn't work..
Widget.renderStatusWidget = function(widget, callback) {
var html = Widget.templates['status.tpl'];
var serverIpPort = widget.data.server;
var server = {
host: serverIpPort.split(':')[0],
port: serverIpPort.split(':')[1]
};
ssq.info(server.host, server.port, function(err, data) {
if (err) {
console.log('Got error: ', err);
return callback(err);
}
html = templates.parse(html, data);
callback(null, html);
});
};
I have even tried to replace this function with a simple callback(null, "hello world")
but the widget never render.
Any idea?
try to hook "filter:widget.render:nodebb-widget-steamserverstatus". I'm not sure, but there is some info in documentation:
NodeBB core will call your widget on the appropriate page load by way of the hooks system. The hook will be named after your widget’s namespace (see previous example) - like so: filter:widget.render:widget_namespace
@APXEOLOG said:
try to hook "filter:widget.render:nodebb-widget-steamserverstatus". I'm not sure, but there is some info in documentation:
NodeBB core will call your widget on the appropriate page load by way of the hooks system. The hook will be named after your widget’s namespace (see previous example) - like so: filter:widget.render:widget_namespace
Thanks but it doesn't work
Ok, according to https://github.com/NodeBB/NodeBB/blob/master/src/widgets/index.js#L37 widget_namespace
is what you define in defineWidget
function: widget: "steamserverinfo"
So try to bind filter:widget.render:steamserverinfo
AHHH!!!! THANK YOUUU!!!!
What a stupid error
thanks!