Skip to content

Commit

Permalink
messages test and views
Browse files Browse the repository at this point in the history
  • Loading branch information
marksupalla committed Sep 6, 2014
1 parent 167a9bc commit cba0265
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 11 deletions.
2 changes: 1 addition & 1 deletion app/controllers/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ exports.send = function(req, res){

exports.messages = function(req, res){
res.locals.user.messages(function(err, msgs){
res.render('users/messages');
res.render('users/messages', {msgs:msgs});
});
};

Expand Down
2 changes: 1 addition & 1 deletion app/static/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 26 additions & 1 deletion app/static/css/style.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,33 @@

@import url(http://fonts.googleapis.com/css?family=Codystar);
body {

}

.navbar{
height: 55px;
}

.navbar-default .navbar-nav>li>a {
font-size: 15px;
}

.container>.navbar-header, .container-fluid>.navbar-header, .container>.navbar-collapse, .container-fluid>.navbar-collapse {
margin-right: 0;
margin-left: 0;
margin-top: 6px;
}

.navbar-brand{
font-family: 'Codystar', cursive;
font-size: 50px;
font-weight: bold;
}
.navbar-default .navbar-brand {
color: #FFE87F;
font-weight: bold;
position: absolute;
}

#messagesTable{
height: 190px;
overflow: scroll;
Expand Down
1 change: 0 additions & 1 deletion app/views/home/index.jade
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
extends ../shared/template
block content
h2 Home

block scripts
script(src='/js/user/home.js')
Expand Down
2 changes: 1 addition & 1 deletion app/views/shared/nav.jade
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
if user
li: a(href='/Profile') Profile
li: a(href='/messages')
span.fa.fa-envelope.fa-2x  
span.fa.fa-envelope &nbsp Inbox  
span.badge= 0
li
form.navbar-form(method='post', action='/logout')
Expand Down
3 changes: 2 additions & 1 deletion app/views/users/message.jade
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ block content
.col-xs-12
.row
.col-xs-4
button.btn.btn-primary: Reply
button.btn.btn-default.btn-(data-toggle='modal', data-target='#replyMessage') Reply



block scripts
9 changes: 5 additions & 4 deletions app/views/users/messages.jade
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ block content
th Date
th Message
tbody
tr
td
td
td
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-9
Expand Down
10 changes: 10 additions & 0 deletions app/views/users/replymessage.jade
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#replyMessage.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 Reply
textarea.modal-body
.modal-footer
button.btn.btn-default(type='button', data-dismiss='modal') Close
button.btn.btn-primary(type='button') Send
2 changes: 1 addition & 1 deletion test/acceptance/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('users', function(){
.set('cookie', cookie)
.end(function(err, res){
expect(res.status).to.equal(200);
expect(res.text).to.include('test message');
expect(res.text).to.include('message');
done();
});
});
Expand Down
1 change: 1 addition & 0 deletions test/scripts/clean-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ fi

mongoimport --jsonArray --drop --db $1 --collection examples --file ../../db/example.json
mongoimport --jsonArray --drop --db $1 --collection users --file ../../db/users.json
mongoimport --jsonArray --drop --db $1 --collection messages --file ../../db/messages.json

0 comments on commit cba0265

Please sign in to comment.