Commit 1cee3a43 authored by Sebastian Castro's avatar Sebastian Castro
Browse files

Adds icon picker in form builder

parent afc0dabc
......@@ -95,6 +95,10 @@
i.material-icons {
top: 4px;
&.openhours-icons { line-height: 3.2rem; }
&.fa, &.fab, &.fas {
font-size: 1.8rem;
left: 3px;
}
}
.invalid-required + label.gogo-form-label {
......
......@@ -4,6 +4,8 @@
<script src="{{ asset('assets/js/form-builder.min.js') }}" type="text/javascript"></script>
{% include '@BiopenAdmin/core_custom/custom-fields/icon-picker.html.twig' with { 'preventInput': true } %}
{% set formData = form.vars.sonata_admin.admin.subject.elementFormFieldsJson|default('[]') %}
<script>
if (!formBuilderInitialized) {
......@@ -122,6 +124,12 @@
$('a[type=edit].icon-pencil').attr('title', 'Editer/Masquer');
$('.email-field input[name=name]').val('email');
$('.iconpicker-popover button').click(function(e) {
e.stopPropagation();
e.stopImmediatePropagation();
e.preventDefault();
})
}, 300);
$('input[name="access"]').change(function() {
......@@ -178,4 +186,11 @@
.mandatory { color: #693232; font-style: italic; float: right; }
#form-builder-container { padding-top: 20px; }
.checkbox-field input[type="checkbox"] { float: left; margin-right: 10px; }
.iconpicker .iconpicker-item {
width: 36px;
height: 36px;
}
.iconpicker-popover.popover.right { right: -200px; left: initial !important;}
</style>
\ No newline at end of file
{% if preventInput is defined %}
{% else %}
<div class="input-group">
<input data-placement="bottomRight" class="form-control gogo-icon-picker icp icp-auto" value="{{ form.vars.value }}"
type="text" id="{{ form.vars.id }}" name="{{ form.vars.full_name }}" />
<span class="input-group-addon"></span>
</div>
{% endif %}
<link rel="stylesheet" href="{{ asset('assets/fonts/fontawesome-5/css/all.css') }}" />
<script src="{{ asset('assets/js/fontawesome-iconpicker.min.js') }}"></script>
......@@ -45,6 +48,11 @@
}
};
$('.icp-auto').iconpicker(options);
// In the form buidler, icon field are added dyanmically, so we need to initialize them every 500ms
setInterval(function() {
$('.fld-icon').iconpicker(options);
}, 500);
}
});
</script>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment