Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## WorkPlan 1/8/18
- ### Week's Goal
- This weeks focus will be pushing code for the ROAM module. Complete the end of Sprint 1.
- ### Specifications
- __See a link to "Log Out" if they're logged in in the site-wide header.__
- __Implementation__:
- - [ ] If the session_user_id exists, then `<button class="logout-button">` will be`.logout-button{display:inline;}`
- - [ ] If the session_user_id does NOT exist, then, `<button class="logout-button"> ` will be `.logout-button{display:none;}`
- __Update their profile by making changes to their name and/or current city.__
- __Implementation__:
- - [ ] Edit buttons will be wrapped in `<form action="/profile" method="POST">` tags that will call the routes
- - [ ] In the routes, `router.put('/profile', (req, res) ...`, a database function,
- `user.updateProfile(user_session_id, original_input_value, new_input_value)` will be called that will execute the SQL query:
- ` UPDATE table_name
- SET column1 = value1, column2 = value2, ...
- WHERE condition;`
- - [ ] If the session_user_id exists, on the profile.ejs, `<p>First Name</p>`, `<p>Last Name</p>`, `<p>Email</p>`,
- `<p>City</p>`, will each have a`<button class="edit-button">Edit</button>` that will `.edit-button {display: inline;}`, else, `{display: none}`
- - [ ] The `profile` object that populates the profile.ejs page with user information will be updated with the newest props and passed to the render method
- __See the titles of all the posts they've contributed (start with pre-seeded data)__
- __Implementation__:
- - [x] Loop through the array of objects, pushing the post titles into the array property on the profiles object, `profiles.titles`,
- - [x] The `profile` object will be sent with the render method to `profiles.ejs`
- _NOTE: Currently rendering SOME user information from the database on profiles.ejs. The titles are all that need to be rendered and I am getting those back in my console.log of the result of my promise._
- __Click on the title of one of their posts and be redirected to a "show" page for that post.__
- __Implementation__:
- - [ ] Wrap each title in the following: `<a href="/post/`${id}`"><li>Title of Post</li></a>`
- - [ ] In the routes, clicking on the title, calls `router.get('/post/:id'...`, run db function `posts.getPostById(id)`
- - [ ] The post.ejs page will render the `/posts/2` with the post passed into the render method in a `singlePost` object.
- - [ ] `posts.getPostsById(id)` will take `const sql`= `SELECT posts.blog, posts.user_id
- FROM posts RIGHT JOIN users ON users.id=posts.user_id WHERE users.id = $1`
Add Comment
Please, Sign In to add comment