ソースを参照

AdminLte intégration

tags/0.1
Fab 3年前
コミット
2b70503180
4個のファイルの変更36行の追加19行の削除
  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 ファイルの表示

@@ -38,6 +38,15 @@ abstract class AbstractCrudController extends EaAbstractCrudController
);
}

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

/* Boutons des actions dans les listes */
$actionsArray[Crud::PAGE_INDEX] = [
Action::EDIT => [
@@ -57,30 +66,25 @@ abstract class AbstractCrudController extends EaAbstractCrudController
Action::SAVE_AND_CONTINUE => [
'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] = [
Action::SAVE_AND_ADD_ANOTHER => [
'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::DELETE);
$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_NEW, [Action::INDEX, Action::SAVE_AND_RETURN, Action::SAVE_AND_ADD_ANOTHER]);

+ 15
- 2
Resources/assets/apps/backend-common/common.js ファイルの表示

@@ -1,4 +1,3 @@

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

@@ -55,4 +54,18 @@ function setSelect2($select) {

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 ファイルの表示

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

@@ -73,5 +72,6 @@
</div>
{% endblock form_footer %}

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

{% endblock %}

+ 2
- 2
Resources/views/adminlte/crud/index.html.twig ファイルの表示

@@ -208,7 +208,7 @@
});
}

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

@@ -219,7 +219,7 @@
deleteForm.attr('action', formAction);
deleteForm.submit();
});
});
});*/

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

読み込み中…
キャンセル
保存