Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _getPost(post){
- const model = this._postModel.cloneNode(true);
- model.setAttribute('data-id', this._size);
- model.querySelector('.name p').textContent = post.author;
- model.querySelector('.date p').textContent = this._formatDate(post.createdAt);
- model.querySelector('.time p').textContent = this._formatTime(post.createdAt);
- model.querySelector('.message h1').textContent = post.description;
- model.querySelector('.tags').innerHTML = '';
- const tagsContainer = model.querySelector('.tags');
- const tag = document.createElement('a');
- tag.setAttribute('href', '#');
- post.hashTags.forEach(item=>{
- tag.textContent = item;
- tagsContainer.appendChild(tag.cloneNode(true));
- });
- model.querySelector('.photo img').setAttribute('src', post.photoLink);
- model.querySelector('.count1 p').textContent = post.likes.length;
- return model;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement