Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions config/file_library.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@
'filesize_limit' => env('FILE_LIBRARY_FILESIZE_LIMIT', 50),
'allowed_extensions' => [],
'prefix_uuid_with_local_path' => false,
'show_uploaded_date' => false,
'format_uploaded_date' => 'd/m/Y H:i',
];
1 change: 1 addition & 0 deletions frontend/js/components/media-library/MediaSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<li class="f--small" v-if="isImage && (firstMedia.width + firstMedia.height)">
{{ $trans('media-library.sidebar.dimensions', 'Dimensions') }}: {{ firstMedia.width }} &times; {{ firstMedia.height }}
</li>
<li class="f--small" v-if="firstMedia.uploadedDate">{{ $trans('media-library.sidebar.uploaded-at', 'Uploaded at') }}: {{ firstMedia.uploadedDate }}</li>
</ul>
</template>

Expand Down
1 change: 1 addition & 0 deletions lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
'empty-text' => 'No file selected',
'files-selected' => 'files selected',
'tags' => 'Tags',
'uploaded-at' => 'Uploaded at',
],
'title' => 'Media Library',
'update' => 'Update',
Expand Down
1 change: 1 addition & 0 deletions lang/fr/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@
'empty-text' => 'Aucun fichier sélectionné',
'files-selected' => 'fichiers sélectionnés',
'tags' => 'Tags',
'uploaded-at' => 'Uploaded at',
],
'title' => 'Galerie de médias',
'update' => 'Mettre à jour',
Expand Down
8 changes: 7 additions & 1 deletion src/Models/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,20 @@ public function scopeUnused($query)

public function toCmsArray()
{
$uploadedDate = [];
if (config('twill.file-library.show_uploaded_date')) {
$uploadedDate = [
'uploadedDate' => $this->created_at->format(config("twill.file-library.format_uploaded_date", "d/m/Y H:i"))
];
}
return [
'id' => $this->id,
'name' => $this->filename,
'src' => FileService::getUrl($this->uuid),
'original' => FileService::getUrl($this->uuid),
'size' => $this->size,
'filesizeInMb' => number_format($this->attributes['size'] / 1048576, 2),
];
] + $uploadedDate;
}

public function getTable()
Expand Down
Loading