diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css index 991943c..2406453 100644 --- a/app/assets/stylesheets/application.css +++ b/app/assets/stylesheets/application.css @@ -117,7 +117,7 @@ a { .post-text { display: grid; - grid-template-columns: 3fr 1fr; + grid-template-columns: 2fr 0.5fr; gap: 1rem; } @@ -131,6 +131,16 @@ a { gap: 0.5rem; } +.post-text .count { + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: flex-start; + padding: 0.5rem 2rem 0.5rem 10vh; + font-size: medium; + gap: 0.5rem; +} + .count span { padding: 0 0.25rem; } @@ -138,7 +148,7 @@ a { .like_count_btn { display: flex; flex-direction: row; - justify-content: space-around; + align-items: center; gap: 1rem; } @@ -163,8 +173,11 @@ form input[type="submit"] { padding: 5px; } -.like_count_btn form { - width: 3vw; +.like_count_btn button { + width: 2vw; + height: 2vw; + font-size: x-large; + padding: 0; } form input[type="hidden"] { @@ -257,6 +270,10 @@ form input { padding: 0.5rem; } +.like_count_btn form { + width: 3vw; +} + .comments form { width: auto; align-self: flex-end; diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 2406b0d..caee4ac 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -1,7 +1,6 @@ class PostsController < ApplicationController - load_and_authorize_resource - + def index @user = User.includes(posts: { comments: :author }).find(params[:user_id]) @current_user = current_user diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb index 8699649..a025137 100644 --- a/app/views/posts/index.html.erb +++ b/app/views/posts/index.html.erb @@ -55,6 +55,13 @@ 0 <% end %> + + <%= form_with(model: Like.new, url: like_user_post_path(post.author, post)) do |form| %> + <%= form.button type: :submit do %> + ♥ + <% end %> + <% end %> +
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index 494e7ad..73a822a 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -62,6 +62,13 @@ 0 <% end %> + + <%= form_with(model: Like.new, url: like_user_post_path(post.author, post)) do |form| %> + <%= form.button type: :submit do %> + ♥ + <% end %> + <% end %> +