mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
poc form SDK (css)
This commit is contained in:
@@ -3,7 +3,27 @@ body{
|
||||
padding-top: 64px;
|
||||
}
|
||||
|
||||
.combodo-row{
|
||||
/* app icon dark */
|
||||
body[data-bs-theme="dark"] .app_icon{
|
||||
filter: invert(1);
|
||||
}
|
||||
|
||||
/* navbar actions */
|
||||
.navbar-actions button,a{
|
||||
margin: 0 3px;
|
||||
}
|
||||
|
||||
/* dropdown */
|
||||
.dropdown_scroll_300{
|
||||
max-height: 300px;
|
||||
overflow-y: auto;
|
||||
overflow-x: clip;
|
||||
}
|
||||
|
||||
/* LAYOUT */
|
||||
|
||||
/* row */
|
||||
[data-block="row_container"] > div{
|
||||
display: flex;
|
||||
}
|
||||
.combodo-row fieldset{
|
||||
|
||||
@@ -73,7 +73,7 @@ const Form = function(oWidget, oDynamic){
|
||||
const oDependsOnElement = oElement.querySelector(String.format(aSelectors.dataAttCode, sAttCode));
|
||||
|
||||
// retrieve field container
|
||||
const oContainer = oDependsOnElement.closest(aSelectors.dataBlockContainer);
|
||||
const oContainer = oDependsOnElement.closest(aSelectors.dataAttributeContainer);
|
||||
|
||||
// set field container loading state
|
||||
oContainer.classList.add('loading');
|
||||
@@ -129,13 +129,13 @@ const Form = function(oWidget, oDynamic){
|
||||
|
||||
// dependent element
|
||||
const oDependentElement = oElement.querySelector(String.format(aSelectors.dataAttCode, sAtt));
|
||||
const oContainer = oDependentElement.closest(aSelectors.dataBlockContainer);
|
||||
const oContainer = oDependentElement.closest(aSelectors.dataAttributeContainer);
|
||||
const sId = oDependentElement.getAttribute('id');
|
||||
const sName = oDependentElement.getAttribute('name');
|
||||
|
||||
// new element
|
||||
const oNewElement = oPartial.querySelector(String.format(aSelectors.dataAttCode, sAtt));
|
||||
const oNewContainer = oNewElement.closest(aSelectors.dataBlockContainer);
|
||||
const oNewContainer = oNewElement.closest(aSelectors.dataAttributeContainer);
|
||||
oNewElement.setAttribute('id', sId);
|
||||
oNewElement.setAttribute('name', sName);
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Component\Stopwatch\Stopwatch;
|
||||
|
||||
/**
|
||||
* Object controller.
|
||||
@@ -77,7 +78,7 @@ class ObjectController extends AbstractController
|
||||
*
|
||||
* @Route("/{class<\w+>}/{id<\d+>}/edit", name="object_edit")
|
||||
*/
|
||||
public function objectEdit(Request $request, string $class, int $id, ObjectService $oObjectService) : Response
|
||||
public function objectEdit(Request $request, string $class, int $id, ObjectService $oObjectService, Stopwatch $oStopWatch) : Response
|
||||
{
|
||||
// retrieve object
|
||||
try{
|
||||
@@ -88,9 +89,11 @@ class ObjectController extends AbstractController
|
||||
}
|
||||
|
||||
// create object form
|
||||
$oStopWatch->start('creating form');
|
||||
$oForm = $this->createForm(ObjectType::class, $oObject, [
|
||||
'object_class' => $class
|
||||
]);
|
||||
$oStopWatch->stop('creating form');
|
||||
|
||||
// handle HTTP request
|
||||
$oForm->handleRequest($request);
|
||||
|
||||
@@ -66,8 +66,6 @@ class ObjectService
|
||||
*/
|
||||
public function ToChoices(DBObjectSet $oObjectsSet) : array
|
||||
{
|
||||
$this->oStopWatch->start('ToChoices');
|
||||
|
||||
$aChoices = [];
|
||||
|
||||
// Retrieve friendly name complementary specification
|
||||
@@ -87,8 +85,6 @@ class ObjectService
|
||||
$i++;
|
||||
}
|
||||
|
||||
$this->oStopWatch->stop('ToChoices');
|
||||
|
||||
return $aChoices;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
|
||||
{# actions #}
|
||||
{% if aPageAction is defined %}
|
||||
<form class="actions d-flex">
|
||||
<form class="navbar-actions d-flex">
|
||||
{% for button in aPageAction|sort((a, b) => a.rank <=> b.rank ) %}
|
||||
{% if button.type == 'link' %}
|
||||
<a href="{{ button.href }}" class="btn {% if button.primary is defined and button.primary %}btn-primary{% else %}btn-secondary{% endif %} btn {% if button.disabled is defined and button.disabled == true %} disabled {% endif %}"><i class="{{ button.icon }}"></i>{% if button.label is defined %} {{ button.label }}{% endif %}</a>
|
||||
|
||||
Reference in New Issue
Block a user