Voting (Part 1) : Candidates for Best Plugin - October 2014

Moved NodeBB Development

Suggested Topics


  • 0 Votes
    6 Posts
    2k Views

    Sure.

    library.js

    Plugin = module.exports; var categories = require.main.require('./src/categories'); // init hook Plugin.init = function (data, callback) { var router = data.router; var middleware = data.middleware; // Create route to render the template to. router.get('/example-categories', middleware.buildHeader, renderExampleCategories); router.get('/api/example-categories', renderExampleCategories); function renderExampleCategories(req, res, next) { // Get all the visible categories. categories.getCategoriesByPrivilege('cid:0:children', req.uid, 'find', function(err, categoryData) { if (err) return next(err); // Put the categories in a tree format. categories.flattenCategories([], categoryData); // Send the data to the template. `example-categories.tpl` res.render('example-categories', {categories: categoryData}); }); } };

    example-categories.tpl

    <!-- BEGIN categories --> <a href="{config.relative_path}/category/{categories.slug}" itemprop="url">{categories.name}</a> <br> <!-- BEGIN categories.children --> - <a href="{config.relative_path}/category/{categories.children.slug}" itemprop="url">{categories.children.name}</a> <br> <!-- END categories.children --> <!-- END categories -->

    Should give you a list like this

  • 0 Votes
    11 Posts
    3k Views

    @HolyPhoenix Thanks for catching that typo (I edited my comment, just now). I had correctly tried @psychobunny 's approach without luck but then typed it incorrectly.

    I found this post from @baris (https://community.nodebb.org/topic/5942/ajaxify-variables-get-deprecated) that says the .get('name') approach has been deprecated and that this style is current:

    ajaxify.data.tickettypes
  • 0 Votes
    2 Posts
    2k Views

    This is an old post, but have you found a solution? I have the exact same problem. I need a new user to be redirected to profile edit page to enter the email address.

    Thanks!

  • 1 Votes
    3 Posts
    1k Views

    @baris

    Ok, that's good to know. It's just that the discussion at get notifications when someone up or downs your post #1184 didn't clarify that.

  • 0 Votes
    4 Posts
    1k Views

    i swear these were randomly generated in my head.