Merge photo comments feature #114
@ -52,6 +52,11 @@ class Photo extends Model
|
||||
return $this->belongsTo(Album::class);
|
||||
}
|
||||
|
||||
public function approvedComments()
|
||||
{
|
||||
return $this->hasMany(PhotoComment::class)->whereNotNull('approved_at');
|
||||
}
|
||||
|
||||
public function exifUrl()
|
||||
{
|
||||
return route('viewExifData', [
|
||||
|
@ -16,4 +16,14 @@ class PhotoComment extends Model
|
||||
'commentor_email',
|
||||
'comment_text'
|
||||
];
|
||||
|
||||
public function approvedBy()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'approved_user_id');
|
||||
}
|
||||
|
||||
public function createdBy()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_user_id');
|
||||
}
|
||||
}
|
@ -57,7 +57,7 @@
|
||||
@endif
|
||||
|
||||
@if (UserConfig::get('allow_photo_comments'))
|
||||
@include (Theme::viewName('partials.gallery_photo_comments'))
|
||||
@include (Theme::viewName('partials.photo_comments'))
|
||||
@endif
|
||||
</div>
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col mt-4">
|
||||
<h2>@lang('gallery.photo_comments_heading')</h2>
|
||||
|
||||
<h3>@lang('gallery.photo_comments_reply_form_heading')</h3>
|
||||
<p>@lang('gallery.photo_comments_reply_form_p1')</p>
|
||||
<hr/>
|
||||
@include(Theme::viewName('gallery.photo_comments_reply_form'))
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,21 @@
|
||||
<div class="row">
|
||||
<div class="col mt-4">
|
||||
<h2>@lang('gallery.photo_comments_heading')</h2>
|
||||
|
||||
<h3>@lang('gallery.photo_comments_reply_form_heading')</h3>
|
||||
<p>@lang('gallery.photo_comments_reply_form_p1')</p>
|
||||
<hr/>
|
||||
@include(Theme::viewName('partials.photo_comments_reply_form'))
|
||||
|
||||
@if ($photo->approvedComments()->count() > 0)
|
||||
<ul>
|
||||
@foreach ($photo->approvedComments as $comment)
|
||||
<li>
|
||||
Comment by <b>{{ $comment->createdBy->name }}</b>:<br/>
|
||||
{{ $comment->comment_text }}
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user