Skip to content

Commit

Permalink
Adds owner's name and email on talk's edit and detail screen.
Browse files Browse the repository at this point in the history
  • Loading branch information
jneto committed Feb 5, 2015
1 parent d893a6f commit 422bdf2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 2 additions & 2 deletions controller/talk.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ var Talk = require('../models/talk');
module.exports = function() {
return {
list: function(filters, callback) {
Talk.find(filters).populate('event').exec(callback);
Talk.find(filters).populate('event owner').exec(callback);
},
get: function(id, callback) {
Talk.findById(id).populate('event').exec(callback);
Talk.findById(id).populate('event owner').exec(callback);
},
new: function(talk, userLogged) {
var newTalk = new Talk();
Expand Down
2 changes: 1 addition & 1 deletion routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ var setEventIsDeleteableAndUpdatable = function(event, userLogged) {
}

var setTalkIsDeleteableAndUpdatable = function(talk, userLogged) {
if (talk.owner == userLogged._id.toString()) {
if (talk.owner._id.toString() == userLogged._id.toString()) {
talk.isDeleteable = true;
talk.isUpdatable = true;
} else if (talk.event.owner == userLogged._id.toString()) {
Expand Down
6 changes: 6 additions & 0 deletions views/talk-detail.jade
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ block content
div.form-group
label.detail-label.col-sm-2 Event
p.col-sm-10= talk.event.name
div.form-group
label.detail-label.col-sm-2 Owner name
p.col-sm-10= talk.owner.name
div.form-group
label.detail-label.col-sm-2 Owner e-mail
p.col-sm-10= talk.owner.email
6 changes: 6 additions & 0 deletions views/talk-edit.jade
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ block content
div.form-group
label.detail-label.col-sm-2 Event
p.col-sm-10= talk.event.name
div.form-group
label.detail-label.col-sm-2 Owner name
p.col-sm-10= talk.owner.name
div.form-group
label.detail-label.col-sm-2 Owner e-mail
p.col-sm-10= talk.owner.email
input(type='hidden', name='talkEvent', value=talk.event.id)
input(type='hidden', value=talk.id, name='talkId')
button(type='submit', class='btn btn-primary pull-right') Salvar palestra!

0 comments on commit 422bdf2

Please sign in to comment.