Removed lag before showing "Add comment" form

This commit is contained in:
Marcin Kurczewski 2014-10-05 16:40:38 +02:00
parent 6e09f90251
commit 94e1b8ecdb

View file

@ -35,23 +35,26 @@ App.Presenters.PostCommentListPresenter = function(
promise.wait(
util.promiseTemplate('post-comment-list'),
util.promiseTemplate('comment-list-item'),
util.promiseTemplate('comment-form'),
comments.length === 0 ? api.get('/comments/' + args.post.id) : null)
util.promiseTemplate('comment-form'))
.then(function(
commentListTemplate,
commentListItemTemplate,
commentFormTemplate,
commentsResponse)
commentFormTemplate)
{
templates.commentList = commentListTemplate;
templates.commentListItem = commentListItemTemplate;
templates.commentForm = commentFormTemplate;
if (commentsResponse) {
comments = commentsResponse.json.data;
}
render();
loaded();
if (comments.length === 0) {
promise.wait(api.get('/comments/' + args.post.id))
.then(function(response) {
comments = response.json.data;
render();
});
}
})
.fail(function() { console.log(new Error(arguments)); });
}