Guillaume преди 3 години
родител
ревизия
ab504e3219
променени са 8 файла, в които са добавени 235 реда и са изтрити 148 реда
  1. +66
    -15
      Controller/Admin/AbstractCrudController.php
  2. +1
    -2
      Resources/assets/apps/backend-common/app.common.js
  3. +15
    -13
      Resources/assets/apps/backend-common/common.scss
  4. +64
    -0
      Resources/assets/apps/backend-common/scss/_formfooter.scss
  5. +77
    -0
      Resources/views/adminlte/crud/_form.html.twig
  6. +7
    -61
      Resources/views/adminlte/crud/edit.html.twig
  7. +4
    -57
      Resources/views/adminlte/crud/new.html.twig
  8. +1
    -0
      Resources/views/adminlte/layout.html.twig

+ 66
- 15
Controller/Admin/AbstractCrudController.php Целия файл

@@ -32,33 +32,84 @@ abstract class AbstractCrudController extends EaAbstractCrudController
Action::EDIT,
function (Action $action) {
$action->setTemplatePath('@LcSov/adminlte/crud/action/translatable.html.twig');

return $action;
}
);
}

/* Boutons des actions dans les listes */
$listButtonsStyleArray = [
$actionsArray[Crud::PAGE_INDEX] = [
Action::EDIT => [
'class' => 'btn btn-sm btn-primary',
'icon' => 'edit'
'icon' => 'edit',
'label' => false,
],
Action::DELETE => [
'class' => 'btn btn-sm btn-default',
'icon' => 'trash'
]
'icon' => 'trash',
'label' => false,
],
];

foreach($listButtonsStyleArray as $actionName => $button) {
$actions->update(
Crud::PAGE_INDEX,
$actionName,
function (Action $action) use ($button) {
$action->setCssClass($button['class']);
$action->setIcon('fa fa-'.$button['icon'])->setLabel(false);
return $action;
}
);
/* Boutons des actions dans l'édition */
$actionsArray[Crud::PAGE_EDIT] = [
Action::SAVE_AND_CONTINUE => [
'class' => 'btn btn-info float-right',
],
Action::SAVE_AND_RETURN => [
'add-class' => 'float-right',
],
Action::INDEX => [
'icon' => 'chevron-left',
'class'=> ''
],
];
$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'=> ''
],
];

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

$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]);


foreach ($actionsArray as $crudActionName => $actionsStyle) {
foreach ($actionsStyle as $actionName => $button) {
$actions->update(
$crudActionName,
$actionName,
function (Action $action) use ($button) {
if (isset($button['add-class'])) {
$action->addCssClass($button['add-class']);
}
if (isset($button['class'])) {
$action->setCssClass($button['class']);
}
if (isset($button['icon'])) {
$action->setIcon('fa fa-'.$button['icon']);
}
if (isset($button['label'])) {
$action->setLabel($button['label']);
}


return $action;
}
);
}
}

return $actions;
@@ -77,7 +128,7 @@ abstract class AbstractCrudController extends EaAbstractCrudController
{
$entityClass = $this->getEntityFqcn();
$paramListMaxResults = 'listMaxResults';
$paramSessionListMaxResults = $entityClass . '-' . $paramListMaxResults;
$paramSessionListMaxResults = $entityClass.'-'.$paramListMaxResults;
$requestListMaxResults = $this->request->getCurrentRequest()->get($paramListMaxResults);

if ($requestListMaxResults) {

+ 1
- 2
Resources/assets/apps/backend-common/app.common.js Целия файл

@@ -7,8 +7,7 @@ global.$ = global.jQuery = $;

//ADMINLTE
import 'adminlte-js' ;
import "adminlte-css";
import "fontawesome-css";


//BOOTSTRAP
import 'adminlte-plugin/bootstrap/js/bootstrap.min.js';

+ 15
- 13
Resources/assets/apps/backend-common/common.scss Целия файл

@@ -1,34 +1,36 @@

@import 'scss/_formchecboxradio.scss';

@import "adminlte-css";
@import "fontawesome-css";
@import "scss/_formfooter.scss";

/* card */
.card {
&.card-table {
.card-header {
border-bottom: 0px none ;
font-size: 1.1rem ;
border-bottom: 0px none;
font-size: 1.1rem;
}

.card-body {
padding: 0px ;
padding: 0px;

table.table {
margin-bottom: 0px ;
margin-bottom: 0px;

tr {
th {
input.form-check-input {
position: relative ;
top: 0px ;
position: relative;
top: 0px;
}
}

td {
padding: 3px 12px ;
padding: 3px 12px;

input.form-batch-checkbox {
position: relative ;
top: 4px ;
position: relative;
top: 4px;
}
}
}
@@ -36,8 +38,8 @@
}

.card-footer {
background-color: white ;
padding-top: 25px ;
background-color: white;
padding-top: 25px;

.nb-results {
margin-bottom: 10px;

+ 64
- 0
Resources/assets/apps/backend-common/scss/_formfooter.scss Целия файл

@@ -0,0 +1,64 @@

section.content{position: relative;}

body.sidebar-collapse:not(.sidebar-mini-xs):not(.sidebar-mini-md):not(.sidebar-mini) {
.form-footer {
&,
&::before {
margin-left: 0;
}
}
}


body:not(.sidebar-mini-md):not(.sidebar-mini-xs):not(.layout-top-nav), .sidebar-mini-md, .sidebar-mini-xs {
.form-footer {
@include media-breakpoint-up(md) {
@include transition(margin-left $transition-speed $transition-fn);

margin-left: $sidebar-width;

.sidebar-collapse & {
margin-left: $sidebar-mini-width;
}
}
@include media-breakpoint-down(md) {
margin-left: $sidebar-mini-width;
}
@include media-breakpoint-down(sm) {
margin-left: 0;
}
}
}

// Sidebar Mini Breakpoints
.sidebar-mini, .sidebar-mini-md, .sidebar-mini-xs{
// When the sidebar is collapsed...
&.sidebar-collapse {
// Apply the new margins to the main content and footer
.form-footer
{
margin-left: $sidebar-mini-width !important;
}
}
}


.form-footer {
position: fixed;
left: 0;
right: 0;
height: 60px;
bottom: 0px;
z-index: 10;
background-color: #fff;
border-top: 1px solid #dee2e6;
color: #869099;
padding: 1rem;

.btn-list{
.float-right, .float-sm-right{
margin-left: 10px;
}
}
}

+ 77
- 0
Resources/views/adminlte/crud/_form.html.twig Целия файл

@@ -0,0 +1,77 @@
{% extends ea.templatePath('layout') %}
{% form_theme form with ea.crud.formThemes only %}

{% trans_default_domain ea.i18n.translationDomain %}


{% block configured_head_contents %}
{{ parent() }}
{% for htmlContent in form.vars.ea_crud_form.assets.headContents %}
{{ htmlContent|raw }}
{% endfor %}
{% endblock %}

{% block configured_stylesheets %}
{{ parent() }}
{% for css_asset in form.vars.ea_crud_form.assets.cssFiles %}
<link rel="stylesheet" href="{{ asset(css_asset) }}">
{% endfor %}

{% for webpack_encore_entry in form.vars.ea_crud_form.assets.webpackEncoreEntries %}
{{ ea_call_function_if_exists('encore_entry_link_tags', webpack_encore_entry) }}
{% endfor %}
{% endblock %}


{% block configured_javascripts %}
{{ parent() }}
{% for js_asset in form.vars.ea_crud_form.assets.jsFiles %}
<script src="{{ asset(js_asset) }}"></script>
{% endfor %}

{% for webpack_encore_entry in form.vars.ea_crud_form.assets.webpackEncoreEntries %}
{{ ea_call_function_if_exists('encore_entry_script_tags', webpack_encore_entry) }}
{% endfor %}
{% endblock %}

{% block page_actions_wrapper %}
{% endblock page_actions_wrapper %}

{% block main %}

<div class="col-8">
<div class="card">
<div class="card-status-top bg-primary"></div>
<div class="card-header ">
{% set default_title = ea.crud.defaultPageTitle('new')|trans(ea.i18n.translationParameters, 'EasyAdminBundle') %}

<h2 class="card-title">{{ ea.crud.customPageTitle is null ? default_title|raw : ea.crud.customPageTitle('new')|trans(ea.i18n.translationParameters)|raw }}</h2>
</div>
<div class="card-body">
{% block form %}
{{ form(form) }}
{% endblock form %}
</div>
</div>
</div>

{% block form_footer %}
<div class="form-footer">
<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 %}

{{ include(action.templatePath, { action: action }, with_context = false) }}&nbsp;
{% endfor %}
{% endblock %}
</div>
</div>
</div>
</div>
{% endblock form_footer %}


{% endblock %}

+ 7
- 61
Resources/views/adminlte/crud/edit.html.twig Целия файл

@@ -1,49 +1,11 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% extends ea.templatePath('layout') %}
{% form_theme edit_form with ea.crud.formThemes only %}

{% trans_default_domain ea.i18n.translationDomain %}
{% set form = edit_form %}
{% extends '@LcSov/adminlte/crud/_form.html.twig' %}

{% block body_id 'ea-edit-' ~ entity.name ~ '-' ~ entity.primaryKeyValue %}
{% block body_class 'ea-edit ea-edit-' ~ entity.name %}

{% block configured_head_contents %}
{{ parent() }}
{% for htmlContent in edit_form.vars.ea_crud_form.assets.headContents %}
{{ htmlContent|raw }}
{% endfor %}
{% endblock %}

{% block configured_body_contents %}
{{ parent() }}
{% for htmlContent in edit_form.vars.ea_crud_form.assets.bodyContents %}
{{ htmlContent|raw }}
{% endfor %}
{% endblock %}

{% block configured_stylesheets %}
{{ parent() }}
{% for css_asset in edit_form.vars.ea_crud_form.assets.cssFiles %}
<link rel="stylesheet" href="{{ asset(css_asset) }}">
{% endfor %}

{% for webpack_encore_entry in edit_form.vars.ea_crud_form.assets.webpackEncoreEntries %}
{{ ea_call_function_if_exists('encore_entry_link_tags', webpack_encore_entry) }}
{% endfor %}
{% endblock %}

{% block configured_javascripts %}
{{ parent() }}
{% for js_asset in edit_form.vars.ea_crud_form.assets.jsFiles %}
<script src="{{ asset(js_asset) }}"></script>
{% endfor %}

{% for webpack_encore_entry in edit_form.vars.ea_crud_form.assets.webpackEncoreEntries %}
{{ ea_call_function_if_exists('encore_entry_script_tags', webpack_encore_entry) }}
{% endfor %}
{% endblock %}

{% block content_title %}
{%- apply spaceless -%}
{{ ea.crud.customPageTitle is null
@@ -52,28 +14,11 @@
{%- endapply -%}
{% endblock %}

{% block page_actions %}
{% for action in entity.actions %}
{{ include(action.templatePath, { action: action }, with_context = false) }}
{% endfor %}
{% endblock %}
{% block delete_form %}
{{ include('@EasyAdmin/crud/includes/_delete_form.html.twig', { entity_id: entity.primaryKeyValue }, with_context = false) }}
{% endblock delete_form %}

{% block main %}
<div class="col-8">

<div class="card">
<div class="card-body">
{% block edit_form %}
{{ form(edit_form) }}
{% endblock edit_form %}

{% block delete_form %}
{{ include('@EasyAdmin/crud/includes/_delete_form.html.twig', { entity_id: entity.primaryKeyValue }, with_context = false) }}
{% endblock delete_form %}
</div>
</div>
</div>
{% endblock %}
{#

{% block body_javascript %}
{{ parent() }}
@@ -175,3 +120,4 @@
<

{% endblock %}
#}

+ 4
- 57
Resources/views/adminlte/crud/new.html.twig Целия файл

@@ -1,72 +1,19 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% extends ea.templatePath('layout') %}
{% form_theme new_form with ea.crud.formThemes only %}

{% trans_default_domain ea.i18n.translationDomain %}
{% set form = new_form %}
{% extends '@LcSov/adminlte/crud/_form.html.twig' %}

{% block body_id 'ea-new-' ~ entity.name ~ '-' ~ entity.primaryKeyValue %}
{% block body_class 'ea-new ea-new-' ~ entity.name %}

{% block configured_head_contents %}
{{ parent() }}
{% for htmlContent in new_form.vars.ea_crud_form.assets.headContents %}
{{ htmlContent|raw }}
{% endfor %}
{% endblock %}

{% block configured_stylesheets %}
{{ parent() }}
{% for css_asset in new_form.vars.ea_crud_form.assets.cssFiles %}
<link rel="stylesheet" href="{{ asset(css_asset) }}">
{% endfor %}

{% for webpack_encore_entry in new_form.vars.ea_crud_form.assets.webpackEncoreEntries %}
{{ ea_call_function_if_exists('encore_entry_link_tags', webpack_encore_entry) }}
{% endfor %}
{% endblock %}

{% block configured_javascripts %}
{{ parent() }}
{% for js_asset in new_form.vars.ea_crud_form.assets.jsFiles %}
<script src="{{ asset(js_asset) }}"></script>
{% endfor %}

{% for webpack_encore_entry in new_form.vars.ea_crud_form.assets.webpackEncoreEntries %}
{{ ea_call_function_if_exists('encore_entry_script_tags', webpack_encore_entry) }}
{% endfor %}
{% endblock %}

{% block content_title %}
{# {%- apply spaceless -%}
{%- apply spaceless -%}
{% set default_title = ea.crud.defaultPageTitle('new')|trans(ea.i18n.translationParameters, 'EasyAdminBundle') %}
{{ ea.crud.customPageTitle is null ? default_title|raw : ea.crud.customPageTitle('new')|trans(ea.i18n.translationParameters)|raw }}
{%- endapply -%} #}
{%- endapply -%}
{% endblock %}

{% block content_header_wrapper %}
{# {% for action in entity.actions %}
{{ include(action.templatePath, { action: action }, with_context = false) }}
{% endfor %} #}
{% endblock %}

{% block main %}
<div class="col-8">
<div class="card">
<div class="card-status-top bg-primary"></div>
<div class="card-header ">
{% set default_title = ea.crud.defaultPageTitle('new')|trans(ea.i18n.translationParameters, 'EasyAdminBundle') %}

<h2 class="card-title">{{ ea.crud.customPageTitle is null ? default_title|raw : ea.crud.customPageTitle('new')|trans(ea.i18n.translationParameters)|raw }}</h2>
</div>
<div class="card-body">
{% block new_form %}
{{ form(new_form) }}
{% endblock new_form %}
</div>
</div>
</div>
{% endblock %}

{% block body_javascript %}
{{ parent() }}

+ 1
- 0
Resources/views/adminlte/layout.html.twig Целия файл

@@ -140,6 +140,7 @@
<div class="container">
<div class="row text-center align-items-center flex-row-reverse">
{{ content_footer }}

</div>
</div>
</footer>

Loading…
Отказ
Запис