- Add uniq link by media
This commit is contained in:
parent
5547eaa762
commit
a7be7bec7e
7 changed files with 60 additions and 9 deletions
|
|
@ -3,6 +3,7 @@ APP_ENV=local
|
|||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
PROJECT_UUID=
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
|
||||
|
|
|
|||
|
|
@ -90,6 +90,23 @@ class MediaController extends Controller
|
|||
]);
|
||||
}
|
||||
|
||||
public function show(Request $request) {
|
||||
$uid = $request->uid;
|
||||
$media = Media::where('uid', $uid)->first();
|
||||
if (!$media)
|
||||
abort(404);
|
||||
$infos = [
|
||||
'id' => $media->id,
|
||||
'preview' => $media->folder . $media->uid . '_preview.' . $media->extension,
|
||||
'src' => $media->folder . $media->uid . $media->extension,
|
||||
'depot' => 0,
|
||||
'typemedia' => $media->typemedia_id,
|
||||
'ext' => $media->extension,
|
||||
'dossier_id' => $media->dossier_id
|
||||
];
|
||||
return redirect()->route('media_manager')->with('autoOpen', $infos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Chargement des médias
|
||||
*
|
||||
|
|
|
|||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
29
resources/js/media.js
vendored
29
resources/js/media.js
vendored
|
|
@ -1,5 +1,19 @@
|
|||
$(document).ready(function() {
|
||||
|
||||
/* COPY CLIPBOARD */
|
||||
$('.copyclipboard').on('click', function(){
|
||||
let uid = $(window).data('current_edit_media_uid');
|
||||
let copyText = document.getElementById("copyclipboard");
|
||||
/* Select the text field */
|
||||
copyText.value = 'https://dam.lesidc.com/media/' + uid;
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
|
||||
/* Copy the text inside the text field */
|
||||
document.execCommand("copy");
|
||||
/* Alert the copied text */
|
||||
//alert("Copied the text: " + copyText.value);
|
||||
});
|
||||
|
||||
/******************************
|
||||
Liste des dossiers
|
||||
**********************************/
|
||||
|
|
@ -1904,7 +1918,7 @@ window.arrayRemove = function(arr, value){
|
|||
return arr.filter(function(ele){
|
||||
return ele != value;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
window.FileConvertSize = function(aSize){
|
||||
aSize = Math.abs(parseInt(aSize, 10));
|
||||
|
|
@ -1912,7 +1926,7 @@ window.FileConvertSize = function(aSize){
|
|||
for(var i=0; i<def.length; i++){
|
||||
if(aSize<def[i][0]) return (aSize/def[i-1][0]).toFixed(2)+' '+def[i-1][1];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.create_UUID = function(){
|
||||
var dt = new Date().getTime();
|
||||
|
|
@ -1922,11 +1936,14 @@ window.create_UUID = function(){
|
|||
return (c=='x' ? r :(r&0x3|0x8)).toString(16);
|
||||
});
|
||||
return uuid;
|
||||
}
|
||||
};
|
||||
|
||||
window.openEditor = function (obj, drPlugin, viewer, tab = false) {
|
||||
console.log("openEditor Called");
|
||||
|
||||
// Mémorise le média courant
|
||||
$(window).data('current_edit_media', obj.id);
|
||||
|
||||
// si le plugin de retouche a déjà été chargé
|
||||
if(drPlugin != null){
|
||||
drPlugin.selfDestroy(); drPlugin = null; // on détruit le plugin de retouche
|
||||
|
|
@ -1966,9 +1983,6 @@ window.openEditor = function (obj, drPlugin, viewer, tab = false) {
|
|||
var minWidth = $(document).width();
|
||||
var minHeight = $(document).height()-43-40;
|
||||
|
||||
// Mémorise le média courant
|
||||
$(window).data('current_edit_media', obj.id);
|
||||
|
||||
// sélectionne la tab preview à l'ouverture
|
||||
$("#form_media .form_media_preview").trigger("click");
|
||||
|
||||
|
|
@ -2086,6 +2100,7 @@ window.openEditor = function (obj, drPlugin, viewer, tab = false) {
|
|||
media_id : $(window).data('current_edit_media'),
|
||||
},
|
||||
success: function(result){
|
||||
$(window).data('current_edit_media_uid', result.data.uid);
|
||||
// chargement des données
|
||||
$(".tab_edit #arcadia_id").val(result.data.arcadia_id);
|
||||
$(".tab_edit #libelle").val(result.data.libelle);
|
||||
|
|
@ -2237,4 +2252,4 @@ window.openEditor = function (obj, drPlugin, viewer, tab = false) {
|
|||
}
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
@section('media_edit')
|
||||
<div id="form_media" style="display: none;" >
|
||||
<div id="form_media" style="display: none;">
|
||||
<input type="text" value="" id="copyclipboard" style="position: absolute; left: -1000px; top: -1000px;">
|
||||
<header class="group">
|
||||
<a href="#" class="tabbtn form_media_preview active" data-tab="0">Aperçu</a>
|
||||
<a href="#" class="tabbtn form_media_edit" data-tab="1">Edition</a>
|
||||
|
|
@ -227,6 +228,7 @@
|
|||
</div>
|
||||
<div class="button_bar">
|
||||
<a href="#" class="btn btn-black mr-10 btn_tab_edit_cancel">Fermer</a>
|
||||
<a href="#" class="btn btn-black mr-10 copyclipboard"><i class="fas fa-link"></i></a>
|
||||
@if (Auth::user()->hasRole([config('roles.const.ADMIN'), config('roles.const.REDACTEUR')]))
|
||||
{{--<button class="btn btn-red btn_tab_edit_delete" type="button" name="button">Supprimer</button>--}}
|
||||
@endif
|
||||
|
|
|
|||
|
|
@ -251,6 +251,21 @@
|
|||
</div>
|
||||
@endsection
|
||||
@section('scripts')
|
||||
@if (session('autoOpen'))
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
openEditor({
|
||||
id: {{session('autoOpen')['id']}},
|
||||
preview: "{{session('autoOpen')['preview']}}",
|
||||
src: "{{session('autoOpen')['src']}}",
|
||||
depot: {{session('autoOpen')['depot']}},
|
||||
typemedia: {{session('autoOpen')['typemedia']}},
|
||||
ext: "{{session('autoOpen')['ext']}}",
|
||||
dossier_id: {{session('autoOpen')['dossier_id']}}
|
||||
}, null, null);
|
||||
});
|
||||
</script>
|
||||
@endif
|
||||
<script src="{{ asset('js/jquery.nestable.min.js') }}" defer></script>
|
||||
<script src="{{ asset('js/uploadfile/vendor/jquery.ui.widget.js') }}"></script>
|
||||
<script src="{{ asset('js/uploadfile/jquery.iframe-transport.js') }}"></script>
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ Route::group(['middleware' => ['auth']], function(){
|
|||
Route::get('/', 'CommunController@index')->name('home');
|
||||
Route::get('/gestion-des-medias', 'MediaController@index')->name('media_manager');
|
||||
Route::get('/paniers', 'PanierController@index')->name('paniers');
|
||||
Route::get('/media/{uid}', 'MediaController@show')->name('media.show');
|
||||
|
||||
// Message de contact
|
||||
Route::post('/send-message', 'CommunController@sendMessage');
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue