Skip to content

Commit

Permalink
implement editPost WIP b00tc4mp#68
Browse files Browse the repository at this point in the history
  • Loading branch information
NerinaHctz committed Jun 17, 2024
1 parent 311a741 commit edd0fa4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 8 additions & 0 deletions staff/nerina-castillo/ponies/app/logic/editPost.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function editPost(id) {
var posts = getAllPosts();
var index = posts.findIndex(function (element) {
return element.id === id;
});

localStorage.posts = JSON.stringify(posts);
}
6 changes: 5 additions & 1 deletion staff/nerina-castillo/ponies/app/views/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ addPostButton.onclick = function () {
createPostForm.onsubmit = function (event) {
event.preventDefault();

// var postImageInput = document.getElementById('post-image-input')
var postImage = postImageInput.value;
var postCaption = postCaptionInput.value;

Expand Down Expand Up @@ -85,6 +84,11 @@ addPostButton.onclick = function () {
postCancelButton.type = "reset";
createPostForm.appendChild(postCancelButton);

var postCaptionEditButton = document.createElement("button");
postCaptionEditButton.innerText = "Edit";
postCaptionEditButton.type = "edit";
createPostForm.appendChild(postCaptionEditButton);

postCancelButton.onclick = function () {
document.body.removeChild(createPostSection);
};
Expand Down

0 comments on commit edd0fa4

Please sign in to comment.