-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
306 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
'use strict'; | ||
|
||
|
||
var Mongo = require('mongodb'), | ||
_ = require('underscore-contrib'); | ||
|
||
function Proposal(){ | ||
} | ||
|
||
Object.defineProperty(Proposal, 'collection', { | ||
get: function(){return global.mongodb.collection('proposals');} | ||
}); | ||
|
||
Proposal.findById = function(id, cb){ | ||
var _id = Mongo.ObjectID(id); | ||
Proposal.collection.findOne({_id:_id}, function(err, obj){ | ||
var user = Object.create(Proposal.prototype); | ||
user = _.extend(user, obj); | ||
cb(err, user); | ||
}); | ||
}; | ||
|
||
Proposal.find = function(userId, cb){ | ||
var _id = Mongo.ObjectID(userId); | ||
Proposal.collection.find({receiverId: _id}).toArray(cb); | ||
}; | ||
|
||
|
||
module.exports = Proposal; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
extends ../shared/template | ||
block content | ||
h2 People You've Licked | ||
.row | ||
.col-xs-3 | ||
.col-xs-6 | ||
if licks | ||
table.table | ||
tr | ||
th Display Name | ||
th Photo | ||
th Date Request | ||
|
||
each lickee in licks | ||
tr | ||
td= lickee.username | ||
td: img(src=lickee.primaryPhoto || '/img/no.jpeg' style='width: 25%') | ||
td | ||
form(method='post' action='/user/#{lickee._id}/propose') | ||
button.btn.btn-danger(type='submit') Propose a date! | ||
else | ||
.row You haven't licked anyone... | ||
|
||
|
||
if proposals | ||
table.table | ||
tr | ||
th Display Name | ||
th Photo | ||
th Accept | ||
th Decline | ||
each proposal, index in proposals | ||
tr | ||
td= users[index].username | ||
td: img(src=users[index].primaryPhoto || '/img/no.jpeg' style='width: 25%') | ||
td | ||
form(method='post' action='/proposal/#{proposal.fromId}/accept') | ||
input(type='hidden', name='proposalId' value=proposal._id) | ||
input(type='hidden', name='_method', value='delete') | ||
|
||
button.btn.btn-danger(type='submit') Accept | ||
td | ||
form(method='post' action='/proposal/#{proposal.fromId}/decline') | ||
input(type='hidden', name='proposalId' value=proposal._id) | ||
input(type='hidden', name='_method', value='delete') | ||
button.btn.btn-danger(type='submit') Decline | ||
else | ||
.row Nobody has sent you a date proposal... | ||
.col-xs-3 | ||
|
||
|
||
block scripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"_id" : {"$oid":"000000000000000000000011"}, | ||
"receiverId" : {"$oid":"000000000000000000000001"}, | ||
"fromId" : {"$oid":"000000000000000000000003"} | ||
} | ||
|
||
{ | ||
"_id" : {"$oid":"000000000000000000000022"}, | ||
"receiverId" : {"$oid":"000000000000000000000001"}, | ||
"fromId" : {"$oid":"000000000000000000000002"} | ||
} | ||
|
||
{ | ||
"_id" : {"$oid":"000000000000000000000033"}, | ||
"receiverId" : {"$oid":"000000000000000000000003"}, | ||
"fromId" : {"$oid":"000000000000000000000001"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
0 info it worked if it ends with ok | ||
1 verbose cli [ '/usr/local/node/bin/node', '/usr/local/node/bin/npm', 'test' ] | ||
2 info using npm@1.4.14 | ||
3 info using node@v0.10.29 | ||
4 error Error: ENOENT, open '/home/nss/apps/code/furry-farm/test/acceptance/package.json' | ||
5 error If you need help, you may report this *entire* log, | ||
5 error including the npm and node versions, at: | ||
5 error <http://github.com/npm/npm/issues> | ||
6 error System Linux 3.13.0-24-generic | ||
7 error command "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "test" | ||
8 error cwd /home/nss/apps/code/furry-farm/test/acceptance | ||
9 error node -v v0.10.29 | ||
10 error npm -v 1.4.14 | ||
11 error path /home/nss/apps/code/furry-farm/test/acceptance/package.json | ||
12 error code ENOENT | ||
13 error errno 34 | ||
14 verbose exit [ 34, true ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.