Permalink
Browse files

1

  • Loading branch information...
1 parent d06600d commit 96c90737e4d5574e291db7349a969376c193cfb5 @hiroprotagonist committed Apr 2, 2012
View
@@ -134,9 +134,16 @@ var fireWall = [loadUser, updateGranted];
// UI routes
app.get('/', loadUser, routes.index);
app.get('/you', loadUser, routes.you);
+app.get('/all', loadUser, routes.all);
// app.get('/documents', loadUser, routes.index);
// Service routes
+app.get('/users', loadUser, function(req, res) {
+ User.find(function(error, users) {
+ if( error ) res.json({msg: "Failed listing users"}, 500);
+ else res.json(users, 200);
+ });
+});
app.get('/users/:id', loadUser, function(req, res) {
res.json( req.user, 200 );
});
@@ -18,7 +18,7 @@ var ccd = {
}(),
templates: {
you: '<div class="plate <%= colorClass %>" date-phase="<%= data.phase %>" id="<%= data._id %>" style="background: <%= data.phase %>;">\
- <div class="name"><%= data.name %></div>\
+ <div class="name"><%= data.login %></div>\
<div class="day"><%= data.day %></div>\
<button data-role="increase-day">+</button>\
</div>'
@@ -11,3 +11,7 @@ exports.index = function(req, res){
exports.you = function( req, res ) {
res.render ( 'user/you', {user: req.user} );
}
+exports.all = function( req, res ) {
+ res.render ( 'user/all', {user: req.user} );
+}
+
@@ -0,0 +1,12 @@
+h1= 'Brave nerds of our time'
+div(id='main')
+a(href='/logout') Logout
+a(href='/you') You
+script(type='text/javascript')
+ jQuery(function($) {
+ // Initialize your application here.
+ var module_user = ccd.module('user');
+ var users = new module_user.List;
+ var listview = new module_user.Listview({ 'el': $('#main'), collection: users });
+ users.fetch();
+ });
@@ -3,6 +3,7 @@ p Welcome to #{user.login}
p Your id is #{user.id}
div(id='main')
a(href='/logout') Logout
+a(href='/all') See who is also using ccd
script(type='text/javascript')
jQuery(function($) {
// Initialize your application here.

0 comments on commit 96c9073

Please sign in to comment.