Skip to content

Commit

Permalink
push
Browse files Browse the repository at this point in the history
  • Loading branch information
Simonvargas committed Jul 2, 2021
1 parent 1134ecf commit 2a7d70f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 18 deletions.
16 changes: 16 additions & 0 deletions public/javascripts/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

window.addEventListener("load", (event)=>{
console.log("hello from javascript!")

Expand Down Expand Up @@ -37,8 +38,23 @@ window.addEventListener("load", (event)=>{

}

const reviewContainer = document.querySelector('.review-container')
const rateBtn = document.querySelector('.rate-btn')

rateBtn.addEventListener('click', e => {
// e.preventDefault()
reviewContainer.classList.add(localStorage.classname)
localStorage.classname = 'hidden'
})

});
// console.log(review)
// if (review) {
// reviewContainer.classList.add('hidden')
// } else {
// reviewContainer.classList.remove('hidden')
// }
// let review = false

// Listen to the text inside of areaThing, ONCE it exists
// Set your text in your put request to the new thing area thINg
Expand Down
4 changes: 4 additions & 0 deletions public/stylesheets/details.css
Original file line number Diff line number Diff line change
Expand Up @@ -247,3 +247,7 @@ textarea {
height: 100px;
border-radius: 5px;
}

.hidden {
visibility: hidden;
}
37 changes: 19 additions & 18 deletions views/trail-detail.pug
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,25 @@ block content
p(class=`name`)= trail.name
img(src=`../trails/trail-${trail.id}.jpg` alt=`${trail.name}` class=`trail-image-${trail.id}`)
p(class=`details`)= trail.description
div(class='btn-container')
form(action="/trailList" method="post" id="demo" class="demo")
button(type="submit" class="add-btn hi") Add to TrailList
div(class="review-container")
form(action=`/trail/${trail.id}` method="post" class="")
textarea(name="text" placeholder="Write a review!" class="review-input")
button(type="submit" class="rate-btn hi") Submit
div(class="list-reviews")
each review in reviews
div(class="review")
p(class="review-username")= `User: ${review.User.username}`
div
p(id=`text-${review.id}` class="review-text")= `${review.text}`
p(class="review-date")= `Reviewed at: ${review.createdAt}`
if (review.User.id === user.id)
button(type="submit" id=`${review.id}` class="edit-btn hi") Edit Review
form(action=`/trail/${trail.id}/delete` method="post" class="")
button(type="submit" class="delete-btn hi") Delete Review
if (user)
div(class='btn-container')
form(action="/trailList" method="post" id="demo" class="demo")
button(type="submit" class="add-btn hi") Add to TrailList
div(class="review-container")
form(action=`/trail/${trail.id}` method="post" class="")
textarea(name="text" placeholder="Write a review!" class="review-input")
button(type="submit" class="rate-btn hi") Submit
div(class="list-reviews")
each review in reviews
div(class="review")
p(class="review-username")= `User: ${review.User.username}`
div
p(id=`text-${review.id}` class="review-text")= `${review.text}`
p(class="review-date")= `Reviewed at: ${review.createdAt}`
if (review.User.id === user.id)
button(type="submit" id=`${review.id}` class="edit-btn hi") Edit Review
form(action=`/trail/${trail.id}/delete` method="post" class="")
button(type="submit" class="delete-btn hi") Delete Review

//- input(type="hidden" class="edit-input")
//- if (review.User.id === review.userId)
Expand Down

0 comments on commit 2a7d70f

Please sign in to comment.