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
Users can like posts feature (wip) #1
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tute
approved these changes
Mar 2, 2024
Co-authored-by: Tute Costa <tutecosta@gmail.com>
Co-authored-by: Tute Costa <tutecosta@gmail.com>
tute
reviewed
Mar 4, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
Co-authored-by: Tute Costa <tutecosta@gmail.com>
Co-authored-by: Tute Costa <tutecosta@gmail.com>
tute
approved these changes
Mar 4, 2024
tute
reviewed
Mar 11, 2024
<div class="alert alert-info mt-4" role="alert"> | ||
<%= flash[:alert] %> | ||
<% flash.each do |flash_type, message| %> | ||
<div class="alert alert-info mt-4"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
<div class="alert alert-info mt-4"> | |
<div class="alert alert-info <%= flash_type %> mt-4"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HOLA TUTEE!! :D here testing the pull request as you suggested (even though wip)
What I want as a the next feature of this toy app is for users to be able to like posts, we want each user to have_many posts and each post to have_many likes, but users should only be able to like the posts that they haven't already liked!! Otherwise I could upload a pic of my ugly face to a contest and like my post 30000 times and then win a fly-ticket to the french polynesia. I created partials in which I plan to insert the forms to create the likes. maybe something like:
<%= form_with model: like, url: post_like_path(post, like), method: :delete, class: 'like-form' do |f| %>
<%= f.submit 'Unlike', class: 'btn btn-danger unlike-button' %>
<% end %>
and
<%= form_with model: Like.new, url: post_likes_path(post), method: :post, class: 'like-form' do |f| %>
<%= f.hidden_field :post_id, value: post.id %>
<%= f.submit 'Like', class: 'btn btn-primary like-button' %>
<% end %>
But first I need to be able to access @post in the partial, which is still not working and didn't find out why yet