Fix on preview mode
This commit is contained in:
@@ -1,32 +1,22 @@
|
||||
@component('components.layout.box-collapse', ['id' => 'comments', 'title' => __('comments')])
|
||||
@if (!empty($comments))
|
||||
@foreach ($comments as $comment)
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<strong>{{ App\Repositories\Core\Auth\Users::getName($comment->user_id) }}</strong>
|
||||
</div>
|
||||
<div class="col-6 text-right"><i>{{ App\Repositories\Core\DateTime::DateToLocale($comment->updated_at) }}</i></div>
|
||||
<div class="col-12">
|
||||
{!! $comment->comment !!}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
<button type="button" class="btn btn-xs btn-primary" id="add-comment">
|
||||
{{ __('comment_add') }}
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
@include('Admin.Core.Comments.partials.list-comments')
|
||||
@endcomponent
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
function handleAddComment() {
|
||||
$('#add-comment').click(function() {
|
||||
openModal('{{ __('comment_add') }}', '#comment-form', '{{ route('Admin.Core.Comments.create', ['model' => $model, 'model_id' => $model_id]) }}', '{{ route('Admin.Core.Comments.store') }}' );
|
||||
openModal('{{ __('comment_add') }}', '#comment-form', '{{ route('Admin.Core.Comments.create', ['model' => $model, 'model_id' => $model_id]) }}', '{{ route('Admin.Core.Comments.store') }}', 'refreshComments()' );
|
||||
});
|
||||
}
|
||||
|
||||
function refreshComments() {
|
||||
var url = '{{ route('Admin.Core.Comments.index') }}/{{ $model }}/{{ $model_id }}';
|
||||
console.log('refresh');
|
||||
console.log(url);
|
||||
$("#comments").load(url);
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
handleAddComment();
|
||||
});
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
@if (!empty($comments))
|
||||
@foreach ($comments as $comment)
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<strong>{{ App\Repositories\Core\Auth\Users::getName($comment['user_id']) }}</strong>
|
||||
</div>
|
||||
<div class="col-6 text-right"><i>{{ App\Repositories\Core\DateTime::DateToLocale($comment['updated_at']) }}</i></div>
|
||||
<div class="col-12">
|
||||
{!! $comment['comment'] !!}
|
||||
</div>
|
||||
</div>
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
@if ($with_add ?? true)
|
||||
<button type="button" class="btn btn-xs btn-primary" id="add-comment">
|
||||
{{ __('comment_add') }}
|
||||
<i class="fa fa-plus"></i>
|
||||
</button>
|
||||
@endif
|
||||
Reference in New Issue
Block a user