From 854aebde1465e18476dfde48f57b0f6410afed46 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 22 Jun 2021 11:06:05 +0200 Subject: [PATCH] backports murph-skeleton --- .gitignore | 4 ++ .../components/file-manager/FileIcon.vue | 70 ++++++++++++++----- .../components/file-manager/FileManager.vue | 2 +- .../admin/components/file-manager/Files.vue | 8 +-- composer.json | 1 + config/bundles.php | 1 + config/packages/fos_js_routing.yaml | 3 + config/packages/liip_imagine.yaml | 9 +++ config/routes/liip_imagine.yaml | 2 + core/FileManager/FsFileManager.php | 2 + .../views/file_manager/info.html.twig | 19 ++++- symfony.lock | 16 +++++ 12 files changed, 111 insertions(+), 26 deletions(-) create mode 100644 config/packages/fos_js_routing.yaml create mode 100644 config/packages/liip_imagine.yaml create mode 100644 config/routes/liip_imagine.yaml diff --git a/.gitignore b/.gitignore index 1b848c3..cbaab5a 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,7 @@ yarn-error.log !/public/uploads/.gitkeep /data /.mage.yml + +###> liip/imagine-bundle ### +/public/media/cache/ +###< liip/imagine-bundle ### diff --git a/assets/js/admin/components/file-manager/FileIcon.vue b/assets/js/admin/components/file-manager/FileIcon.vue index 6e4d70f..2329767 100644 --- a/assets/js/admin/components/file-manager/FileIcon.vue +++ b/assets/js/admin/components/file-manager/FileIcon.vue @@ -1,45 +1,77 @@ + + diff --git a/assets/js/admin/components/file-manager/FileManager.vue b/assets/js/admin/components/file-manager/FileManager.vue index b159d5b..eab7f4a 100644 --- a/assets/js/admin/components/file-manager/FileManager.vue +++ b/assets/js/admin/components/file-manager/FileManager.vue @@ -20,7 +20,7 @@ export default { context: { type: String, required: true, - default: 'crud', + default: 'crud' } }, components: { diff --git a/assets/js/admin/components/file-manager/Files.vue b/assets/js/admin/components/file-manager/Files.vue index 9fec503..c4c1266 100644 --- a/assets/js/admin/components/file-manager/Files.vue +++ b/assets/js/admin/components/file-manager/Files.vue @@ -65,7 +65,7 @@
- +
@@ -110,7 +110,7 @@ - +
@@ -191,7 +191,7 @@ export default { files: [], parent: null, modalUrl: null, - ajax: 0, + ajax: 0 } }, methods: { @@ -261,7 +261,7 @@ export default { axios.get(Routing.generate('admin_file_manager_api_directory', { directory: that.directory, context: that.context, - ajax: this.ajax, + ajax: this.ajax })) .then((response) => { that.buildBreadcrum(response.data.breadcrumb) diff --git a/composer.json b/composer.json index 0848a6f..519abae 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "knplabs/knp-markdown-bundle": "^1.9", "knplabs/knp-menu-bundle": "^3.1", "knplabs/knp-paginator-bundle": "^5.4", + "liip/imagine-bundle": "^2.6", "phpdocumentor/reflection-docblock": "^5.2", "scheb/2fa-google-authenticator": "^5.7", "scheb/2fa-qr-code": "^5.7", diff --git a/config/bundles.php b/config/bundles.php index 096b755..f48fded 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -24,4 +24,5 @@ return [ FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true], Knp\DoctrineBehaviors\DoctrineBehaviorsBundle::class => ['all' => true], SPE\FilesizeExtensionBundle\SPEFilesizeExtensionBundle::class => ['all' => true], + Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true], ]; diff --git a/config/packages/fos_js_routing.yaml b/config/packages/fos_js_routing.yaml new file mode 100644 index 0000000..0268498 --- /dev/null +++ b/config/packages/fos_js_routing.yaml @@ -0,0 +1,3 @@ +fos_js_routing: + routes_to_expose: + - liip_imagine_filter diff --git a/config/packages/liip_imagine.yaml b/config/packages/liip_imagine.yaml new file mode 100644 index 0000000..f201244 --- /dev/null +++ b/config/packages/liip_imagine.yaml @@ -0,0 +1,9 @@ +# See dos how to configure the bundle: https://symfony.com/doc/current/bundles/LiipImagineBundle/basic-usage.html +liip_imagine: + # valid drivers options include "gd" or "gmagick" or "imagick" + driver: "imagick" + filter_sets: + file_manager_thumbnail_filter: + filters: + downscale: + max: [120, 120] diff --git a/config/routes/liip_imagine.yaml b/config/routes/liip_imagine.yaml new file mode 100644 index 0000000..201cbd5 --- /dev/null +++ b/config/routes/liip_imagine.yaml @@ -0,0 +1,2 @@ +_liip_imagine: + resource: "@LiipImagineBundle/Resources/config/routing.yaml" diff --git a/core/FileManager/FsFileManager.php b/core/FileManager/FsFileManager.php index 84bccc2..f2f77ea 100644 --- a/core/FileManager/FsFileManager.php +++ b/core/FileManager/FsFileManager.php @@ -77,6 +77,7 @@ class FsFileManager $data['directories'][] = [ 'basename' => $file->getBasename(), 'path' => $directory.'/'.$file->getBasename(), + 'webPath' => $this->pathUri.'/'.$directory.'/'.$file->getBasename(), 'locked' => $this->isLocked($directory.'/'.$file->getBasename()), 'mime' => null, ]; @@ -89,6 +90,7 @@ class FsFileManager $data['files'][] = [ 'basename' => $file->getBasename(), 'path' => $directory, + 'webPath' => $this->pathUri.'/'.$directory.'/'.$file->getBasename(), 'locked' => $this->isLocked($directory.'/'.$file->getBasename()), 'mime' => mime_content_type($file->getRealPath()), ]; diff --git a/core/Resources/views/file_manager/info.html.twig b/core/Resources/views/file_manager/info.html.twig index 511c8dd..c2edd29 100644 --- a/core/Resources/views/file_manager/info.html.twig +++ b/core/Resources/views/file_manager/info.html.twig @@ -131,8 +131,24 @@ {% endif %}
-