ldc-boutique-cnc/resources/views/bo/content/manage.blade.php
2021-03-18 08:40:20 +01:00

80 lines
3.6 KiB
PHP

@extends('layouts.bo-layout')
@section('content')
<div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 mb-3 border-bottom">
<h1 class="h2">Contenu {{$content->key}}</h1>
@if (session('success'))
<span class="float-right text-success">{{ session('success') }}</span>
@endif
</div>
<div class="container">
<form action="{{route('bo.content', $content->key)}}" method="POST" enctype="multipart/form-data">
@method('PUT')
@csrf
@if ($errors->any())
<div class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="form-group">
<label for="banner">Bannière <small class="text-muted">- JPEG/PNG, 2Mo max. Dimensions {{ Config::get('theme.content_banner_maxwidth') }} px par {{ Config::get('theme.content_banner_maxheight') }} px</small></label></br>
<input type="file" id="banner" name="banner" accept="image/png, image/jpeg">
@if ($content->banner !== null)
<br/>
<br/>
<img src="/images/content/{{$content->banner}}" alt="{{$content->banner}}" style="max-height: 100px;">
@endif
</div>
<div class="form-group">
<label for="title">Titre</label>
<input type="text" id="title" name="title" class="form-control" placeholder="Titre" value="{{$content->title}}">
</div>
<div class="form-group">
<label for="chapeau">Chapeau</label>
<textarea class="form-control" id="chapeau" name="chapeau" placeholder="Chapeau">{{$content->chapeau}}</textarea>
</div>
<div class="form-group">
<label for="value">Contenu</label>
<textarea class="form-control" id="value" name="value" placeholder="Contenu *">{{$content->value}}</textarea>
</div>
<div class="text-center">
<input type="submit" class="btn btn-success" value="Enregistrer">
</div>
</form>
</div>
@endsection
@section('scripts')
<script type="text/javascript">
var editorConfig = {
removePlugins: ["Image", "ImageCaption", "ImageStyle", "ImageToolbar", "ImageUpload"],
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', '|', 'blockQuote', 'insertTable', '|', 'undo', 'redo' ],
heading: {
options: [
{ model: 'paragraph', title: 'Paragraph', class: 'ck-heading_paragraph' },
{ model: 'heading1', view: 'h1', title: 'Heading 1', class: 'ck-heading_heading1' },
{ model: 'heading2', view: 'h2', title: 'Heading 2', class: 'ck-heading_heading2' },
{ model: 'heading3', view: 'h3', title: 'Heading 3', class: 'ck-heading_heading3' },
{ model: 'heading4', view: 'h4', title: 'Heading 4', class: 'ck-heading_heading4' }
]
},
table: {
contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
}
};
ClassicEditor
.create( document.querySelector( '#chapeau' ), editorConfig )
.catch( error => {
console.error( error );
} );
ClassicEditor
.create( document.querySelector( '#value' ), editorConfig )
.catch( error => {
console.error( error );
} );
</script>
@endsection