blue-twilight/resources/views/themes/base/partials/photo_comments_reply_form.b...

73 lines
2.7 KiB
PHP

@php
$is_reply = isset($reply_comment);
@endphp
{{-- Show a previous of the comment we're replying to --}}
@if ($is_reply)
<ul class="mb-3">
@include (Theme::viewName('partials.photo_single_comment'), ['comment' => $reply_comment, 'is_reply' => true])
</ul>
@endif
<form action="{{ $photo->postCommentUrl() }}" method="post">
{{ csrf_field() }}
@if ($is_reply)
<input type="hidden" name="parent_comment_id" value="{{ $reply_comment->id }}"/>
@endif
<div class="form-group">
<label for="commentor-name">@lang('forms.name_label')</label>
<input type="text" class="form-control{{ $errors->has('commentor_name') ? ' is-invalid' : '' }}" id="commentor-name" name="commentor_name" value="{{ old('commentor_name') }}"/>
@if ($errors->has('commentor_name'))
<div class="invalid-feedback">
<strong>{{ $errors->first('commentor_name') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label for="commentor-email">@lang('forms.email_label')</label>
<input type="text" class="form-control{{ $errors->has('commentor_email') ? ' is-invalid' : '' }}" id="commentor-email" name="commentor_email" value="{{ old('commentor_email') }}" placeholder="@lang('forms.email_placeholder')"/>
@if ($errors->has('commentor_email'))
<div class="invalid-feedback">
<strong>{{ $errors->first('commentor_email') }}</strong>
</div>
@endif
</div>
<div class="form-group">
<label for="comment-text{{ $is_reply ? '-reply' : '' }}">@lang('forms.photo_comment_text_label')</label>
<textarea class="form-control{{ $errors->has('comment_text') ? ' is-invalid' : '' }}" id="comment-text{{ $is_reply ? '-reply' : '' }}" name="comment_text" rows="10">{{ old('comment_text') }}</textarea>
@if ($errors->has('comment_text'))
<div class="invalid-feedback">
<strong>{{ $errors->first('comment_text') }}</strong>
</div>
@endif
</div>
<div class="form-group text-right">
@if ($is_reply)
<button type="button" class="btn btn-success" onclick="app.postCommentReply();">@lang('forms.photo_comment_reply_action')</button>
@else
<button type="submit" class="btn btn-success">@lang('forms.photo_comment_submit_action')</button>
@endif
</div>
</form>
@push('scripts')
<script src="{{ asset('tinymce/js/tinymce/tinymce.min.js') }}"></script>
<script type="text/javascript">
function initTinyMce(selector)
{
tinymce.init({
selector: selector
});
}
initTinyMce('#comment-text');
</script>
@endpush