ajaxify.variables.get deprecated
-
Instead of using
ajaxify.variables.get('topic_name')
now you can access the data returned on a particular api route by doingajaxify.data.title
. The old method still works but will be removed in a future release.Relevant gh issue https://github.com/NodeBB/NodeBB/issues/1999
-
Ok, It's clear that you have access now data from
data
object. But how to inject data so it will be accessible? Before it was done by hidden inputs in template... -
@baris For example, I'm using it here: https://github.com/NicolasSiver/nodebb-plugin-ns-points/blob/master/public/templates/partials/variables/points_settings.tpl
-
@baris What api route do you mean?
I'm injecting additional data to topic:- https://github.com/NicolasSiver/nodebb-plugin-ns-points/blob/master/plugin.json#L37
- https://github.com/NicolasSiver/nodebb-plugin-ns-points/blob/master/app/controller.js#L27
and then add hidden template to topic view.
-
If you are adding data to topic on server side it should already be avaiable in
ajaxify.data.topic.yourData
. Check the/api/topic/id/slug
route to make sure the data you insert is there. If it is, then it is also avaiable client side in ajaxify.data. -
This is already the only way to interact with data on ajaxify right? Was updating some plugins today, and was facing this problem to get them to work with 0.8.x.
Is there a place to see all the importante changes that have to be made in the code in order to work with a certain version of nodebb?
I have found it very difficult to see something related to this in the forum. I got here by luck searching for ajaxifiy, i didnt's see it on the "breaking changes' posts of any version, but maybe it exists and i'm the only one lost.
Thanks!
-
I have found it very difficult to see something related to this in the forum. I got here by luck searching for ajaxifiy, i didnt's see it on the "breaking changes' posts of any version, but maybe it exists and i'm the only one lost.
On a related note, maybe these breaking changes should be organised into a wiki page, containing a list of all changes sorted by release
-
@psychobunny said:
On a related note, maybe these breaking changes should be organised into a wiki page, containing a list of all changes sorted by release
I think that would be very helpful.