Tidy up posts#show

This commit is contained in:
Brenda Wallace
2019-05-18 20:14:25 +12:00
parent 72479eb44f
commit 77c0dea122

View File

@@ -18,33 +18,67 @@
= link_to 'hundreds of different crops', crops_url
and a community from all around the world.
= render partial: "shared/signin_signup",
locals: { to: "or to start using #{ENV['GROWSTUFF_SITE_NAME']} to track what you're planting and harvesting" }
= render "shared/signin_signup",
to: "or to start using #{ENV['GROWSTUFF_SITE_NAME']} to track what you're planting and harvesting"
= render partial: "single", locals: { post: @post, subject: false, hide_comments: true }
.row
.col-8.col-xs-12
- unless @post.crops.empty?
%h3 Crops mentioned in this post
- @post.crops.each do |c|
.col-md-2
= render partial: 'crops/thumbnail', locals: { crop: c }
/ Section: Blog v.4
%section.blog-post
.card.post{ id: "post-#{@post.id}" }
.card-header
%h2.display-3= @post.subject
.card-body
%p
Posted by
- if @post.author
= link_to @post.author.login_name, member_path(@post.author)
- else
Member Deleted
- if @post.forum
in
= link_to @post.forum, @post.forum
on
= @post.created_at
- if @post.updated_at > @post.created_at
and edited at
= @post.updated_at
:growstuff_markdown
#{ strip_tags @post.body }
.col-md-11
- if can?(:edit, @post) || can?(:destroy, @post)
.post-actions
- if can? :edit, @post
= link_to 'Edit Post', edit_post_path(@post), class: 'btn btn-default btn-xs'
- if can? :destroy, @post
= link_to 'Delete Post', @post, method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn btn-default btn-xs'
.card-footer
- if can? :create, Comment
= link_to new_comment_path(post_id: @post.id), class: 'btn' do
= icon 'fas', 'comment'
Comment
- if @post.comments.count > 10 && can?(:create, Comment)
.post-actions
= link_to 'Comment', new_comment_path(post_id: @post.id), class: 'btn btn-primary'
- if can?(:edit, @post) || can?(:destroy, @post)
- if can? :edit, @post
= link_to 'Edit Post', edit_post_path(@post), class: 'btn'
= render partial: "comments", locals: { post: @post }
- if can? :destroy, @post
= link_to 'Delete Post', @post, method: :delete,
data: { confirm: 'Are you sure?' },
class: 'btn'
- if @post.comments.count > 10 && can?(:create, Comment)
= link_to 'Comment', new_comment_path(post_id: @post.id), class: 'btn'
.col-4.col-xs-12
= render @post.author
- unless @post.crops.empty?
%hr/
.row
.col-md-12
%h3 Crops mentioned in this post
- @post.crops.each do |c|
.col-md-6= render 'crops/thumbnail', crop: c
.col-md-12
= render "comments", post: @post
- if can? :create, Comment
.post-actions
= link_to 'Comment', new_comment_path(post_id: @post.id), class: 'btn btn-primary'