This commit is contained in:
2025-07-29 14:51:01 +02:00
parent 540f6cd1d6
commit 2558363a67
4 changed files with 9 additions and 10 deletions

View File

@ -18,8 +18,8 @@ class FileController extends AbstractController
$this->fileService = $fileService; $this->fileService = $fileService;
} }
#[Route('/user/file/{domain}/{id}', name: 'app_files', methods: ['GET'])] #[Route('/user/file/{domain}/{id}/{editable}', name: 'app_files', methods: ['GET'])]
public function browse(string $domain, int $id, Request $request): Response public function browse(string $domain, int $id, int $editable, Request $request): Response
{ {
$relativePath = $request->query->get('path', ''); $relativePath = $request->query->get('path', '');
@ -31,15 +31,16 @@ class FileController extends AbstractController
'id' => $id, 'id' => $id,
'files' => $files, 'files' => $files,
'path' => $relativePath, 'path' => $relativePath,
'editable' => true, 'editable' => $editable,
]); ]);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->addFlash('danger', $e->getMessage()); $this->addFlash('danger', $e->getMessage());
dd($e->getMessage());
return $this->redirectToRoute('app_files', [ return $this->redirectToRoute('app_files', [
'domain' => $domain, 'domain' => $domain,
'id' => $id, 'id' => $id,
'editable' => true, 'editable' => $editable,
]); ]);
} }
} }

View File

@ -2,7 +2,7 @@
class="file-browser" class="file-browser"
data-domain="{{ domain }}" data-domain="{{ domain }}"
data-id="{{ id }}" data-id="{{ id }}"
data-base-path="{{ path('app_files', { domain: domain, id: id }) }}" data-base-path="{{ path('app_files', { domain: domain, id: id, editable: editable }) }}"
data-current-path="{{ path }}"> data-current-path="{{ path }}">
<div class="card mt-3"> <div class="card mt-3">

View File

@ -5,10 +5,8 @@
<div class='d-flex' style='justify-content: center'> <div class='d-flex' style='justify-content: center'>
{% for project in projects %} {% for project in projects %}
<div class='card'> <div class='card'>
<a href='{{ path('app_project_view',{id:project.id})}}' class='d-flex' style='flex-direction: column; text-align: center'> <h5>{{project.title}}</h5>
<img src='{{asset(project.logo)}}' style='width:250px'> {{ render(path("app_files",{domain:'project',id:project.id, editable:0})) }}
<h5>{{project.title}}</h5>
</a>
</div> </div>
{% endfor %} {% endfor %}

View File

@ -35,7 +35,7 @@
</div> </div>
{% if mode=="update" %} {% if mode=="update" %}
{{ render(path("app_files",{domain:'project',id:project.id})) }} {{ render(path("app_files",{domain:'project',id:project.id, editable:1})) }}
{% endif %} {% endif %}
{{ form_end(form) }} {{ form_end(form) }}