Add microposts to projects
This commit is contained in:
parent
d339ca0c89
commit
c7327ae2de
@ -259,3 +259,4 @@ textarea
|
||||
@import profiles
|
||||
@import tokens
|
||||
@import microposts
|
||||
@import projects
|
||||
|
||||
10
app/assets/stylesheets/projects.sass
Normal file
10
app/assets/stylesheets/projects.sass
Normal file
@ -0,0 +1,10 @@
|
||||
.projects-index
|
||||
.project
|
||||
text-align: center
|
||||
&:hover h1
|
||||
text-shadow: 0px 0px 9px #e1b027
|
||||
h1
|
||||
text-shadow: -1px 1px #e1b027, 1px -1px #00ddff
|
||||
transition: .15s text-shadow
|
||||
p
|
||||
margin-top: 0
|
||||
@ -1,3 +0,0 @@
|
||||
// Place all the styles related to the Projects controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: https://sass-lang.com/
|
||||
@ -1,3 +1,12 @@
|
||||
class Project < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
has_many :microposts, as: :micropostable
|
||||
has_many :passive_relationships, class_name: "Relationship",
|
||||
foreign_key: "followed_id",
|
||||
dependent: :destroy
|
||||
has_many :followers, through: :passive_relationships, source: :follower
|
||||
|
||||
def display_name
|
||||
title
|
||||
end
|
||||
end
|
||||
|
||||
@ -2,4 +2,4 @@
|
||||
- if current_user.following?(@profile)
|
||||
= render 'unfollow'
|
||||
- else
|
||||
= render 'follow'
|
||||
= render 'shared/follow'
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
= @profile.name
|
||||
- if policy(@profile).edit?
|
||||
= link_to 'Edit', edit_profile_path(@profile)
|
||||
= render 'follow_form' if current_user.signed_in?
|
||||
= render 'shared/follow_form' if current_user.signed_in?
|
||||
%p
|
||||
= @profile.summary
|
||||
|
||||
|
||||
@ -1,31 +1,22 @@
|
||||
%h1 Listing projects
|
||||
.contain
|
||||
%h1 Listing projects
|
||||
|
||||
-# - if policy(Project).new?
|
||||
= link_to '+ Add New Project', new_project_path
|
||||
-# - if policy(Project).new?
|
||||
%div{style: "align-self: start;"}
|
||||
= link_to '+ Add New Project', new_project_path
|
||||
|
||||
%table
|
||||
%thead
|
||||
%tr
|
||||
%th Title
|
||||
%th Description
|
||||
%th Owner
|
||||
%th
|
||||
%th
|
||||
%th
|
||||
|
||||
%tbody
|
||||
- @projects.each do |project|
|
||||
%tr
|
||||
%td= link_to project.title, project
|
||||
%td= project.description
|
||||
%td= project.user
|
||||
-# %td= link_to 'Show', project
|
||||
%td
|
||||
- if policy(project).edit?
|
||||
%td= link_to 'Edit', edit_project_path(project)
|
||||
- else
|
||||
%td
|
||||
- if policy(project).destroy?
|
||||
%td= link_to 'Destroy', project, method: :delete, data: { confirm: 'Are you sure?' }
|
||||
- else
|
||||
%td
|
||||
.projects-index
|
||||
- @projects.each do |project|
|
||||
= link_to project, class: "project" do
|
||||
%h1= project.title
|
||||
%p= project.description
|
||||
-# .social-links
|
||||
- project.social_links.each do |social_link|
|
||||
= social_link.to_icon.html_safe
|
||||
-# %p= project.about
|
||||
-# %span #{project.followers.count} Followers
|
||||
-#
|
||||
-# %span #{project.microposts.count} Posts
|
||||
- if policy(project).destroy?
|
||||
= link_to 'Edit', edit_project_path(project)
|
||||
= link_to 'Delete', project, method: :delete, data: { confirm: 'Are you sure?' }
|
||||
|
||||
@ -1,13 +1,16 @@
|
||||
- if policy(@project).edit?
|
||||
= link_to 'Edit', edit_project_path(@project)
|
||||
.contain
|
||||
%h1
|
||||
= @project.title
|
||||
- if policy(@project).edit?
|
||||
= link_to 'Edit', edit_project_path(@project)
|
||||
= render 'shared/follow_form' if current_user.signed_in?
|
||||
|
||||
%p
|
||||
%b Title:
|
||||
= @project.title
|
||||
%p
|
||||
%b Description:
|
||||
= @project.description
|
||||
%p
|
||||
%b Owner:
|
||||
= @project.user
|
||||
.description
|
||||
= @project.description
|
||||
|
||||
- if @project.microposts.any?
|
||||
%section.microposts
|
||||
%h3 Posts #{@project.microposts.count}
|
||||
%ol.microposts
|
||||
= render @project.microposts
|
||||
= will_paginate @project.microposts.paginate(page: params[:page])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user