diff --git a/views/articles/edit.ejs b/views/articles/edit.ejs index 318eb6b..3029aa5 100644 --- a/views/articles/edit.ejs +++ b/views/articles/edit.ejs @@ -27,8 +27,16 @@ Choose and author: - <% for(var i = 0; i < authors.length; i++) { %> - <%=authors[i].name %> + <% for(var currentAuthorIndex = 0; currentAuthorIndex < authors.length; currentAuthorIndex++) { %> + <% + var isAuthor = false; + for(var currentArticleIndex = 0; currentArticleIndex < authors[currentAuthorIndex].articles.length; currentArticleIndex++){ + if(authors[currentAuthorIndex].articles[currentArticleIndex]._id.toString() == article._id.toString()){ + isAuthor = true; + } + } + %> + ><%=authors[currentAuthorIndex].name %> <% } %>