backports murph-skeleton
This commit is contained in:
parent
092233a375
commit
854aebde14
|
@ -28,3 +28,7 @@ yarn-error.log
|
||||||
!/public/uploads/.gitkeep
|
!/public/uploads/.gitkeep
|
||||||
/data
|
/data
|
||||||
/.mage.yml
|
/.mage.yml
|
||||||
|
|
||||||
|
###> liip/imagine-bundle ###
|
||||||
|
/public/media/cache/
|
||||||
|
###< liip/imagine-bundle ###
|
||||||
|
|
|
@ -1,45 +1,77 @@
|
||||||
<template>
|
<template>
|
||||||
<span v-bind:class="getIcon(mime)"></span>
|
<span>
|
||||||
|
<span v-if="!thumb || !thumbnail" v-bind:class="icon"></span>
|
||||||
|
<img v-if="thumb && thumbnail" v-bind:src="thumbnail">
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Routing from '../../../../../vendor/friendsofsymfony/jsrouting-bundle/Resources/public/js/router.min.js'
|
||||||
|
const routes = require('../../../../../public/js/fos_js_routes.json')
|
||||||
|
|
||||||
|
Routing.setRoutingData(routes)
|
||||||
|
|
||||||
const map = {
|
const map = {
|
||||||
'fa-file-pdf': ['application/pdf'],
|
'fa fa-file-pdf': ['application/pdf'],
|
||||||
'fa-file-image': ['image/png', 'image/jpg', 'image/jpeg', 'image/gif'],
|
'fa fa-file-image': ['image/png', 'image/jpg', 'image/jpeg', 'image/gif'],
|
||||||
'fa-file-audio': ['application/ogg', 'audio/mp3', 'audio/mpeg', 'audio/wav'],
|
'fa fa-file-audio': ['application/ogg', 'audio/mp3', 'audio/mpeg', 'audio/wav'],
|
||||||
'fa-file-archive': ['application/zip', 'multipart/x-zip', 'application/rar', 'application/x-rar-compressed', 'application/x-zip-compressed', 'application/tar', 'application/x-tar'],
|
'fa fa-file-archive': ['application/zip', 'multipart/x-zip', 'application/rar', 'application/x-rar-compressed', 'application/x-zip-compressed', 'application/tar', 'application/x-tar'],
|
||||||
'fa-file-alt': ['application/rtf'],
|
'fa fa-file-alt': ['application/rtf'],
|
||||||
'fa-file-excel': ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
'fa fa-file-excel': ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
||||||
'fa-file-powerpoint': ['application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
|
'fa fa-file-powerpoint': ['application/vnd.ms-powerpoint', 'application/vnd.openxmlformats-officedocument.presentationml.presentation'],
|
||||||
'fa-file-video': ['video/x-msvideo', 'video/mpeg']
|
'fa fa-file-video': ['video/x-msvideo', 'video/mpeg']
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'FileIcon',
|
name: 'FileIcon',
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
icon: null,
|
||||||
|
thumbnail: null
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getIcon (mime) {
|
defineIcon () {
|
||||||
const icons = ['fa']
|
|
||||||
let iconFound = false
|
|
||||||
|
|
||||||
for (const icon in map) {
|
for (const icon in map) {
|
||||||
if (map[icon].indexOf(mime) !== -1) {
|
if (map[icon].indexOf(this.mime) !== -1) {
|
||||||
iconFound = true
|
this.icon = icon
|
||||||
icons.push(icon)
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!iconFound) {
|
this.icon = 'fa fa-file'
|
||||||
icons.push('fa-file')
|
},
|
||||||
|
defineThumbnail () {
|
||||||
|
if (['image/png', 'image/jpg', 'image/jpeg', 'image/gif'].indexOf(this.mime) === -1) {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return icons
|
this.thumbnail = Routing.generate('liip_imagine_filter', {
|
||||||
|
filter: 'file_manager_thumbnail_filter',
|
||||||
|
path: this.path
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
mime: {
|
mime: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true
|
required: true
|
||||||
|
},
|
||||||
|
path: {
|
||||||
|
type: String,
|
||||||
|
required: true
|
||||||
|
},
|
||||||
|
thumb: {
|
||||||
|
type: Boolean,
|
||||||
|
required: true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
mounted () {
|
||||||
|
this.defineIcon()
|
||||||
|
this.defineThumbnail()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default {
|
||||||
context: {
|
context: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: true,
|
||||||
default: 'crud',
|
default: 'crud'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
<div class="card-text">
|
<div class="card-text">
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<div class="display-4 text-muted">
|
<div class="display-4 text-muted">
|
||||||
<FileIcon v-bind:mime="item.mime" />
|
<FileIcon v-bind:mime="item.mime" v-bind:path="item.webPath" v-bind:thumb="true" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="item.locked" class="file-manager-grid-lock">
|
<div v-if="item.locked" class="file-manager-grid-lock">
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-for="item in files">
|
<tr v-for="item in files">
|
||||||
<td width="10">
|
<td width="10">
|
||||||
<FileIcon v-bind:mime="item.mime" />
|
<FileIcon v-bind:mime="item.mime" v-bind:path="item.webPath" v-bind:thumb="false" />
|
||||||
</td>
|
</td>
|
||||||
<td v-on:click="modalUrl = generateInfoLink(item, null, context)" v-bind:data-modal="generateInfoLink(item, null, context)">
|
<td v-on:click="modalUrl = generateInfoLink(item, null, context)" v-bind:data-modal="generateInfoLink(item, null, context)">
|
||||||
<div v-if="item.locked" class="float-right">
|
<div v-if="item.locked" class="float-right">
|
||||||
|
@ -191,7 +191,7 @@ export default {
|
||||||
files: [],
|
files: [],
|
||||||
parent: null,
|
parent: null,
|
||||||
modalUrl: null,
|
modalUrl: null,
|
||||||
ajax: 0,
|
ajax: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
@ -261,7 +261,7 @@ export default {
|
||||||
axios.get(Routing.generate('admin_file_manager_api_directory', {
|
axios.get(Routing.generate('admin_file_manager_api_directory', {
|
||||||
directory: that.directory,
|
directory: that.directory,
|
||||||
context: that.context,
|
context: that.context,
|
||||||
ajax: this.ajax,
|
ajax: this.ajax
|
||||||
}))
|
}))
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
that.buildBreadcrum(response.data.breadcrumb)
|
that.buildBreadcrum(response.data.breadcrumb)
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
"knplabs/knp-markdown-bundle": "^1.9",
|
"knplabs/knp-markdown-bundle": "^1.9",
|
||||||
"knplabs/knp-menu-bundle": "^3.1",
|
"knplabs/knp-menu-bundle": "^3.1",
|
||||||
"knplabs/knp-paginator-bundle": "^5.4",
|
"knplabs/knp-paginator-bundle": "^5.4",
|
||||||
|
"liip/imagine-bundle": "^2.6",
|
||||||
"phpdocumentor/reflection-docblock": "^5.2",
|
"phpdocumentor/reflection-docblock": "^5.2",
|
||||||
"scheb/2fa-google-authenticator": "^5.7",
|
"scheb/2fa-google-authenticator": "^5.7",
|
||||||
"scheb/2fa-qr-code": "^5.7",
|
"scheb/2fa-qr-code": "^5.7",
|
||||||
|
|
|
@ -24,4 +24,5 @@ return [
|
||||||
FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true],
|
FOS\JsRoutingBundle\FOSJsRoutingBundle::class => ['all' => true],
|
||||||
Knp\DoctrineBehaviors\DoctrineBehaviorsBundle::class => ['all' => true],
|
Knp\DoctrineBehaviors\DoctrineBehaviorsBundle::class => ['all' => true],
|
||||||
SPE\FilesizeExtensionBundle\SPEFilesizeExtensionBundle::class => ['all' => true],
|
SPE\FilesizeExtensionBundle\SPEFilesizeExtensionBundle::class => ['all' => true],
|
||||||
|
Liip\ImagineBundle\LiipImagineBundle::class => ['all' => true],
|
||||||
];
|
];
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
fos_js_routing:
|
||||||
|
routes_to_expose:
|
||||||
|
- liip_imagine_filter
|
|
@ -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]
|
|
@ -0,0 +1,2 @@
|
||||||
|
_liip_imagine:
|
||||||
|
resource: "@LiipImagineBundle/Resources/config/routing.yaml"
|
|
@ -77,6 +77,7 @@ class FsFileManager
|
||||||
$data['directories'][] = [
|
$data['directories'][] = [
|
||||||
'basename' => $file->getBasename(),
|
'basename' => $file->getBasename(),
|
||||||
'path' => $directory.'/'.$file->getBasename(),
|
'path' => $directory.'/'.$file->getBasename(),
|
||||||
|
'webPath' => $this->pathUri.'/'.$directory.'/'.$file->getBasename(),
|
||||||
'locked' => $this->isLocked($directory.'/'.$file->getBasename()),
|
'locked' => $this->isLocked($directory.'/'.$file->getBasename()),
|
||||||
'mime' => null,
|
'mime' => null,
|
||||||
];
|
];
|
||||||
|
@ -89,6 +90,7 @@ class FsFileManager
|
||||||
$data['files'][] = [
|
$data['files'][] = [
|
||||||
'basename' => $file->getBasename(),
|
'basename' => $file->getBasename(),
|
||||||
'path' => $directory,
|
'path' => $directory,
|
||||||
|
'webPath' => $this->pathUri.'/'.$directory.'/'.$file->getBasename(),
|
||||||
'locked' => $this->isLocked($directory.'/'.$file->getBasename()),
|
'locked' => $this->isLocked($directory.'/'.$file->getBasename()),
|
||||||
'mime' => mime_content_type($file->getRealPath()),
|
'mime' => mime_content_type($file->getRealPath()),
|
||||||
];
|
];
|
||||||
|
|
|
@ -131,8 +131,24 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer {% if context != 'tinymce' %}justify-content-between{% endif %}">
|
<div class="modal-footer justify-content-between">
|
||||||
{% if context == 'tinymce' %}
|
{% if context == 'tinymce' %}
|
||||||
|
{% if not isLocked %}
|
||||||
|
{% if splInfo.isDir %}
|
||||||
|
<button form="form-file-delete" class="btn btn-primary" data-modal="{{ path('admin_file_manager_directory_rename', {file: splInfo.relativePathname, ajax: ajax}) }}">
|
||||||
|
{{ 'Rename'|trans }}
|
||||||
|
</button>
|
||||||
|
{% else %}
|
||||||
|
<span></span>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
|
<div>
|
||||||
|
<span class="btn btn-light">
|
||||||
|
<span class="fa fa-lock"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'Close'|trans }}</button>
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">{{ 'Close'|trans }}</button>
|
||||||
|
|
||||||
|
@ -154,7 +170,6 @@
|
||||||
{{ 'Rename'|trans }}
|
{{ 'Rename'|trans }}
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="btn btn-light">
|
<span class="btn btn-light">
|
||||||
<span class="fa fa-lock"></span>
|
<span class="fa fa-lock"></span>
|
||||||
|
|
16
symfony.lock
16
symfony.lock
|
@ -126,6 +126,9 @@
|
||||||
"gedmo/doctrine-extensions": {
|
"gedmo/doctrine-extensions": {
|
||||||
"version": "v3.0.3"
|
"version": "v3.0.3"
|
||||||
},
|
},
|
||||||
|
"imagine/imagine": {
|
||||||
|
"version": "1.2.4"
|
||||||
|
},
|
||||||
"khanamiryan/qrcode-detector-decoder": {
|
"khanamiryan/qrcode-detector-decoder": {
|
||||||
"version": "1.0.4"
|
"version": "1.0.4"
|
||||||
},
|
},
|
||||||
|
@ -156,6 +159,19 @@
|
||||||
"laminas/laminas-zendframework-bridge": {
|
"laminas/laminas-zendframework-bridge": {
|
||||||
"version": "1.2.0"
|
"version": "1.2.0"
|
||||||
},
|
},
|
||||||
|
"liip/imagine-bundle": {
|
||||||
|
"version": "1.8",
|
||||||
|
"recipe": {
|
||||||
|
"repo": "github.com/symfony/recipes-contrib",
|
||||||
|
"branch": "master",
|
||||||
|
"version": "1.8",
|
||||||
|
"ref": "5a5bdc2d0e2533ed6935d5ae562f2b318a8fc1ee"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"config/packages/liip_imagine.yaml",
|
||||||
|
"config/routes/liip_imagine.yaml"
|
||||||
|
]
|
||||||
|
},
|
||||||
"michelf/php-markdown": {
|
"michelf/php-markdown": {
|
||||||
"version": "1.9.0"
|
"version": "1.9.0"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue