diff --git a/models/Comment.js b/models/Comment.js index 1a3a1639ce..9f71c32591 100644 --- a/models/Comment.js +++ b/models/Comment.js @@ -2,10 +2,23 @@ var mongoose = require('mongoose'); var secrets = require('../config/secrets'); var commentSchema = new mongoose.Schema({ - rank: { type: Number, default: -Infinity }, - upVotes: { type: Array, default: [] }, + associatedPost: { + type: String, + required: true + }, + rank: { + type: Number, + default: -Infinity + }, + upVotes: { + type: Array, + default: [] + }, author: {}, - comments: { type: Array, default: [] } + comments: { + type: Array, + default: [] + } }); module.exports = mongoose.model('Comment', commentSchema); \ No newline at end of file diff --git a/views/post/comments.jade b/views/post/comments.jade new file mode 100644 index 0000000000..e3f19430ed --- /dev/null +++ b/views/post/comments.jade @@ -0,0 +1,25 @@ +h6 + ul#comment-list.comment-list + + script(src="https://cdn.jsdelivr.net/ramda/0.10.0/ramda.min.js") + h1 Super tired folks, going to call it a night + // + script. + var getLinkedName = function getLinkedName(name) { + return name.toLowerCase().replace(/\s/g, '-'); + } + $.ajax({ + url: '/stories/index', + type: 'GET' + }) + .success( + function(data) { + for (var i = 0; i < data.length; i++) { + var li = document.createElement('li'); + var linkedName = getLinkedName(data[i].headline); + var rank = data[i].rank; + + $(li).html("
" + data[i].headline + "
" + rank + "
" + data[i].author.username + "
"); + $(li).appendTo($('#story-list')); + } + }); \ No newline at end of file diff --git a/views/post/show.jade b/views/post/show.jade index 5e190f0909..698701115c 100644 --- a/views/post/show.jade +++ b/views/post/show.jade @@ -16,6 +16,13 @@ block content i.ion-arrow-up-b .col-xs-10.text-center h3= body + .row.negative-35 + h3.col-xs-12.col-md-6.col-lg-5.text-center Comments + .row + .col-xs-12.col-md-6.col-lg-5 + textarea#comment-box.form-control(name="comment-box", rows=5) + .row + include ./comments