Browse Source

AdminLte intégration

tags/0.1
Fab 3 years ago
parent
commit
2b70503180
4 changed files with 36 additions and 19 deletions
  1. +18
    -14
      Controller/Admin/AbstractCrudController.php
  2. +15
    -2
      Resources/assets/apps/backend-common/common.js
  3. +1
    -1
      Resources/views/adminlte/crud/_form.html.twig
  4. +2
    -2
      Resources/views/adminlte/crud/index.html.twig

+ 18
- 14
Controller/Admin/AbstractCrudController.php View File

); );
} }


$actionSaveAndReturn = [
'add-class' => 'float-right',
'icon' => 'check',
];
$actionIndex = [
'icon' => 'chevron-left',
'class' => 'btn btn-link',
];

/* Boutons des actions dans les listes */ /* Boutons des actions dans les listes */
$actionsArray[Crud::PAGE_INDEX] = [ $actionsArray[Crud::PAGE_INDEX] = [
Action::EDIT => [ Action::EDIT => [
Action::SAVE_AND_CONTINUE => [ Action::SAVE_AND_CONTINUE => [
'class' => 'btn btn-info float-right', 'class' => 'btn btn-info float-right',
], ],
Action::SAVE_AND_RETURN => [
'add-class' => 'float-right',
],
Action::INDEX => [
'icon' => 'chevron-left',
'class'=> ''
Action::DELETE => [
'icon' => 'trash',
'class' => 'btn btn-link text-danger',
], ],
Action::SAVE_AND_RETURN => $actionSaveAndReturn,
Action::INDEX=>$actionIndex
]; ];
$actionsArray[Crud::PAGE_NEW] = [ $actionsArray[Crud::PAGE_NEW] = [
Action::SAVE_AND_ADD_ANOTHER => [ Action::SAVE_AND_ADD_ANOTHER => [
'class' => 'btn btn-info float-right', 'class' => 'btn btn-info float-right',
], ],
Action::SAVE_AND_RETURN => [
'add-class' => 'float-right',
],

Action::INDEX => [
'icon' => 'chevron-left',
'class'=> ''
],
Action::SAVE_AND_RETURN => $actionSaveAndReturn,
Action::INDEX=>$actionIndex
]; ];


$actions->add(Crud::PAGE_EDIT, Action::INDEX); $actions->add(Crud::PAGE_EDIT, Action::INDEX);
$actions->add(Crud::PAGE_EDIT, Action::DELETE);
$actions->add(Crud::PAGE_NEW, Action::INDEX); $actions->add(Crud::PAGE_NEW, Action::INDEX);
$actions->add(Crud::PAGE_NEW, Action::DELETE);


$actions->reorder(Crud::PAGE_EDIT, [Action::INDEX, Action::SAVE_AND_RETURN, Action::SAVE_AND_CONTINUE]); $actions->reorder(Crud::PAGE_EDIT, [Action::INDEX, Action::SAVE_AND_RETURN, Action::SAVE_AND_CONTINUE]);
$actions->reorder(Crud::PAGE_NEW, [Action::INDEX, Action::SAVE_AND_RETURN, Action::SAVE_AND_ADD_ANOTHER]); $actions->reorder(Crud::PAGE_NEW, [Action::INDEX, Action::SAVE_AND_RETURN, Action::SAVE_AND_ADD_ANOTHER]);

+ 15
- 2
Resources/assets/apps/backend-common/common.js View File


/* Tooltip */ /* Tooltip */
$('[data-toggle="tooltip"]').tooltip(); $('[data-toggle="tooltip"]').tooltip();




return myselect; return myselect;
} }
}
}


$('.action-delete').on('click', function (e) {
e.preventDefault();
const formAction = $(this).attr('formaction');

$('#modal-delete').modal({backdrop: true, keyboard: true})
.off('click', '#modal-delete-button')
.on('click', '#modal-delete-button', function () {
let deleteForm = $('#delete-form');
deleteForm.attr('action', formAction);
deleteForm.submit();
});
});

+ 1
- 1
Resources/views/adminlte/crud/_form.html.twig View File

<div class="row"> <div class="row">
<div class="col-sm-8"> <div class="col-sm-8">
<div class="btn-list"> <div class="btn-list">
{% block delete_form %}{% endblock delete_form %}
{% block page_actions %} {% block page_actions %}
{% for action in entity.actions %} {% for action in entity.actions %}


</div> </div>
{% endblock form_footer %} {% endblock form_footer %}


{% block delete_form %}{% endblock delete_form %}


{% endblock %} {% endblock %}

+ 2
- 2
Resources/views/adminlte/crud/index.html.twig View File

}); });
} }


$('.action-delete').on('click', function (e) {
/* $('.action-delete').on('click', function (e) {
e.preventDefault(); e.preventDefault();
const formAction = $(this).attr('formaction'); const formAction = $(this).attr('formaction');


deleteForm.attr('action', formAction); deleteForm.attr('action', formAction);
deleteForm.submit(); deleteForm.submit();
}); });
});
});*/


{% if filters|length > 0 %} {% if filters|length > 0 %}
const filterModal = document.querySelector('#modal-filters'); const filterModal = document.querySelector('#modal-filters');

Loading…
Cancel
Save