fixed page asset reference paths for saving
switched to using sortjs method for collecting urls for assets associated with page
This commit is contained in:
parent
7024285b70
commit
bd5f57b9ac
2 changed files with 18 additions and 28 deletions
|
@ -64,23 +64,13 @@ export default class FileManager {
|
|||
getFileOrder() {
|
||||
let imgList = '';
|
||||
let fileList = '';
|
||||
//change file order this and chance data-source to data-id
|
||||
//console.log('ORDER', this.mediaSort.toArray());
|
||||
for (var i = 0, length = this.imageList.childNodes.length; i < length; i++) {
|
||||
try {
|
||||
let div = this.imageList.childNodes[i];
|
||||
imgList = imgList + div.getAttribute('data-source') + ',';
|
||||
} catch (e) {
|
||||
//something is function
|
||||
}
|
||||
}
|
||||
for (var i = 0, length = this.fileList.childNodes.length; i < length; i++) {
|
||||
try {
|
||||
let div = this.fileList.childNodes[i];
|
||||
fileList = fileList + div.getAttribute('data-source') + ',';
|
||||
} catch (e) {
|
||||
//something is function
|
||||
let mediaArray = this.mediaSort.toArray();
|
||||
let fileArray = this.fileSort.toArray();
|
||||
for (var i = 0, length = mediaArray.length; i < length; i++) {
|
||||
imgList = imgList + mediaArray[i] + ',';
|
||||
}
|
||||
for (var i = 0, length = fileArray.length; i < length; i++) {
|
||||
fileList = fileList + fileArray[i] + ',';
|
||||
}
|
||||
let media = { images: imgList, files: fileList };
|
||||
return media;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
@if(count($media)>1)
|
||||
@foreach($media as $item)
|
||||
@if($item['type'] == "mp4")
|
||||
<div id="{{ $loop->index }}" class="video-item" data-source="{{ $item['file'] }}">
|
||||
<div id="{{ $loop->index }}" class="video-item" data-id="{{ $item['file'] }}">
|
||||
<video>
|
||||
<source src="{{ $item['file'] }}"/>
|
||||
</video>
|
||||
|
@ -59,7 +59,7 @@
|
|||
</button>
|
||||
</div>
|
||||
@else
|
||||
<div id="{{ $loop->index }}" class="img-item" data-source="{{ $item['file'] }}" style="background: url({{ $item['file'] }}) no-repeat center center / cover">
|
||||
<div id="{{ $loop->index }}" class="img-item" data-id="{{ $item['file'] }}" style="background: url({{ $item['file'] }}) no-repeat center center / cover">
|
||||
<button id="{{ $loop->index }}" class="media-remove">
|
||||
<i class="ti ti-x"></i>
|
||||
</button>
|
||||
|
@ -67,14 +67,14 @@
|
|||
@endif
|
||||
@endforeach
|
||||
@else
|
||||
@if(media[0] != '')
|
||||
@if(media[0]['type'] == "mp4")
|
||||
<div id="0" class="video-item" data-source="{{ media[0]['file'] }}">
|
||||
<button id="{{ $loop->index }}" class="media-remove">X</button>
|
||||
@if($media[0] != '')
|
||||
@if($media[0]['type'] == "mp4")
|
||||
<div id="0" class="video-item" data-id="{{ $media[0]['file'] }}">
|
||||
<button id="0" class="media-remove">X</button>
|
||||
</div>
|
||||
@else
|
||||
<div id="0" class="img-item" data-source="{{ media[0]['file'] }}" style="background: url({{ media[0]['file'] }}) no-repeat center center / cover">
|
||||
<button id="{{ $loop->index }}" class="media-remove">
|
||||
<div id="0" class="img-item" data-id="{{ $media[0]['file'] }}" style="background: url({{ $media[0]['file'] }}) no-repeat center center / cover">
|
||||
<button id="0" class="media-remove">
|
||||
<i class="ti ti-x"></i>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -90,7 +90,7 @@
|
|||
$fileName = explode("/", $item['file']);
|
||||
@endphp
|
||||
@if($item['type'] == "mp3")
|
||||
<div id="{{ $loop->index }}" class="audio-item" data-source="{{ $item['file'] }}">
|
||||
<div id="{{ $loop->index }}" class="audio-item" data-id="{{ $item['file'] }}">
|
||||
<audio controls>
|
||||
<source src="{{ $item['file'] }}"/>
|
||||
</audio>
|
||||
|
@ -99,7 +99,7 @@
|
|||
</button>
|
||||
</div>
|
||||
@else
|
||||
<div id="{{ $loop->index }}" class="file-item" data-source="{{ $item['file'] }}">
|
||||
<div id="{{ $loop->index }}" class="file-item" data-id="{{ $item['file'] }}">
|
||||
<a href="{{ $item['file'] }}" target="_blank">{{ $fileName[6] }}"</a>
|
||||
<button id="{{ $loop->index }}" class="media-remove">
|
||||
<i class="ti ti-x"></i>
|
||||
|
@ -113,7 +113,7 @@
|
|||
$fileName = explode("/", $item['file']);
|
||||
@endphp
|
||||
@if($files[0]['type'] == "mp3")
|
||||
<div id="0" class="audio-item" data-source="{{ $files[0]['file'] }}">
|
||||
<div id="0" class="audio-item" data-id="{{ $files[0]['file'] }}">
|
||||
<audio controls>
|
||||
<source src="{{ $files[0]['file'] }}"/>
|
||||
</audio>
|
||||
|
@ -122,7 +122,7 @@
|
|||
</button>
|
||||
</div>
|
||||
@else
|
||||
<div id="0" class="file-item" data-source="{{ $files[0]['file'] }}">
|
||||
<div id="0" class="file-item" data-id="{{ $files[0]['file'] }}">
|
||||
<a href="{{ $item['file'] }}" target="_blank">{{ $fileName[6] }}"</a>
|
||||
<button id="{{ $loop->index }}" class="media-remove">
|
||||
<i class="ti ti-x"></i>
|
||||
|
|
Loading…
Reference in a new issue