Add micropost form to project show view
This commit is contained in:
parent
b3ace00e2f
commit
c9fbba6ee9
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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])
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user