Update Picture to S3

This commit is contained in:
Mathieu Lagacé
2020-10-24 19:28:09 -04:00
parent 4f83774200
commit 2f9e6d4d15
5 changed files with 44 additions and 37 deletions

View File

@@ -7,26 +7,31 @@
<h4>Ajouter une images</h4>
</div>
<div class="card-body mt-5">
<form action="/admin/picture/add" method="post">
<form action="/admin/picture/add" method="post" enctype="multipart/form-data">
@csrf
<div class="col-lg-12">
<div class="form-group">
<label>Nom de l'image</label>
<input name="title" type="text" class="form-control">
<input name="title" type="text" class="form-control" required>
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>URL de l'image</label>
<input name="url" type="text" class="form-control">
<div class="form-group bmd-form-group is-filled">
<label class="label-control bmd-label-static">Choisir l'image</label>
<div class="fileinput fileinput-new input-group" data-provides="fileinput" style="display: flex !important;">
<div class="form-control" data-trigger="fileinput">
<span class="fileinput-filename"></span>
</div>
<span class="input-group-append"><span class="input-group-text fileinput-exists cursor" data-dismiss="fileinput">Remove</span><span class="input-group-text btn-file"><span class="fileinput-new cursor">Select file</span><span class="fileinput-exists cursor">Change</span><input type="file" name="file" required accept="image/*"></span></span>
</div>
</div>
</div>
<div class="col-lg-12">
<label for="desc">Description de l'image</label>
<div class="form-group">
<textarea name="desc" id="desc" class="form-control"></textarea>
<textarea name="desc" id="desc" class="form-control" required></textarea>
</div>
</div>
<div class="col-lg-12">
@@ -44,20 +49,5 @@
$('#desc').trumbowyg({
lang: 'fr'
});
function saveChange(pPerm) {
(function($) {
var myswitch = document.getElementById(pPerm);
$.post('/api/config/general/save?api_token='+api_token, { value: myswitch.checked,perm: pPerm } , function(data) {
swal({
title: 'Modification enregistré !',
type: 'success',
}).then((result) => {
if (result.value) {
location.reload();
}
})
});
})(jQuery);
}
</script>
@endsection

View File

@@ -7,7 +7,7 @@
<h4>Ajouter une images</h4>
</div>
<div class="card-body mt-5">
<form action="/admin/picture/edit/{{$picture->id}}" method="post">
<form action="/admin/picture/edit/{{$picture->id}}" method="post" enctype="multipart/form-data">
@csrf
@@ -18,9 +18,14 @@
</div>
</div>
<div class="col-lg-12">
<div class="form-group">
<label>URL de l'image</label>
<input name="url" type="text" class="form-control" value="{{$picture->url}}">
<div class="form-group bmd-form-group is-filled">
<label class="label-control bmd-label-static">Choisir l'image</label>
<div class="fileinput fileinput-new input-group" data-provides="fileinput" style="display: flex !important;">
<div class="form-control" data-trigger="fileinput">
<span class="fileinput-filename"></span>
</div>
<span class="input-group-append"><span class="input-group-text fileinput-exists cursor" data-dismiss="fileinput">Remove</span><span class="input-group-text btn-file"><span class="fileinput-new cursor">Select file</span><span class="fileinput-exists cursor">Change</span><input type="file" name="file" accept="image/*"></span></span>
</div>
</div>
</div>
<div class="col-lg-12">

View File

@@ -31,13 +31,13 @@
<button class="btn btn-danger" onclick="Delete({{$picture->id}})"><i class="fas fa-times"></i></button>
</div>
</div>
@if($picture->pictureable)
{{-- @if($picture->pictureable)
<div class="col-xl-5 m-auto text-right">
<a href="/activity/{{$picture->pictureable->id}}" target="_blank">
<span class="badge badge-primary">{{$picture->pictureable->name}}</span>
</a>
</div>
@endif
@endif--}}
</div>
</div>
</div>

View File

@@ -60,12 +60,6 @@
// 'perm' => 'article_see',
// 'child' => null
//],
//'Images' => [
// 'route' => 'admin.picture',
// 'icon' => 'fas fa-images',
// 'perm' => 'picture_see',
// 'child' => null
//],
'Utilisateurs' => [
'route' => 'admin.users',
'icon' => 'fas fa-users',
@@ -78,6 +72,12 @@
'perm' => 'cadet_list_see',
'child' => null
],
'Images' => [
'route' => 'admin.picture',
'icon' => 'fas fa-images',
'perm' => 'picture_see',
'child' => null
],
'Logs' => [
'route' => 'admin.stats.log',
'icon' => 'fas fa-stream',