This commit is contained in:
Michael Q Larson
2015-03-09 00:27:23 -07:00
4 changed files with 26 additions and 16 deletions

View File

@ -298,7 +298,7 @@ module.exports = {
});
})();
},
updateUserStoryPictures: function(userId, picture) {
updateUserStoryPictures: function(userId, picture, username) {
var counter = 0,
foundStories,
@ -327,12 +327,14 @@ module.exports = {
}
R.forEach(function(comment) {
comment.author.picture = picture;
comment.author.username = username;
comment.markModified('author');
comment.save();
}, foundComments);
R.forEach(function(story) {
story.author.picture = picture;
story.author.username = username;
story.markModified('author');
story.save();
}, foundStories);

View File

@ -350,7 +350,7 @@ exports.postUpdateProfile = function(req, res, next) {
}
req.flash('success', {msg: 'Profile information updated.'});
res.redirect('/account');
resources.updateUserStoryPictures(user._id.toString(), user.profile.picture);
resources.updateUserStoryPictures(user._id.toString(), user.profile.picture, user.profile.username);
});
});
});

View File

@ -57,29 +57,33 @@
$('.comment-a-comment').on('click', 'a', function () {
$(this).unbind('click');
$('.comment-to-comment-formgroup').empty();
$('#initial-comment-submit').addClass('hidden-element');
var div = document.createElement('div');
var commentId = $(this).attr('id');
$(div).html(
"<div class='formgroup comment-to-comment-formgroup'>" +
"<div class=col-xs-12" +
"<div class='formgroup comment-to-comment-formgroup control-label-story-submission'>" +
'<div class="col-xs-12">' +
"<div class='input-group'>" +
"<input class='form-control' id='comment-to-comment-textarea' type='text' maxlength='140' autofocus />" +
"</div>" +
"</div>" +
"<input class='form-control big-text-field field-responsive' id='comment-to-comment-textinput' type='text' maxlength='140' autofocus />" +
"<span class='input-group-btn'>" +
"<button id='submit-comment-to-comment' class='btn btn-big btn-primary btn-responsive' type='button'>Send</button>" +
"<button id='submit-comment-to-comment' class='btn btn-big btn-primary btn-responsive'>Send</button>" +
"</span>" +
"<span class='pull-left' id='textarea_feedback'></span>" +
"</div>" +
"</div>" +
"<div id='textarea-comment-feedback'></div>" +
"</div>"
)
.addClass('row')
.appendTo($(this).closest('.media-body-wrapper'));
var text_max = 140;
$('#textarea_feedback').html(text_max + ' characters remaining');
$('#comment-to-comment-textarea').keyup(function () {
var text_length = $('#comment-to-comment-textarea').val().length;
$('#textarea-comment-feedback').html(text_max + ' characters remaining');
$('#comment-to-comment-textinput').keyup(function (e) {
if (e.which === 13 || e === 13) {
$('#submit-comment-to-comment').click();
}
var text_length = $('#comment-to-comment-textinput').val().length;
var text_remaining = text_max - text_length;
$('#textarea_feedback').html(text_remaining + ' characters remaining');
$('#textarea-comment-feedback').html(text_remaining + ' characters remaining');
});
var submitCommentToCommentHandler = function submitCommentToCommentHandler() {
$('#submit-comment-to-comment').unbind('click');
@ -87,7 +91,7 @@
{
data: {
associatedPost: commentId,
body: $('#comment-to-comment-textarea').val(),
body: $('#comment-to-comment-textinput').val(),
author: {
picture: user.profile.picture,
userId: user._id,

View File

@ -41,7 +41,8 @@
input#comment-box.big-text-field.field-responsive.form-control(type='text', placeholder='Enter your reply', autofocus)
span.input-group-btn
button#comment-button.btn.btn-big.btn-primary.btn-responsive(type='button') Send
span.pull-left#textarea_feedback
span.spacer.pull-left#textarea_feedback
script.
$('#reply-to-main-post').on('click', function() {
$('#initial-comment-submit').removeClass('hidden-element');
@ -50,7 +51,10 @@
});
var text_max = 140;
$('#textarea_feedback').html(text_max + ' characters remaining');
$('#comment-box').keyup(function () {
$('#comment-box').keyup(function (e) {
if (e.which === 13 || e === 13) {
$('#comment-button').click();
}
var text_length = $('#comment-box').val().length;
var text_remaining = text_max - text_length;
$('#textarea_feedback').html(text_remaining + ' characters remaining');