add html preview file
This commit is contained in:
parent
372ea209b7
commit
f0cab56ca0
|
@ -72,6 +72,7 @@ core:
|
|||
- application/octet-stream
|
||||
- application/msword
|
||||
- text/plain
|
||||
- text/html
|
||||
- text/css
|
||||
- application/sla
|
||||
path_locked:
|
||||
|
|
|
@ -56,6 +56,10 @@ class StlMeshController extends PageController
|
|||
throw $this->createNotFoundException();
|
||||
}
|
||||
|
||||
if (isset($file['htmlPreviewFile'])) {
|
||||
$file['htmlPreviewFile'] = file_get_contents($file['htmlPreviewFile']);
|
||||
}
|
||||
|
||||
return $this->render('page/mesh/viewer.html.twig', [
|
||||
'mesh' => $stlMesh,
|
||||
'file' => $file,
|
||||
|
|
|
@ -24,6 +24,9 @@ class StlFileType extends AbstractType
|
|||
'required' => true,
|
||||
'attr' => [
|
||||
],
|
||||
'row_attr' => [
|
||||
'class' => 'col-md-6',
|
||||
],
|
||||
'constraints' => [
|
||||
new NotBlank(),
|
||||
],
|
||||
|
@ -34,8 +37,25 @@ class StlFileType extends AbstractType
|
|||
'file',
|
||||
FilePickerType::class,
|
||||
[
|
||||
'label' => false,
|
||||
'label' => 'Fichier STL',
|
||||
'required' => true,
|
||||
'row_attr' => [
|
||||
'class' => 'col-md-6',
|
||||
],
|
||||
'constraints' => [
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
$builder->add(
|
||||
'htmlPreviewFile',
|
||||
FilePickerType::class,
|
||||
[
|
||||
'label' => 'Rendu HTML',
|
||||
'required' => false,
|
||||
'row_attr' => [
|
||||
'class' => 'col-md-6',
|
||||
],
|
||||
'constraints' => [
|
||||
],
|
||||
]
|
||||
|
|
|
@ -67,6 +67,9 @@ class StlMeshType extends AbstractType
|
|||
'required' => false,
|
||||
'attr' => [
|
||||
],
|
||||
'row_attr' => [
|
||||
'class' => 'col-md-6',
|
||||
],
|
||||
'constraints' => [
|
||||
],
|
||||
]
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
{% if not file.htmlPreviewFile is empty %}
|
||||
{{ file.htmlPreviewFile|raw }}
|
||||
{% else %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@ -14,3 +17,4 @@
|
|||
|
||||
</body>
|
||||
</html>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in a new issue