mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-01-06 00:17:49 -05:00
* Add comments to photos Extend the photo show page to support comments by logged in users. - Make the Comment model polymorphic. - Update the Photo and Post models to have comments. - Update the comments controller to handle the polymorphic association. - Update the photo show page to display comments and a comment form. - Create a reusable comments partial. * Add migration * Fix tests * Fix tests * Slightly fix tests * Fix variables * Add field * Refactor slightly * Refactor slightly * Refactor slightly * Refactor * Photos respond to this as well * Refactor to polymorphic_url * Rename * Wrong relationship * Refactor and fix tests * Fix relationships * Fix rendering * Fix tests * Fix model tests * Fix test * Fix test * Fix test * Fix test * Fix controller spec * Fix view tests --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com> Co-authored-by: Daniel O'Connor <daniel.oconnor@gmail.com>
70 lines
2.6 KiB
Plaintext
70 lines
2.6 KiB
Plaintext
= content_for :title, @post.subject
|
|
- content_for :opengraph do
|
|
= tag("meta", property: "og:image", content: post_image_path(@post))
|
|
= tag("meta", property: "og:image", content: avatar_uri(@post.author, 200))
|
|
= tag("meta", property: "og:description", content: og_description(@post.body))
|
|
= tag("meta", property: "og:title", content: @post.subject)
|
|
= tag("meta", property: "og:type", content: "article")
|
|
= tag("meta", property: "og:url", content: request.original_url)
|
|
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
|
|
|
- if @post.author && !current_member
|
|
.alert.alert-info
|
|
= link_to @post.author.login_name, member_path(@post.author)
|
|
is using
|
|
= link_to ENV["GROWSTUFF_SITE_NAME"], root_path
|
|
to discuss #{@post.subject} with a community of food gardeners worldwide.
|
|
We have advice on growing
|
|
= succeed "," do
|
|
= link_to 'hundreds of different crops', crops_url
|
|
and a community from all around the world.
|
|
|
|
= render "shared/signin_signup",
|
|
to: "or to start using #{ENV['GROWSTUFF_SITE_NAME']} to track what you're planting and harvesting"
|
|
|
|
- content_for :buttonbar do
|
|
- if @post.comments.count > 10 && can?(:create, Comment)
|
|
= link_to 'Comment', new_comment_path(comment: { commentable_type: 'Post', commentable_id: @post.id }), class: 'btn'
|
|
|
|
- content_for :breadcrumbs do
|
|
%li.breadcrumb-item= link_to @post.author, @post.author
|
|
%li.breadcrumb-item= link_to 'posts', member_posts_path(member_slug: @post.author.slug)
|
|
%li.breadcrumb-item.active{"aria-current" => "page"}= @post.subject
|
|
|
|
.row
|
|
.col-md-8.col-12
|
|
.card.post{ id: "post-#{@post.id}" }
|
|
.card-header
|
|
%h2.display-3.float-left
|
|
= @post.subject
|
|
= render 'posts/actions', post: @post
|
|
.card-body
|
|
.post-content= render 'posts/single', post: @post
|
|
.index-cards
|
|
- @post.photos.each do |photo|
|
|
= render 'photos/thumbnail', photo: photo
|
|
|
|
.card-footer
|
|
= render 'likes/likes', object: @post
|
|
.float-right
|
|
- if can? :create, Comment
|
|
= link_to new_comment_path(comment: { commentable_type: 'Post', commentable_id: @post.id }), class: 'btn' do
|
|
= icon 'fas', 'comment'
|
|
Comment
|
|
|
|
%section.comments
|
|
= render "comments/comments", commentable: @post
|
|
|
|
.col-md-4.col-12
|
|
= render @post.author
|
|
- unless @post.crops.approved.empty?
|
|
%section.crops
|
|
%h2 Crops mentioned in this post
|
|
.index-cards
|
|
- @post.crops.approved.each do |c|
|
|
= render 'crops/thumbnail', crop: c
|
|
|
|
|
|
|
|
|