I'm guessing this is a feature? If you view the html source of that post, do you see the string "JavaScript" in it anywhere? I'm guessing the source code parser adds additional tags to the source code, and as you said you are storing the post as markdown so it's still included. I'm sure this could be prevented with a regular expression included in the search source code.
Joel Murphy
Posts
-
Not sure it's a bug or not in search function. -
Notification permissions bar bug?Only appeared today. Clicking it does nothing and now it won't go away.
-
Need further help with developing first pluginAnother update:
The rendering is actually working fine.
The following HTML:
<small>{../description}</small>
Should be changed to:
<small>{description}</small>
To make those properties show.
However, functions within the theme don't appear to be working. E.g.<div class="icon hidden-sm hidden-xs pull-left" style="{function.generateCategoryBackground}"> <i class="fa fa-fw {../icon}"></i> </div>
I'm guessing this is due to the way I'm passing an object to a template when it's being rendered?
Edit:
I've tried defining a test helper inside of
main.js
:templates.registerHelper('testingz',function(data, iterator, numblocks) { console.log('{function.testingz}'); return "testingz"; });
And calling it from my HTML template using
{function.testingz}
but nothing happens. Am I doing this correctly? As soon I figure this out, I should be able to finish my first plugin -
Need further help with developing first pluginOh you're right! Not sure why I was loading the template multiple times! Thanks
This is the result I get. I'm guessing some further rendering functions need to be called after the template is appended to the DOM?
-
Need further help with developing first pluginOkay, after more fiddling around, I've figured out even more about writing plugins. I've now written some code using client side javascript to group each category together according to its
homepageSection
id. Now I just need to figure out how to render the page after asynchronously rendering each category item.$(document).ready(function() { console.log('Client side JS loaded'); $(window).on('action:ajaxify.contentLoaded', function(ev, data) { if (data.tpl === 'categories') { var sections = {}; var sectionNames = ['A few threads', 'Other threads']; var categoriesHTML = ""; // Loop over each category and assign them to the section array based on their homepageSection value. for(var i = 0; i < ajaxify.data.categories.length; i++){ if( (typeof ajaxify.data.categories[i].homepageSection != 'undefined') && (ajaxify.data.categories[i].hasOwnProperty("homepageSection") )){ sections["section"+ajaxify.data.categories[i].homepageSection] = sections["section"+ajaxify.data.categories[i].homepageSection] || []; sections["section"+ajaxify.data.categories[i].homepageSection].push(ajaxify.data.categories[i]); } } // Loop over each section in the sections array, then render each category in each section for(section in sections){ for (var i = 0; i < sections[section].length; i++) { var myData = sections[section][i]; ajaxify.loadTemplate('partials/categories/item', function(myTemplate) { var html = templates.parse(myTemplate, myData); categoriesHTML += html; ; // loadTemplate is asynchronous and so this is where I suck @ node. Time for some more learning... }); }; } } }); });
Slow progress, but I'm nearly there
-
Need further help with developing first pluginOne thing I'm still unsure about though is how logic works in templates. Without logic inside of statements, doesn't it make it near impossible to do anything more than show or hide certain elements?
Assume I want to order (or more precisely, group) categories on the homepage, how should I do this?
<ul class="categories" itemscope itemtype="http://www.schema.org/ItemList"> <p>A few threads:</p> <!-- BEGIN categories --> {categories.homepage_section} put categories with a homepage_section value of '1' here. <!-- IMPORT partials/categories/item.tpl --> <!-- END categories --> <li class="line-seperator"></li> <p>Other threads:</p> <!-- BEGIN categories --> {categories.homepage_section} put categories with a homepage_section value of '2' here. <!-- IMPORT partials/categories/item.tpl --> <!-- END categories --> </ul>
This should produce something like this:
A few threads
- Test1 (1)
- Test2 (1)
- Test3 (1)
Other threads
- Test1 (2)
- Test2 (2)
- Test3 (2)
Anyone have any ideas? The only obvious solution I can think of right now is adding attributes such as
homepage_section1 = true
andhomepage_section2 = false
to each category. But this seems very long winded and hardly efficient.Thanks
-
Need further help with developing first pluginAh thank you, I was so close
Wow thank you so much for your long, detailed post. I decided I needed a refresher on JS after reading your post, so that's where I've been for the past few days. I completely forgot about closures, but now I think I'm back up to scratch with them so things should make a lot more sense now
@BDHarrington7
Oh I will don't worry! I've already started translating NodeBB to Welsh and am keen to get good at plugin development.
-
Need further help with developing first plugin@baris Thanks for your reply and for committing the new hook code.
Unfortunately, I can't get any further than the code I have here as I can't figure out how to return
categoryObj
back to the parent code in a callback. Time to give up and go back to PHP I think(function(MyPlugin) { 'use strict' MyPlugin.myMethod = function(categoryObj) { // do something with the data categoryObj.category.homepageSection = 1; console.log(categoryObj); }, MyPlugin.myMethod1 = function(categoryObj) { // do something with the data console.log(categoryObj); } }(module.exports))
-
Need further help with developing first pluginI'm attempting to write my very first plugin which should allow me to add custom attributes / data fields to a category. This information should be updated in the Redis datastore after the form has been submitted.
After reading the documentation, scanning the forums, and browsing the code of existing plugins for a few days, I'm still a little unsure of how exactly I should develop a plugin to achieve this functionality.
First of all, I want to ask if this is even possible? If it is possible, I'm wondering if you lovely people could guide me towards the right direction to implementing this?
I've broken down my goals into sub-goals like so:
When the 'add category' view loads
- Add a new field to the view
When the 'add category' view is submitted
- Perform validation on the custom data field.
- Add the category as normal, but also add the custom data to the datastore.
When the 'edit category' view is loaded
- Add a custom field for the custom category, and also allow this to be edited.
- Perform validation on the custom data field.
Update the custom data field within the datastore.
I know that my plugin will require the use of injecting some html into a view with the help of jQuery, then posting custom data and inserting it into Redis. Apart from that, my first problem is that I'm finding it hard to understand which hook to use from the list of hooks as there is no description along with them. I'm taking a guess and saying
action:category.create
but I can't figure out where to go from here as the examples in the docs are just so simple.Any code samples, pointers, or any general help would be fantastic. I'm just a little confused by the very brief documentation atm but I really want to get good at this stuff!
Thanks
-
[SOLVED] All work lost when computer is turned off?Hi @julian
I think I've figured it out now. I had a limited knowledge about Redis earlier, so I decided to learn about it properly. I managed to backup the database by following this guide http://www.tutorialspoint.com/redis/redis_backup.htm if anyone else is stuck on the same thing as me.
Thanks
-
Which installation method used for this forum?There did appear to be a guide in the docs on how to install a nodeBB installation on DigitalOcean (a VPS provider), but the link is now broken (or at least for me it is).
I'm not part of the nodeBB team, but yes, it does look like they are running their installation from an ubuntu build. This could be from within a Docker container, so their server architecture could actually be completely different. It's all down to preference though.
See here:
http://builtwith.com/?https%3A%2F%2Fcommunity.nodebb.org%2F -
[SOLVED] All work lost when computer is turned off?@Drew-Llewellyn
Wow that was a long read! haha.
So I now sort of understand the different backup methods in Redis. I'm only starting off small, so RDB will do for now as I don't need to perform data backups every single second.
I'm still a little unsure of where to go from here though. Have I lost all data of my NodeBB forum? I'm guessing I have, so I will need to backup the changes I've made to my theme and reinstall nodeBB again so the Redis datastore can be repopulated with the needed data?
Another question: once everything has been re-installed again, what is the proper procedure for backing up? I read in another topic on here that backups will be stored at
/var/lib/redis/dump.rdb
. This directory doesn't seem to exist on my disk at the moment-bash: cd: /var/lib/redis/: No such file or directory
so will it be generated automatically after I enter a command such as:save 60 1
within the redis-server terminal session?Sorry about all the questions, I want to commit some time to learning this stuff but it's quite a big step from PHP development. If I understand this well enough, I'm willing to contribute by writing some guides, or maybe even a book on NodeBB. I have a degree in computer science but I never realised how technical nodeBB was until I started reading the docs and these forums thoroughly. It's amazing how helpful the community is on here
Thanks again.
-
[SOLVED] All work lost when computer is turned off?I spent a whole day yesterday creating a custom theme, yet today I came back to continue working on it and my whole NodeBB forum has 'gone'. The only screen that seems to be visible is the register page (see screenshot below)
I'm receiving no errors in the console, nor the terminal:
16/7 12:34 [672] - info: Time: Thu Jul 16 2015 12:34:40 GMT+0100 (BST) 16/7 12:34 [672] - info: Initializing NodeBB v0.7.0 16/7 12:34 [672] - info: NodeBB Ready 16/7 12:34 [672] - info: NodeBB is now listening on: 0.0.0.0:4567
Has anyone else experienced this? I have absolutely no idea what's going on as I haven't even touched any core files, just my own theme files. I've tried resetting the default theme with
./nodebb reset theme
, as well resetting all plugins but I'm still facing the same issue.I know the details of this post are somewhat brief, but hopefully someone can help?
Thanks
Edit:
After some further reading, I have a feeling this issue is related to redis. Am I right in saying I've lost all posts and settings on my forum because I didn't 'save' my key store from the redis server? I did a tutorial on their website, but I didn't see anything about this. Again, any help would be greatly appreciated.
-
Using PHP sessions with nodebb?I'm a huge fan of nodebb, but there's one thing that's preventing me from making the switch from my existing forum software right now - the fact that you need separate login credentials just to use a forum.
Seen as like 80% of websites are written in PHP, it would be really nice if there was a way to share sessions from PHP to nodejs so that you can just navigate from domain.com to domain.com/forum without the entire nodebb forum software feeling sandboxed from the rest of a website.
Is this something someone has looked into? If so, could they provide any help as to how other developers could implement this sort of functionality within their websites?
Thanks
-
Who is using NodeBB?@dylenbrivera Your background image http://fivefoldkingdom.com/images/background.jpg is nearly 800kb! This is slightly too much to use on the web
-
NodeBB v0.2.0 releasedGood job!
Agreed with the comment above about the comment box though... It would make sense (UX wise) to have it under the posts instead of taking up half of the user's screen.