Removed lag before showing "Add comment" form
This commit is contained in:
parent
6e09f90251
commit
94e1b8ecdb
1 changed files with 10 additions and 7 deletions
|
@ -35,23 +35,26 @@ App.Presenters.PostCommentListPresenter = function(
|
||||||
promise.wait(
|
promise.wait(
|
||||||
util.promiseTemplate('post-comment-list'),
|
util.promiseTemplate('post-comment-list'),
|
||||||
util.promiseTemplate('comment-list-item'),
|
util.promiseTemplate('comment-list-item'),
|
||||||
util.promiseTemplate('comment-form'),
|
util.promiseTemplate('comment-form'))
|
||||||
comments.length === 0 ? api.get('/comments/' + args.post.id) : null)
|
|
||||||
.then(function(
|
.then(function(
|
||||||
commentListTemplate,
|
commentListTemplate,
|
||||||
commentListItemTemplate,
|
commentListItemTemplate,
|
||||||
commentFormTemplate,
|
commentFormTemplate)
|
||||||
commentsResponse)
|
|
||||||
{
|
{
|
||||||
templates.commentList = commentListTemplate;
|
templates.commentList = commentListTemplate;
|
||||||
templates.commentListItem = commentListItemTemplate;
|
templates.commentListItem = commentListItemTemplate;
|
||||||
templates.commentForm = commentFormTemplate;
|
templates.commentForm = commentFormTemplate;
|
||||||
if (commentsResponse) {
|
|
||||||
comments = commentsResponse.json.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
render();
|
render();
|
||||||
loaded();
|
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)); });
|
.fail(function() { console.log(new Error(arguments)); });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue