add: ajout taille fichier
This commit is contained in:
parent
b620050763
commit
06387c2c88
4 changed files with 104 additions and 3 deletions
70
.dockerignore
Normal file
70
.dockerignore
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
# Git
|
||||
.git
|
||||
.gitignore
|
||||
.gitattributes
|
||||
|
||||
# IDE
|
||||
.idea
|
||||
.vscode
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
|
||||
# Environment
|
||||
.env.local
|
||||
.env.*.local
|
||||
stack.env
|
||||
.env.example
|
||||
|
||||
# Dependencies (will be installed in container)
|
||||
/vendor/
|
||||
/node_modules/
|
||||
|
||||
# Build artifacts
|
||||
/var/
|
||||
/build/
|
||||
/dist/
|
||||
|
||||
# Cache
|
||||
/.phpunit.cache/
|
||||
/public/bundles/
|
||||
/public/assets/
|
||||
/assets/vendor/
|
||||
|
||||
# Tests
|
||||
/phpunit.xml
|
||||
/tests/
|
||||
|
||||
# Uploads (might be managed separately)
|
||||
/public/uploads/
|
||||
/src/uploads/
|
||||
|
||||
# Config secrets
|
||||
/config/secrets/prod/prod.decrypt.private.php
|
||||
secrets/
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
*.log
|
||||
|
||||
# Docker files
|
||||
Dockerfile
|
||||
docker-compose*.yml
|
||||
docker-compose*.yaml
|
||||
.dockerignore
|
||||
|
||||
# CI/CD
|
||||
.github/
|
||||
.gitlab-ci.yml
|
||||
.travis.yml
|
||||
|
||||
# Documentation
|
||||
*.md
|
||||
/document/
|
||||
|
||||
# Misc
|
||||
.editorconfig
|
||||
.codeclimate.yml
|
||||
|
||||
|
||||
|
|
@ -28,19 +28,38 @@
|
|||
border-color: var(--border-dark);
|
||||
}
|
||||
|
||||
.maps-info {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 0.5rem;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.maps-name {
|
||||
font-weight: 600;
|
||||
font-size: 1rem;
|
||||
color: var(--text-light);
|
||||
margin: 0;
|
||||
transition: color var(--duration-slow) ease;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .maps-name {
|
||||
color: var(--text-dark);
|
||||
}
|
||||
|
||||
.maps-size {
|
||||
font-size: 0.85rem;
|
||||
display: flex;
|
||||
align-items: end;
|
||||
justify-content: center;
|
||||
color: var(--text-light-secondary, #6c757d);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .maps-size {
|
||||
color: var(--text-dark-secondary, #a8adbd);
|
||||
}
|
||||
|
||||
.maps-btn {
|
||||
display: inline-block;
|
||||
padding: 0.6rem 1.2rem;
|
||||
|
|
|
|||
|
|
@ -25,9 +25,11 @@ final class MapsController extends AbstractController
|
|||
$scandir = scandir($mapsDir);
|
||||
foreach ($scandir as $file) {
|
||||
if ($file !== '.' && $file !== '..' && is_file($mapsDir . '/' . $file)) {
|
||||
$filePath = $mapsDir . '/' . $file;
|
||||
$files[] = [
|
||||
'filename' => $file,
|
||||
'display' => pathinfo($file, PATHINFO_FILENAME)
|
||||
'display' => pathinfo($file, PATHINFO_FILENAME),
|
||||
'size' => filesize($filePath)
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,17 @@
|
|||
<div class="maps-list">
|
||||
{% for file in files %}
|
||||
<div class="maps">
|
||||
<div class="maps-info">
|
||||
<p class="maps-name"> {{ file.display }} </p>
|
||||
<p class="maps-size">
|
||||
{% set sizeInMB = (file.size / 1024 / 1024) %}
|
||||
{% if sizeInMB >= 950 %}
|
||||
{{ (file.size / 1024 / 1024 / 1024) | round(2) }} Go
|
||||
{% else %}
|
||||
{{ sizeInMB | round(2) }} Mo
|
||||
{% endif %}
|
||||
</p>
|
||||
</div>
|
||||
<a href="{{ path('app_maps_download', {'filename': file.filename}) }}" class="maps-btn" >
|
||||
Télécharger
|
||||
</a>
|
||||
|
|
|
|||
Loading…
Reference in a new issue