mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-27 04:28:44 +02:00
poc form SDK (change dependencies implementation)
This commit is contained in:
@@ -1,5 +1,43 @@
|
||||
{% extends "DI/base.html.twig" %}
|
||||
|
||||
{% set aAction = {
|
||||
reset: {
|
||||
rank: 2,
|
||||
type: 'reset',
|
||||
label: 'Reset',
|
||||
form: 'object_form'
|
||||
},
|
||||
submit: {
|
||||
rank: 3,
|
||||
type: 'submit',
|
||||
label: 'Save',
|
||||
form: 'object_form',
|
||||
primary: true
|
||||
}
|
||||
}
|
||||
%}
|
||||
|
||||
{% if id != 0 %}
|
||||
|
||||
{% set aAction = aAction|merge({
|
||||
previous: {
|
||||
rank: 0,
|
||||
type: 'link',
|
||||
disabled: id <= 1,
|
||||
href: path('object_edit', {'class': class, 'id': id - 1}),
|
||||
icon: 'fa-solid fa-arrow-left'
|
||||
},
|
||||
next: {
|
||||
rank: 1,
|
||||
type: 'link',
|
||||
href: path('object_edit', {'class': class, 'id': id + 1}),
|
||||
icon: 'fa-solid fa-arrow-right'
|
||||
}
|
||||
})
|
||||
%}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% block title %}
|
||||
Object Edition
|
||||
{% endblock %}
|
||||
@@ -14,15 +52,6 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block actions %}
|
||||
{% if id != 0 %}
|
||||
<a href="{{ path('object_edit', {'class': class, 'id': id - 1}) }}" class="btn btn-secondary btn {% if id <= 1 %} disabled {% endif %}"><i class="fa-solid fa-arrow-left"></i></a>
|
||||
<a href="{{ path('object_edit', {'class': class, 'id': id + 1}) }}" class="btn btn-secondary btn"><i class="fa-solid fa-arrow-right"></i></a>
|
||||
{% endif %}
|
||||
<button type="reset" class="btn-secondary btn" form="object_form">Reset</button>
|
||||
<button type="submit" class="btn-primary btn" form="object_form">Save</button>
|
||||
{% endblock %}
|
||||
|
||||
{% block toasts %}
|
||||
|
||||
{# database information toast #}
|
||||
@@ -44,6 +73,27 @@
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block modals %}
|
||||
|
||||
<!-- Full screen modal -->
|
||||
<div class="modal fade" id="object_modal" tabindex="-1" aria-labelledby="object_modal1" aria-hidden="true">
|
||||
<div class="modal-dialog modal-fullscreen">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-4" id="exampleModalFullscreenLabel">Create object</h1>
|
||||
<div>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal" aria-label="Close">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" data-action="save_modal_object" aria-label="Confirm">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block ready_scripts %}
|
||||
|
||||
{# Widget #}
|
||||
@@ -54,9 +104,7 @@
|
||||
|
||||
{# Form #}
|
||||
const oForm = new Form(oWidget, oDynamic);
|
||||
document.querySelectorAll('form').forEach((formEl) => {
|
||||
oForm.handleElement(formEl);
|
||||
});
|
||||
oForm.handleElement(document);
|
||||
|
||||
{# Collection #}
|
||||
const oCollection = new Collection(oForm, '{{ path('object_form', {'class': 'object_class', 'id' : 0, 'name': 'form_name'}) }}', '{{ path('object_save', {'class': 'object_class', 'id' : 0, 'name': 'form_name'}) }}');
|
||||
|
||||
Reference in New Issue
Block a user