Add micropost form to project show view

This commit is contained in:
Jesse C. Fisher 2023-11-26 10:09:55 +00:00 committed by TheNeedful-DO
parent e5ad663e50
commit bbb152fa5d
4 changed files with 14 additions and 5 deletions

View File

@ -5,6 +5,8 @@
color: #ddd
box-shadow: 0px 0px 0px 10px black inset, 0px 0px 0px 43px white inset, 0px 0px 116px 62px black inset
rotate: -36deg
ol.microposts
padding: 0
.micropost
.display-name, .timestamp
font-family: "Press Start 2P", "Anton", Impact, fantasy, sans-serif

View File

@ -10,6 +10,9 @@ class ProjectsController < ApplicationController
def show
authorize @project
@followable = @project
if @project.user == current_user
@micropost = @project.microposts.build
end
end
# GET /projects/new

View File

@ -11,9 +11,13 @@
.stats
%p #{@project.followers.count} Followers
- if @project.microposts.any?
- if @project.user == current_user
%section.micropost_form
= render 'shared/micropost_form'
- if @project.microposts.where.not(id: nil).any?
%section.microposts
%h3 Posts #{@project.microposts.count}
%h3 Posts #{@project.microposts.where.not(id: nil).count}
%ol.microposts
= render @project.microposts
= will_paginate @project.microposts.paginate(page: params[:page])
= render @project.microposts.where.not(id: nil)
= will_paginate @project.microposts.where.not(id: nil).paginate(page: params[:page])

View File

@ -1,6 +1,6 @@
- @user ||= current_user
.stats
%a{:href => "#{following_user_path(@user)}"}
%span{:href => "#{following_user_path(@user)}"}
%strong#following.stat
= @user.following.count
following