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

Milestone 6: views #6

Merged
merged 22 commits into from
Dec 7, 2023
Merged

Milestone 6: views #6

merged 22 commits into from
Dec 7, 2023

Conversation

ITurres
Copy link
Owner

@ITurres ITurres commented Dec 7, 2023

Pull Request Summary for Milestone 6 Completion

Added:

/app/views/posts/_posts.html.erb

  • Created a versatile partial to render either multiple posts or a single post based on the @posts variable.
  • Renders post content, comment and like counts, and display comments if available.

/app/views/shared/_button_link.html.erb

  • Implemented a simple reusable partial to render a button linked to any page.

/app/views/shared/_user_card.html.erb

  • Developed a partial responsible for displaying user information like name, photo, and post count. It links to user_path(user).

Modified:

/README.md

  • Marked the controllers specs task as completed.

/Gemfile and /Gemfile.lock

  • Added the faker gem for generating test data in development mode.

/app/controllers/posts_controller.rb

  • Modified index method to conditionally set @posts to display all posts or only those of the current user.
  • Adjusted show method to set @post for the current user's post.

/app/controllers/users_controller.rb

  • In index method, set @users to display all users.
  • Updated show method to set @user based on the current user's params.

/app/views/layouts/application.html.erb

  • Updated title, added viewport, description, and author meta tags, linked Bootstrap CDN, and included the app favicon.

/app/views/posts/index.html.erb

  • Modified the view to display all posts and utilized the shared/button_link partial for pagination.

/app/views/posts/show.html.erb

  • Renders the selected post using the posts partial.

/app/views/users/index.html.erb

  • Utilized the user_card partial to display all users.

/app/views/users/show.html.erb

  • Displays user information including name, bio, posts, and post comments using the user_card partial.
  • Included the shared/button_link partial to navigate to 'see all posts'.

Thank you for reviewing this PR. Feel free to reach out on Slack as Arturo (Arthur) Emanuel Guerra Iturres for any queries or further assistance. 🌟

- '#index' to fetch all users.
- '#show' to find a user by id.
- Add max-width to main element.
- Update partial path.
- Add partial's local variables 'truncate_n' and 'limit_n'.
- Render 'user_card' partial.
- Render 'posts' partial.
- Render 'button_link' partial.
- Render 'posts' partial.
- Wrap 'posts' partial in 'main'.
@ITurres ITurres added documentation Improvements or additions to documentation enhancement New feature or request UI Views UI labels Dec 7, 2023
@ITurres ITurres self-assigned this Dec 7, 2023
Copy link

@Olamarx Olamarx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ITurres,

Good job so far, indeed you have spent time on this project!
There are some issues that you still need to work on to go to the next project but you are almost there!

Highlights

  • Linters passed ✔️
  • Readme file professional ✔️
  • All views code works ✔️

Required Changes ♻️

Check the comments under the review.

Optional suggestions

Every comment with the [OPTIONAL] prefix is not crucial enough to stop the approval of this PR. However, I strongly recommend you to take them into account as they can make your code better.

Cheers and Happy coding!👏👏👏

Feel free to leave any questions or comments in the PR thread if something is not 100% clear.
Please, remember to tag me in your question so I can receive the notification.

Please, do not open a new Pull Request for re-reviews. You should use the same Pull Request submitted for the first review, either valid or invalid unless it is requested otherwise.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

Comment on lines +34 to +44
<% if limit_n > 0 %>
<div class="card card-body mt-1 p-3">
<ul class="list-unstyled">

<% post.most_recent_comments(limit_n).each do |comment| %>
<li><%= comment.author.name %>: <%= comment.text %></li>
<% end %>

</ul>
</div>
<% end %>
Copy link

@Olamarx Olamarx Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I could not confirm the comment because I ran into an error while trying to add data, others were added successfully but the comment failed to, I will encourage you to double-check it.
    image

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Olamarx! it is running well on my end! 🎯

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It runs well on my end too, just the comments were not added.

Copy link
Owner Author

@ITurres ITurres Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Olamarx, a short screencast

addind-data-to-blog-db-dev.webm

Copy link
Owner Author

@ITurres ITurres Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Olamarx, the reason for the issue is that when instantiating the Comment model, it expects author as a parameter. However, in your instantiations, you're sending user instead of author.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i.e

   Comment.create(post: first_post, author: first_user, text: 'Hi Tom!' )

@ITurres ITurres requested a review from Olamarx December 7, 2023 04:02
Copy link

@MahmoudBakr23 MahmoudBakr23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @ITurres 😃,

Your project is complete! There is nothing else to say other than... it's time to merge it :shipit:
Congratulations! 🎉

Highlights

  • Well done on working on this project so far. All is good. 💯

Cheers, and Happy coding!👏👏👏

Feel free to mention @MahmoudBakr23 to leave any questions or comments in the PR thread if something is not 100% clear.


As described in the Code reviews limits policy you have a limited number of reviews per project (check the exact number in your Dashboard). If you think that the code review was not fair, you can request a second opinion using this form.

@ITurres
Copy link
Owner Author

ITurres commented Dec 7, 2023

Hello @MahmoudBakr23! thank you for having reviewed and approved the PR :D, have a good week!

@ITurres ITurres merged commit 4fe3caf into development Dec 7, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request UI Views UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants