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

81 lines
3.3 KiB
PHP

@php
$is_reply = isset($reply_comment);
$is_known_user = !is_null(Auth::user())
@endphp
{{-- Show a previous of the comment we're replying to --}}
@if ($is_reply)
<div class="mb-3">
@include (Theme::viewName('partials.photo_single_comment'), ['comment' => $reply_comment, 'is_reply' => true])
</div>
@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('name') ? ' is-invalid' : '' }}" id="commentor-name" name="name" value="{{ old('name', ($is_known_user ? Auth::user()->name : '')) }}"{{ $is_known_user ? ' readonly="readonly"' : '' }}/>
@if ($errors->has('name'))
<div class="invalid-feedback">
<strong>{{ $errors->first('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('email') ? ' is-invalid' : '' }}" id="commentor-email" name="email" value="{{ old('email', ($is_known_user ? Auth::user()->email : '')) }}" placeholder="@lang('forms.email_placeholder')"{{ $is_known_user ? ' readonly="readonly"' : '' }}//>
@if ($errors->has('email'))
<div class="invalid-feedback">
<strong>{{ $errors->first('email') }}</strong>
</div>
@endif
@if ($is_known_user)
<a class="btn btn-link" href="{{ url('/logout') }}" onclick="event.preventDefault(); document.getElementById('logout-form').submit();">@lang('gallery.not_you_logout')</a>
@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') ? ' is-invalid' : '' }}" id="comment-text{{ $is_reply ? '-reply' : '' }}" name="comment" rows="10">{{ old('comment') }}</textarea>
@if ($errors->has('comment'))
<div class="invalid-feedback">
<strong>{{ $errors->first('comment') }}</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,
plugins: 'textcolor lists link image',
toolbar1: 'bold italic strikethrough forecolor backcolor | link image | alignleft aligncenter alignright alignjustify | numlist bullist | removeformat',
menubar: false
});
}
initTinyMce('#comment-text');
</script>
@endpush