Skip to content

Commit

Permalink
Posts index
Browse files Browse the repository at this point in the history
  • Loading branch information
pedroaugustofsilva committed Sep 14, 2024
1 parent 4ea6098 commit fea48f8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class PostsController < ApplicationController
before_action :set_post, only: %i[ show edit update destroy ]
before_action :authenticate

# GET /posts or /posts.json
def index
Expand Down
8 changes: 4 additions & 4 deletions app/views/posts/index.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<div class="w-full">
<div class="w-11/12 sm:w-2/3 md:w-1/2 mx-auto py-10">
<% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %>
<% content_for :title, "Posts" %>
<% content_for :title, "X Social" %>

<div class="flex justify-between items-center">
<h1 class="font-bold text-4xl">Posts</h1>
<%= link_to "New post", new_post_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
<h1 class="font-bold text-4xl">Hello, <%= @current_user.username %>!</h1>
<%= link_to "Share", new_post_path, class: "rounded-lg py-3 px-5 bg-blue-600 text-white block font-medium" %>
</div>

<div id="posts" class="min-w-full">
Expand Down

0 comments on commit fea48f8

Please sign in to comment.