mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-11-03 19:54:16 -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>
57 lines
1.8 KiB
Plaintext
57 lines
1.8 KiB
Plaintext
- content_for :title, @photo.title
|
|
- content_for :opengraph do
|
|
= tag("meta", property: "og:title", content: @photo.title)
|
|
= tag("meta", property: "og:image", content: @photo.fullsize_url)
|
|
= tag("meta", property: "og:image:user_generated", content: "true")
|
|
= tag("meta", property: "og:type", content: "website")
|
|
= tag("meta", property: "og:url", content: request.original_url)
|
|
= tag("meta", property: "og:site_name", content: ENV['GROWSTUFF_SITE_NAME'])
|
|
|
|
- content_for :breadcrumbs do
|
|
%li.breadcrumb-item= link_to 'Photos', photos_path
|
|
%li.breadcrumb-item.active= link_to @photo, @photo
|
|
|
|
.row{id: "photo-#{@photo.id}"}
|
|
.col-md-9
|
|
%section.photo
|
|
%h2.text-center.ellipsis
|
|
= photo_icon
|
|
= @photo.title
|
|
|
|
%p.text-center
|
|
= image_tag(@photo.fullsize_url, alt: @photo.title, class: 'rounded img-responsive shadow-sm')
|
|
|
|
|
|
- if @crops.size.positive?
|
|
.index-cards
|
|
- @crops.each do |crop|
|
|
= render 'crops/thumbnail', crop: crop
|
|
.col-md-3
|
|
%p
|
|
%span.btn= render 'photos/likes', photo: @photo
|
|
= render 'photos/actions', photo: @photo
|
|
= link_to @photo.link_url, class: 'btn btn-info' do
|
|
- if @photo.source == 'flickr'
|
|
= icon 'fab', 'flickr'
|
|
View on #{@photo.source.titleize}
|
|
- if @photo.date_taken.present?
|
|
%h3 Taken on #{I18n.l @photo.date_taken.to_date}
|
|
|
|
= render @photo.owner
|
|
|
|
%p
|
|
%strong License:
|
|
- if @photo.license_url
|
|
= link_to @photo.license_name, @photo.license_url
|
|
- else
|
|
= @photo.license_name
|
|
|
|
= render "associations", photo: @photo
|
|
.row
|
|
- if can? :create, Comment
|
|
= link_to new_comment_path(comment: { commentable_type: 'Photo', commentable_id: @photo.id }), class: 'btn' do
|
|
= icon 'fas', 'comment'
|
|
Comment
|
|
.row
|
|
.col-md-9
|
|
= render 'comments/comments', commentable: @photo |