-
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
13 changed files
with
288 additions
and
3 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,47 @@ | ||
'use strict'; | ||
|
||
var async = require('async'), | ||
Mongo = require('mongodb'); | ||
|
||
function Message(senderId, receiverId, message){ | ||
this.senderId = senderId; | ||
this.receiverId = receiverId; | ||
this.message = message; | ||
this.date = new Date(); | ||
this.isRead = false; | ||
} | ||
|
||
Object.defineProperty(Message, 'collection', { | ||
get: function(){return global.mongodb.collection('messages');} | ||
}); | ||
|
||
Message.read = function(id, cb){ | ||
var _id = Mongo.ObjectID(id); | ||
Message.collection.findAndModify({_id:_id}, [], {$set:{isRead:true}}, function(err, msg){ | ||
iterator(msg, cb); | ||
}); | ||
}; | ||
|
||
Message.send = function(senderId, receiverId, message, cb){ | ||
var m = new Message(senderId, receiverId, message); | ||
Message.collection.save(m, cb); | ||
}; | ||
|
||
Message.unread = function(receiverId, cb){ | ||
Message.collection.find({receiverId:receiverId, isRead:false}).count(cb); | ||
}; | ||
|
||
Message.messages = function(receiverId, cb){ | ||
Message.collection.find({receiverId:receiverId}).sort({date:-1}).toArray(function(err, msgs){ | ||
async.map(msgs, iterator, cb); | ||
}); | ||
}; | ||
|
||
module.exports = Message; | ||
|
||
function iterator(msg, cb){ | ||
require('./user').findById(msg.senderId, function(err, sender){ | ||
msg.sender = sender; | ||
cb(null, msg); | ||
}); | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,66 @@ | ||
extends ../shared/template | ||
block content | ||
.panel.panel-default | ||
.panel-body | ||
.row | ||
.col-xs-4 | ||
h2 user.alias | ||
.col-xs-4 | ||
ul.list-inline | ||
li | ||
h5 user.age | ||
li | ||
h5 user.gender | ||
li | ||
h5 user.location | ||
.col-xs-2 | ||
a.thumbnail#alias(href='#') | ||
img(src='/img/node.png') | ||
.col-xs-2.col-xs-offset-1 | ||
span.glyphicon.glyphicon-heart | ||
.col-xs-4 | ||
|
||
button.btn.btn-default.btn-(data-toggle='modal', data-target='#newMessage') Message | ||
include newMessage | ||
button.btn.btn-default.btn-(data-toggle='modal', data-target='#gift') Gift | ||
#gift.modal.fade(tabindex='-1', role='dialog', aria-labelledby='giftlLabel', aria-hidden='true') | ||
.modal-dialog | ||
.modal-content | ||
.modal-header | ||
button.close(type='button', data-dismiss='modal', aria-hidden='true') × | ||
h4.modal-title Send a Gift | ||
textarea.modal-body | ||
.modal-footer | ||
button.btn.btn-default(type='button', data-dismiss='modal') Close | ||
button.btn.btn-primary(type='button') Send | ||
button.btn.btn-default.btn-(data-toggle='modal', data-target='wink') Wink | ||
span.glyphicon.glyphicon-eye-open | ||
|
||
.row | ||
.col-xs-12 | ||
.panel.panel-default | ||
.panel-heading | ||
h3.panel-title About # {client.alias}panel,f | ||
.panel-body | ||
h6 This is the About Me Section of the Profile Page | ||
.row | ||
.col-xs-12 | ||
#carousel-example-generic.carousel.slide(data-ride='carousel') | ||
ol.carousel-indicators | ||
li.active(data-target='#carousel-example-generic', data-slide-to='0') | ||
li.active(data-target='#carousel-example-generic', data-slide-to='1') | ||
li.active(data-target='#carousel-example-generic', data-slide-to='2') | ||
.carousel-inner | ||
.item.active | ||
img(src='/img/node.png') | ||
.item | ||
img(src='/img/node.png') | ||
a.left.carousel-control(href='#carousel-example-generic', role='button', data-slide='prev') | ||
span.glyphicon.glyphicon-chevron-left | ||
a.right.carousel-control(href='#carousel-example-generic', role='button', data-slide='prev') | ||
span.glyphicon.glyphicon-chevron-right | ||
|
||
|
||
|
||
|
||
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,51 @@ | ||
extends ../shared/template | ||
block content | ||
.row | ||
.col-xs-12 | ||
.panel.panel-primary | ||
.panel-heading | ||
h3.panel-title Messages | ||
.panel-body | ||
.table-responsive | ||
table.table.table-hover.table-bordered#messagesTable | ||
thead | ||
th From | ||
th Date | ||
th Message | ||
tbody | ||
each msg in msgs | ||
tr(style='background-color:#{msg.isRead ? "#ECECEC" : "#8C8A8D"}') | ||
td: a(href='/users/#{msg.sender.email}')= msg.sender.name | ||
td= msg.date.toDateString() | ||
td: a(href='/messages/#{msg._id}')= (msg.message.slice(0, 20) + ' .....') | ||
.col-xs-12 | ||
.row | ||
.col-xs-6 | ||
.panel.panel-primary | ||
.panel-heading | ||
h3.panel-title Proposals | ||
.panel-body | ||
.table-responsive | ||
table.table.table-hover.table-bordered#proposalsTable | ||
thead | ||
th From | ||
th Date | ||
th Activity | ||
th Message | ||
tbody | ||
each msg in msgs | ||
tr(style='background-color:#{msg.isRead ? "#ECECEC" : "#8C8A8D"}') | ||
td: a(href='/users/#{msg.sender.email}')= msg.sender.name | ||
td= msg.date.toDateString() | ||
td: a(href='/messages/#{msg._id}')= (msg.message.slice(0, 20) + ' .....') | ||
.col-xs-6 | ||
.panel.panel-primary | ||
.panel-heading | ||
h3.panel-title Proposals | ||
.panel-body | ||
.table-responsive | ||
table.table.table-hover.table-bordered#proposalsTable | ||
thead | ||
th From | ||
|
||
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,16 @@ | ||
extends ../shared/template | ||
block content | ||
.row | ||
.col-xs-12 | ||
h3 Message from sender.name | ||
.panel.panel-success | ||
.panel-body | ||
p Date | ||
h4 msg.message | ||
.col-xs-12 | ||
.row | ||
.col-xs-4 | ||
button.btn.btn-primary: Reply | ||
|
||
|
||
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,53 @@ | ||
extends ../shared/template | ||
block content | ||
.row | ||
.col-xs-12 | ||
.panel.panel-success | ||
.panel-heading | ||
h3.panel-title Messages | ||
.panel-body | ||
.table-responsive | ||
table.table.table-hover.table-bordered#messagesTable | ||
thead | ||
th From | ||
th Date | ||
th Message | ||
tbody | ||
tr | ||
td | ||
td | ||
td | ||
.col-xs-12 | ||
.row | ||
.col-xs-9 | ||
.panel.panel-info | ||
.panel-heading | ||
h3.panel-title Date Proposals | ||
.panel-body | ||
.table-responsive | ||
table.table.table-hover.table-bordered#proposalsTable | ||
thead | ||
th From | ||
th Date | ||
th Activity | ||
th Message | ||
tbody | ||
tr | ||
td | ||
td | ||
td | ||
td | ||
.col-xs-3 | ||
.panel.panel-danger | ||
.panel-heading | ||
h3.panel-title Winks | ||
.panel-body | ||
.table-responsive | ||
table.table.table-hover.table-bordered#winksTable | ||
thead | ||
th From | ||
tbody | ||
tr | ||
td | ||
|
||
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
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,10 @@ | ||
#newMessage.modal.fade(tabindex='-1', role='dialog', aria-labelledby='messageLabel', aria-hidden='true') | ||
.modal-dialog | ||
.modal-content | ||
.modal-header | ||
button.close(type='button', data-dismiss='modal', aria-hidden='true') × | ||
h4.modal-title Send a Message | ||
textarea.modal-body | ||
.modal-footer | ||
button.btn.btn-default(type='button', data-dismiss='modal') Close | ||
button.btn.btn-primary(type='button') Send |
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 |
---|---|---|
@@ -1,8 +1,31 @@ | ||
extends ../shared/template | ||
block content | ||
h2 Profile | ||
.panel.panel-default | ||
.panel-body | ||
a(href='profile/edit') Edit Profile | ||
.row | ||
.col-xs-2 | ||
a.thumbnail#profile(href='/profile/photos') | ||
img(src='/img/node.png') | ||
.col-xs-6 | ||
a(href='/profile/about') | ||
h2 user.alias | ||
ul.list-inline | ||
li | ||
h5 user.age | ||
li | ||
h5 user.gender | ||
li | ||
h5 user.location | ||
.col-xs-2 | ||
|
||
.panel.panel-info | ||
.panel-heading | ||
h3#about.panel-title About Me | ||
.panel-body | ||
h6 This is the About Me Section of the Profile Page | ||
|
||
|
||
|
||
|
||
|
||
block scripts |
Empty file.