Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Post feed html #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 0 additions & 27 deletions .classpath

This file was deleted.

23 changes: 0 additions & 23 deletions .project

This file was deleted.

3 changes: 0 additions & 3 deletions .settings/org.eclipse.core.resources.prefs

This file was deleted.

6 changes: 0 additions & 6 deletions .settings/org.eclipse.jdt.core.prefs

This file was deleted.

48 changes: 45 additions & 3 deletions src/main/webapp/js/post-feed-loader.js
@@ -1,8 +1,50 @@
function setUpFeed () {
console.log("I hope it works");
fetch("/post-feed")
.then((response) => {
return response.json();
})
.then((posts) => {
const postContainer = document.getElementById('posts');
console.log(postContainer);

posts.forEach((post) => {
const postDiv = buildPostDiv(
post.coverImageUrl, post.title, post.creator, post.timestamp);
postContainer.appendChild(postDiv);
});
});

/*
var postDiv = buildPostDiv(
"https://images.pexels.com/photos/45201/kitty-cat-kitten-pet-45201.jpeg",
"A week in the 4th quadrant",
"ossalako@codeustudents",
new Date());

function setUpFeed () {
console.log("I hope it works");
}
const postContainer = document.getElementById('posts');
console.log(postContainer);
postContainer.appendChild(postDiv);
console.log(postContainer);
*/
}

function buildPostDiv(imageUrl, title, username, timestamp) {
const postDiv = document.createElement('div');
postDiv.classList.add('post');

const image = document.createElement('div');
image.innerHTML = '<img src="' + imageUrl + '" height="100" width="100"/>';

const titleP = document.createTextNode(title);
const descriptionP = document.createTextNode("By " + username + " on " + new Date(timestamp);

postDiv.appendChild(image);
postDiv.appendChild(titleP);
postDiv.appendChild(descriptionP);
console.log(image);
console.log(titleP);
console.log(descriptionP);

return postDiv;
}
5 changes: 3 additions & 2 deletions src/main/webapp/post-feed.html
Expand Up @@ -7,6 +7,7 @@
<script src="/js/post-feed-loader.js"></script>
</head>
<body onload="setUpFeed();">
Post-Feed
<div id="posts">
</div>
</body>
</html>
</html>
Binary file removed target/codeu-starter-project-0.0.1-SNAPSHOT.war
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
21 changes: 0 additions & 21 deletions target/codeu-starter-project-0.0.1-SNAPSHOT/WEB-INF/index.yaml

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
33 changes: 0 additions & 33 deletions target/codeu-starter-project-0.0.1-SNAPSHOT/css/main.css

This file was deleted.

48 changes: 0 additions & 48 deletions target/codeu-starter-project-0.0.1-SNAPSHOT/css/user-page.css

This file was deleted.

17 changes: 0 additions & 17 deletions target/codeu-starter-project-0.0.1-SNAPSHOT/feed.html

This file was deleted.

36 changes: 0 additions & 36 deletions target/codeu-starter-project-0.0.1-SNAPSHOT/index.html

This file was deleted.

58 changes: 0 additions & 58 deletions target/codeu-starter-project-0.0.1-SNAPSHOT/js/feed-loader.js

This file was deleted.