Skip to content

Commit

Permalink
Implement create new post using OOP(WIP) b00tc4mp#391
Browse files Browse the repository at this point in the history
  • Loading branch information
PereHDZ committed Mar 14, 2024
1 parent 92e0725 commit f6612d0
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
6 changes: 6 additions & 0 deletions staff/pere-hernandez/isdigram/home/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ function Footer (){

createPostButton.add(createPostImage)

createPostButton.onClick(function (){
var postFormSection = new PostFormSection

home.add(postFormSection)
})

this.add(createPostButton)
}

Expand Down
1 change: 1 addition & 0 deletions staff/pere-hernandez/isdigram/home/components/Post.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function Post (post){

if (post.author.id === logic.getLoggedInUserId()){
var postButtonsBar = new PostButtonsBar
postButtonsBar.setId('post-buttons-bar')

this.add(postButtonsBar)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ function PostButtonsBar (){

var deletePostButton = new Button
deletePostButton.setText('Delete')
deletePostButton.setId('delete-post-button')

var editPostButton = new Button
editPostButton.setText('Edit')
editPostButton.setId('edit-post-button')

this.add(deletePostButton, editPostButton)
}
Expand Down
5 changes: 5 additions & 0 deletions staff/pere-hernandez/isdigram/home/components/PostForm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function PostForm () {
Component.call(this, 'form')


}
13 changes: 13 additions & 0 deletions staff/pere-hernandez/isdigram/home/components/PostFormSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function PostFormSection () {
Component.call(this, 'section')

var postForm = new PostForm

var returnButton = new Button
returnButton.setId('return')

this.add(postForm, returnButton)
}

PostFormSection.prototype = Object.create(Collection.prototype)
PostFormSection.prototype.constructor = PostFormSection

0 comments on commit f6612d0

Please sign in to comment.