Add micropost form to project show view
This commit is contained in:
parent
e5ad663e50
commit
bbb152fa5d
@ -5,6 +5,8 @@
|
|||||||
color: #ddd
|
color: #ddd
|
||||||
box-shadow: 0px 0px 0px 10px black inset, 0px 0px 0px 43px white inset, 0px 0px 116px 62px black inset
|
box-shadow: 0px 0px 0px 10px black inset, 0px 0px 0px 43px white inset, 0px 0px 116px 62px black inset
|
||||||
rotate: -36deg
|
rotate: -36deg
|
||||||
|
ol.microposts
|
||||||
|
padding: 0
|
||||||
.micropost
|
.micropost
|
||||||
.display-name, .timestamp
|
.display-name, .timestamp
|
||||||
font-family: "Press Start 2P", "Anton", Impact, fantasy, sans-serif
|
font-family: "Press Start 2P", "Anton", Impact, fantasy, sans-serif
|
||||||
|
|||||||
@ -10,6 +10,9 @@ class ProjectsController < ApplicationController
|
|||||||
def show
|
def show
|
||||||
authorize @project
|
authorize @project
|
||||||
@followable = @project
|
@followable = @project
|
||||||
|
if @project.user == current_user
|
||||||
|
@micropost = @project.microposts.build
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# GET /projects/new
|
# GET /projects/new
|
||||||
|
|||||||
@ -11,9 +11,13 @@
|
|||||||
.stats
|
.stats
|
||||||
%p #{@project.followers.count} Followers
|
%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
|
%section.microposts
|
||||||
%h3 Posts #{@project.microposts.count}
|
%h3 Posts #{@project.microposts.where.not(id: nil).count}
|
||||||
%ol.microposts
|
%ol.microposts
|
||||||
= render @project.microposts
|
= render @project.microposts.where.not(id: nil)
|
||||||
= will_paginate @project.microposts.paginate(page: params[:page])
|
= will_paginate @project.microposts.where.not(id: nil).paginate(page: params[:page])
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
- @user ||= current_user
|
- @user ||= current_user
|
||||||
.stats
|
.stats
|
||||||
%a{:href => "#{following_user_path(@user)}"}
|
%span{:href => "#{following_user_path(@user)}"}
|
||||||
%strong#following.stat
|
%strong#following.stat
|
||||||
= @user.following.count
|
= @user.following.count
|
||||||
following
|
following
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user