@@ -23,7 +23,7 @@ final class FileManagerField implements FieldInterface | |||
->setProperty($propertyName) | |||
->setLabel($label) | |||
->setTemplatePath('@LcSov/tabler/crud/field/image.html.twig') | |||
->addJsFiles('bundles/lcsov/js/form-type-file-manager.js') | |||
->addWebpackEncoreEntries('field-filemanager') | |||
->setFormType(FileManagerType::class) | |||
->addCssClass('field-text') | |||
->setCustomOption(self::OPTION_MAX_LENGTH, null) |
@@ -0,0 +1,144 @@ | |||
/*! Generated by Font Squirrel (https://www.fontsquirrel.com) on May 17, 2021 */ | |||
@font-face { | |||
font-family: 'source_sans_proregular'; | |||
src: url('fonts/sourcesanspro-regular-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-regular-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_prolight'; | |||
src: url('fonts/sourcesanspro-light-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-light-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_prolight_italic'; | |||
src: url('fonts/sourcesanspro-lightit-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-lightit-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_proitalic'; | |||
src: url('fonts/sourcesanspro-it-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-it-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_proXLtIt'; | |||
src: url('fonts/sourcesanspro-extralightit-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-extralightit-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_proextralight'; | |||
src: url('fonts/sourcesanspro-extralight-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-extralight-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_proSBdIt'; | |||
src: url('fonts/sourcesanspro-semiboldit-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-semiboldit-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_prosemibold'; | |||
src: url('fonts/sourcesanspro-semibold-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-semibold-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_probold_italic'; | |||
src: url('fonts/sourcesanspro-boldit-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-boldit-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_probold'; | |||
src: url('fonts/sourcesanspro-bold-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-bold-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_problack_italic'; | |||
src: url('fonts/sourcesanspro-blackit-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-blackit-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} | |||
@font-face { | |||
font-family: 'source_sans_problack'; | |||
src: url('fonts/sourcesanspro-black-webfont.woff2') format('woff2'), | |||
url('fonts/sourcesanspro-black-webfont.woff') format('woff'); | |||
font-weight: normal; | |||
font-style: normal; | |||
} |
@@ -1,7 +1,89 @@ | |||
//JQUERY | |||
import 'jquery'; | |||
global.$ = global.jQuery = $; | |||
import './common.scss'; | |||
//ADMINLTE | |||
import 'adminlte-js' ; | |||
import "adminlte-css"; | |||
import "fontawesome-css"; | |||
//BOOTSTRAP | |||
import 'adminlte-plugin/bootstrap/js/bootstrap.min.js'; | |||
import './utils/log.js'; | |||
// SELECT 2 | |||
import 'adminlte-plugin/select2/js/select2.min.js'; | |||
import 'adminlte-plugin/select2/js/i18n/fr.js'; | |||
import 'adminlte-plugin/select2/css/select2.min.css'; | |||
import 'adminlte-plugin/select2-bootstrap4-theme/select2-bootstrap4.min.css'; | |||
// SOV CSS | |||
import './common.scss'; | |||
import log from './utils/log.js'; | |||
//log('ncnnc'); | |||
//$('#test22').modal('show'); | |||
if ($('.select2, select.form-control').length) { | |||
$('form .form-widget>select.form-control, .select2').each(function (i, elm) { | |||
if (!$(this).hasClass('disable-select2')) { | |||
setSelect2($(elm)); | |||
} | |||
}); | |||
$('form .form-inline>select.form-control').each(function (i, elm) { | |||
if (!$(this).hasClass('disable-select2')) { | |||
setSelect2($(elm)); | |||
} | |||
}); | |||
} | |||
function setSelect2($select) { | |||
if (typeof $select.data('select2-id') === 'undefined') { | |||
$select.data('init', 'set') | |||
var options = { | |||
width: "100%", | |||
theme: "bootstrap4", | |||
dropdownAutoWidth: false, | |||
allowClear: true, | |||
minimumResultsForSearch: 8 | |||
}; | |||
if ($select.data('allow-clear') == 'false') { | |||
options.allowClear = false; | |||
} | |||
if ($select.data('width')) { | |||
options.width = 'auto' | |||
} | |||
if ($select.find('option[value=""]')) { | |||
options.placeholder = $select.find('option[value=""]').html() | |||
} | |||
/*if($select.is(':required') == false) { | |||
options.allowclear = true | |||
}*/ | |||
var myselect = $select.select2(options); | |||
myselect.on('select2:select', function (e) { | |||
var event = new Event('change'); | |||
e.target.dispatchEvent(event); | |||
}); | |||
myselect.on('select2:unselect', function (e) { | |||
var event = new Event('change'); | |||
e.target.dispatchEvent(event); | |||
}); | |||
return myselect; | |||
} | |||
} | |||
//require('select2'); | |||
//require('adminlte'); | |||
//import 'adminltePlugin/bootstrap/js/bootstrap.min.js' | |||
///import 'admin-lte/dist/css/adminlte.min.css' ; | |||
//require('admin-lte-css') ; | |||
// import './common.js' ; |
@@ -0,0 +1,30 @@ | |||
$(document).ready(function () { | |||
initFileManager(); | |||
}); | |||
function initFileManager() { | |||
$('.lc-filemanager-delete').off('click'); | |||
$('.lc-filemanager-delete').on('click', function (e) { | |||
let $field = $(this); | |||
$('#' + $field.data('id')).val(""); | |||
$('#' + $field.data('id') + '_preview').prop('src',""); | |||
}); | |||
$('.lc-filemanager-open').off('click'); | |||
$('.lc-filemanager-open').on('click', function (e) { | |||
let $field = $(this); | |||
$('#lc-filemanager-frame').off('load'); | |||
$("#lc-filemanager-frame").on('load', function () { | |||
$('#lc-filemanager-frame').contents().on('click', '.select', function () { | |||
var path = $(this).attr('data-path') | |||
$('#' + $field.data('id')).val(path); | |||
$('#' + $field.data('id') + '_preview').prop('src',path); | |||
$('#lc-filemanager-modal').modal('hide') | |||
}); | |||
}); | |||
$("#lc-filemanager-frame").prop('src', $field.data('target')); | |||
$('#lc-filemanager-modal').modal('show'); | |||
}); | |||
} |
@@ -60,11 +60,9 @@ | |||
<h2 class="card-title">{{ ea.crud.customPageTitle is null ? default_title|raw : ea.crud.customPageTitle('new')|trans(ea.i18n.translationParameters)|raw }}</h2> | |||
</div> | |||
<div class="card-body"> | |||
{# | |||
{% block new_form %} | |||
{{ form(new_form) }} | |||
{% endblock new_form %} #} | |||
{% endblock new_form %} | |||
</div> | |||
</div> | |||
</div> |
@@ -19,6 +19,8 @@ | |||
<link rel="stylesheet" href="{{ asset('bundles/easyadmin/app.css') }}"> | |||
{% endblock %} #} | |||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback"> | |||
{% block configured_stylesheets %} | |||
{% for css_asset in ea.assets.cssFiles ?? [] %} | |||
<link rel="stylesheet" href="{{ asset(css_asset) }}"> | |||
@@ -167,6 +169,9 @@ | |||
{{ htmlContent|raw }} | |||
{% endfor %} | |||
{% endblock %} | |||
{% include '@LcSov/adminlte/filemanager/file-manager-modal.html.twig' %} | |||
</body> | |||
{% endblock body %} | |||
</html> |