Skip to content

Commit

Permalink
wip #127 #131 added backend support for searching by email and also m…
Browse files Browse the repository at this point in the history
…odified chat box CSS in preparation for top level menu
  • Loading branch information
jacobrs committed Apr 1, 2017
1 parent ecf7fea commit 03ce308
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
18 changes: 15 additions & 3 deletions client/modules/User/components/ChatComponent/ChatComponent.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
#message-area {
background-color: white;
overflow-y:scroll;
height: 90%;
background-color: white;
overflow-y:scroll;
height: calc(100% - 40px);
}

#message-input {
height: 40px;
}

#message-wrapper {
height: 99%;
}

#message-send:hover{
cursor: pointer;
}
9 changes: 5 additions & 4 deletions client/modules/User/components/ChatComponent/ChatComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,14 @@ export class ChatComponent extends Component {
}

return (
<div className="col-md-9">
<div className="col-md-9" id={styles['message-wrapper']}>
<div className="row-md-3 border rounded" id={styles['message-area']}>
{this.props.users.chat.messages}
</div>
<div className="row">
<textarea className="col-md-11 form-control" rows="3" value={this.state.value} onKeyDown={this.handleKeyDown} onChange={this.handleChange} ></textarea>
<button className="col-md-1 btn btn-primary" onClick={this.sendMessage}>Send</button>
<div className="row" id={styles['message-input']}>
<textarea className="col-md-9 form-control" rows="3" placeholder="Write a message to the group"
value={this.state.value} onKeyDown={this.handleKeyDown} onChange={this.handleChange} ></textarea>
<button className="col-md-3 btn btn-primary" onClick={this.sendMessage} id={styles['message-send']}>Send</button>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
text-decoration: none;
}

.studyGroup ul li a:hover{
.studyGroup ul li:hover{
background-color: #555;
color: #fff;
cursor: pointer;
}

h4{
Expand Down
10 changes: 10 additions & 0 deletions server/controllers/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,4 +167,14 @@ export function deleteUserStudyGroups(req, res) {
});
}

export function search(req, res){
User.find({"email" : { $regex: req.params.term, $options : 'i'} }).exec((err, users) => {
if (err) {
return res.json({users:[]});
}else{
return res.json({users: users});
}
});
}

// need: delete specific user study group
3 changes: 3 additions & 0 deletions server/routes/user.routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ router.route('/').get(ensureAuthenticated, UserController.getUsers);
// Refresh session
router.route('/me').get(ensureAuthenticated, UserController.authenticateUser);

// Search for user
router.route('/search/:term').get(ensureAuthenticated, UserController.search);

// Log user out
router.route('/logout').get(ensureAuthenticated, UserController.logoutUser);

Expand Down

0 comments on commit 03ce308

Please sign in to comment.