From 7bdbb966aae1307fa751fa459b96dd76cb725718 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 22 May 2014 15:23:19 -0400 Subject: [PATCH] groups pages WIP --- src/controllers/groups.js | 19 +++++++++++++++++++ src/controllers/index.js | 20 ++++++++++---------- src/routes/index.js | 6 +++++- 3 files changed, 34 insertions(+), 11 deletions(-) create mode 100644 src/controllers/groups.js diff --git a/src/controllers/groups.js b/src/controllers/groups.js new file mode 100644 index 0000000000..68dfa53a60 --- /dev/null +++ b/src/controllers/groups.js @@ -0,0 +1,19 @@ +"use strict"; + +var groups = require('../groups'), + + groupsController = {}; + +groupsController.list = function(req, res) { + groups.list({ + truncateUserList: true, + expand: true + }, function(err, groups) { + console.log(groups); + res.render('groups/list', { + groups: groups + }); + }); +}; + +module.exports = groupsController; diff --git a/src/controllers/index.js b/src/controllers/index.js index 1e5c920463..12ffef2132 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -4,6 +4,7 @@ var topicsController = require('./topics'), categoriesController = require('./categories'), tagsController = require('./tags'), usersController = require('./users'), + groupsController = require('./groups'), accountsController = require('./accounts'), staticController = require('./static'), apiController = require('./api'), @@ -11,22 +12,21 @@ var topicsController = require('./topics'), async = require('async'), nconf = require('nconf'), - auth = require('./../routes/authentication'), - meta = require('./../meta'), - user = require('./../user'), - posts = require('./../posts'), - topics = require('./../topics'), - plugins = require('./../plugins'), - categories = require('./../categories'), + auth = require('../routes/authentication'), + meta = require('../meta'), + user = require('../user'), + posts = require('../posts'), + topics = require('../topics'), + plugins = require('../plugins'), + categories = require('../categories'), privileges = require('../privileges'); - - var Controllers = { topics: topicsController, categories: categoriesController, tags: tagsController, users: usersController, + groups: groupsController, accounts: accountsController, static: staticController, api: apiController, @@ -241,7 +241,7 @@ Controllers.confirmEmail = function(req, res, next) { }; Controllers.sitemap = function(req, res, next) { - var sitemap = require('./../sitemap.js'); + var sitemap = require('../sitemap.js'); sitemap.render(function(xml) { res.header('Content-Type', 'application/xml'); diff --git a/src/routes/index.js b/src/routes/index.js index faa1f5a52a..a4021169fd 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -136,6 +136,10 @@ function userRoutes(app, middleware, controllers) { app.get('/api/users/search', middleware.checkGlobalPrivacySettings, controllers.users.getUsersForSearch); } +function groupRoutes(app, middleware, controllers) { + app.get('/groups', middleware.buildHeader, controllers.groups.list); +} + module.exports = function(app, middleware) { app.namespace(nconf.get('relative_path'), function() { @@ -165,7 +169,7 @@ module.exports = function(app, middleware) { categoryRoutes(app, middleware, controllers); accountRoutes(app, middleware, controllers); userRoutes(app, middleware, controllers); - + groupRoutes(app, middleware, controllers); }); if (process.env.NODE_ENV === 'development') {