瀏覽代碼

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');

Loading…
取消
儲存