Fab пре 3 година
родитељ
комит
bb9be744d6
8 измењених фајлова са 48 додато и 237 уклоњено
  1. +1
    -1
      Resources/views/admin/ticket/detail.html.twig
  2. +0
    -119
      Resources/views/adminlte/crud/edit.html.twig
  3. +43
    -2
      Resources/views/adminlte/crud/form.html.twig
  4. +1
    -0
      Resources/views/adminlte/crud/form_theme.html.twig
  5. +1
    -1
      Resources/views/adminlte/crud/index.html.twig
  6. +0
    -112
      Resources/views/adminlte/crud/new.html.twig
  7. +1
    -1
      Resources/views/adminlte/crud/sort.html.twig
  8. +1
    -1
      Resources/views/adminlte/embed/card.html.twig

+ 1
- 1
Resources/views/admin/ticket/detail.html.twig Прегледај датотеку

@@ -36,7 +36,7 @@
</div>
<div class="col-8">
{% embed '@LcSov/adminlte/embed/card.html.twig' %}
{% block css %}card-primary{% endblock %}
{% block class %}card-primary{% endblock %}
{% block header %}
<h3 class="card-title">
Liste des messages

+ 0
- 119
Resources/views/adminlte/crud/edit.html.twig Прегледај датотеку

@@ -1,119 +0,0 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% set form = edit_form %}
{% extends '@LcSov/adminlte/crud/layout_form.html.twig' %}

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

{% block content_title %}
{{ 'edit'|sov_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) }}
{% endblock %}

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

{#

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

<script type="text/javascript">
$(function () {
$('.ea-edit-form').areYouSure({'message': '{{ 'form.are_you_sure'|trans({}, 'EasyAdminBundle')|e('js') }}'});

const entityForm = document.querySelector('form.ea-edit-form');
const inputFieldsSelector = 'input,select,textarea';

// Adding visual feedback for invalid fields: any ".form-group" with invalid fields
// receives "has-error" class. The class is removed on click on the ".form-group"
// itself to support custom/complex fields.
entityForm.addEventListener('submit', function (submitEvent) {
entityForm.querySelectorAll(inputFieldsSelector).forEach(function (input) {
if (!input.validity.valid) {
const formGroup = input.closest('div.form-group');

formGroup.classList.add('has-error');

formGroup.addEventListener('click', function onFormGroupClick() {
formGroup.classList.remove('has-error');
formGroup.removeEventListener('click', onFormGroupClick);
});
}
});

const eaEvent = new CustomEvent('ea.form.submit', {
cancelable: true,
detail: {page: 'edit', form: entityForm}
});
const eaEventResult = document.dispatchEvent(eaEvent);
if (false === eaEventResult) {
submitEvent.preventDefault();
submitEvent.stopPropagation();
}
});

// forms with tabs require some special treatment for errors. The problem
// is when the field with errors is included in a tab not currently visible.
// Browser shows this error "An invalid form control with name='...' is not focusable."
// So, the user clicks on Submit button, the form is not submitted and the error
// is not displayed. This JavaScript code ensures that each tab shows a badge with
// the number of errors in it.
entityForm.addEventListener('submit', function () {
const formTabPanes = entityForm.querySelectorAll('.tab-pane');
if (0 === formTabPanes.length) {
return;
}

let firstNavTabItemWithError = null;

formTabPanes.forEach(function (tabPane) {
let tabPaneNumErrors = 0;
tabPane.querySelectorAll(inputFieldsSelector).forEach(function (input) {
if (!input.validity.valid) {
tabPaneNumErrors++;
}
});

let navTabItem = entityForm.querySelector('.nav-item a[href="#' + tabPane.id + '"]');
let existingErrorBadge = navTabItem.querySelector('span.badge.badge-danger');
if (null !== existingErrorBadge) {
navTabItem.removeChild(existingErrorBadge);
}

if (tabPaneNumErrors > 0) {
let newErrorBadge = document.createElement('span');
newErrorBadge.classList.add('badge', 'badge-danger');
newErrorBadge.title = 'form.tab.error_badge_title';
newErrorBadge.textContent = tabPaneNumErrors;

navTabItem.appendChild(newErrorBadge);

if (null === firstNavTabItemWithError) {
firstNavTabItemWithError = navTabItem;
}
}
});

if (firstNavTabItemWithError) {
firstNavTabItemWithError.click();
}
});

$('.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 () {
$('#delete-form').attr('action', formAction).trigger('submit');
});
});
});
</script>
<

{% endblock %}
#}

Resources/views/adminlte/crud/layout_form.html.twig → Resources/views/adminlte/crud/form.html.twig Прегледај датотеку

@@ -1,9 +1,38 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}

{% extends ea.templatePath('layout') %}

{% if ea.crud.currentAction == 'new' %}

{% set form = new_form %}

{% set body_id = 'ea-new-' ~ entity.name ~ '-' ~ entity.primaryKeyValue %}
{% set body_class = 'ea-new ea-new-' ~ entity.name %}
{% set content_title = 'new'|sov_trans_admin_title(ea.getEntity().getFqcn()) %}

{% elseif ea.crud.currentAction == 'edit' %}
{% set form = edit_form %}

{% set body_id = 'ea-edit-' ~ entity.name ~ '-' ~ entity.primaryKeyValue %}
{% set body_class = 'ea-edit ea-edit-' ~ entity.name %}
{% set content_title = 'edit'|sov_trans_admin_title(ea.getEntity().getFqcn(), {id: ea.getEntity().getInstance().getId()}) %}
{% endif %}



{% form_theme form with ea.crud.formThemes only %}

{% trans_default_domain ea.i18n.translationDomain %}


{% block body_id body_id %}
{% block body_class body_class %}

{% block content_title %}
{{ content_title }}
{% endblock %}

{% block configured_head_contents %}
{{ parent() }}
{% for htmlContent in form.vars.ea_crud_form.assets.headContents %}
@@ -40,6 +69,8 @@
{% endblock page_actions_wrapper %}




{% block main %}
<div class="col-8">
{% block form %}
@@ -64,5 +95,15 @@
{% endembed %}
{% endblock form_footer %}

{% block delete_form %}{% endblock delete_form %}
{% endblock %}
{% block delete_form %}
{% if ea.crud.currentAction == 'edit' %}
{{ include('@EasyAdmin/crud/includes/_delete_form.html.twig', { entity_id: entity.primaryKeyValue }, with_context = false) }}
{% endif %}
{% endblock delete_form %}
{% endblock %}







+ 1
- 0
Resources/views/adminlte/crud/form_theme.html.twig Прегледај датотеку

@@ -312,6 +312,7 @@
{% block class %}{{ loop.first ? 'active' }}{% endblock %}
{% block id %}{{ panel_name }}{% endblock %}
{% block content %}
{{ dump() }}
{% for field in form|filter(field => 'hidden' not in field.vars.block_prefixes and field.vars.ea_crud_form.form_panel == panel_name) %}
{% if not field.vars.ea_crud_form.form_tab or field.vars.ea_crud_form.form_tab == tab_name %}
{{ form_row(field) }}

+ 1
- 1
Resources/views/adminlte/crud/index.html.twig Прегледај датотеку

@@ -33,7 +33,7 @@
{% set has_datagrid_tools = has_search or has_filters %}

{% embed '@LcSov/adminlte/embed/card.html.twig' %}
{% block css %}card-table card-outline card-primary{% endblock %}
{% block class %}card-table card-outline card-primary{% endblock %}
{% block header %}
<span data-toggle="tooltip" class="badge badge-light" data-original-title="Total" title="Total">
{{ paginator.numResults }} résultats

+ 0
- 112
Resources/views/adminlte/crud/new.html.twig Прегледај датотеку

@@ -1,112 +0,0 @@
{# @var ea \EasyCorp\Bundle\EasyAdminBundle\Context\AdminContext #}
{# @var entity \EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto #}
{% set form = new_form %}
{% extends '@LcSov/adminlte/crud/layout_form.html.twig' %}

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

{% block content_title %}
{{ 'new'|sov_trans_admin_title(ea.getEntity().getFqcn()) }}
{% endblock %}

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

{# <script type="text/javascript">
$(function () {
$('.ea-new-form').areYouSure({'message': '{{ 'form.are_you_sure'|trans({}, 'EasyAdminBundle')|e('js') }}'});

const entityForm = document.querySelector('form.ea-new-form');
const inputFieldsSelector = 'input,select,textarea';

// Adding visual feedback for invalid fields: any ".form-group" with invalid fields
// receives "has-error" class. The class is removed on click on the ".form-group"
// itself to support custom/complex fields.
entityForm.addEventListener('submit', function (submitEvent) {
entityForm.querySelectorAll(inputFieldsSelector).forEach(function (input) {
if (!input.validity.valid) {
const formGroup = input.closest('div.form-group');

formGroup.classList.add('has-error');

formGroup.addEventListener('click', function onFormGroupClick() {
formGroup.classList.remove('has-error');
formGroup.removeEventListener('click', onFormGroupClick);
});
}
});

const eaEvent = new CustomEvent('ea.form.submit', {
cancelable: true,
detail: {page: 'new', form: entityForm}
});
const eaEventResult = document.dispatchEvent(eaEvent);
if (false === eaEventResult) {
submitEvent.preventDefault();
submitEvent.stopPropagation();
}
});

// forms with tabs require some special treatment for errors. The problem
// is when the field with errors is included in a tab not currently visible.
// Browser shows this error "An invalid form control with name='...' is not focusable."
// So, the user clicks on Submit button, the form is not submitted and the error
// is not displayed. This JavaScript code ensures that each tab shows a badge with
// the number of errors in it.
entityForm.addEventListener('submit', function () {
const formTabPanes = entityForm.querySelectorAll('.tab-pane');
if (0 === formTabPanes.length) {
return;
}

let firstNavTabItemWithError = null;

formTabPanes.forEach(function (tabPane) {
let tabPaneNumErrors = 0;
tabPane.querySelectorAll(inputFieldsSelector).forEach(function (input) {
if (!input.validity.valid) {
tabPaneNumErrors++;
}
});

let navTabItem = entityForm.querySelector('.nav-item a[href="#' + tabPane.id + '"]');
let existingErrorBadge = navTabItem.querySelector('span.badge.badge-danger');
if (null !== existingErrorBadge) {
navTabItem.removeChild(existingErrorBadge);
}

if (tabPaneNumErrors > 0) {
let newErrorBadge = document.createElement('span');
newErrorBadge.classList.add('badge', 'badge-danger');
newErrorBadge.title = 'form.tab.error_badge_title';
newErrorBadge.textContent = tabPaneNumErrors;

navTabItem.appendChild(newErrorBadge);

if (null === firstNavTabItemWithError) {
firstNavTabItemWithError = navTabItem;
}
}
});

if (firstNavTabItemWithError) {
firstNavTabItemWithError.click();
}
});

// prevent multiple form submissions to avoid creating duplicated entities
entityForm.addEventListener('submit', function () {
// this timeout is needed to include the disabled button into the submitted form
setTimeout(function () {
const submitButtons = entityForm.querySelectorAll('[type="submit"]');
submitButtons.forEach(function (button) {
button.setAttribute('disabled', 'disabled');
});
}, 1);
}, false);
});
</script>

{{ include('@EasyAdmin/crud/includes/_select2_widget.html.twig') }} #}
{% endblock %}

+ 1
- 1
Resources/views/adminlte/crud/sort.html.twig Прегледај датотеку

@@ -32,7 +32,7 @@
{{ form_start(sortable_form) }}

{% embed '@LcSov/adminlte/embed/card.html.twig' %}
{% block css %}card-table card-outline card-primary{% endblock %}
{% block class %}card-table card-outline card-primary{% endblock %}
{% block header %}
<span data-toggle="tooltip" class="badge badge-light" data-original-title="Total" title="Total">
{{ paginator.numResults }} résultats

+ 1
- 1
Resources/views/adminlte/embed/card.html.twig Прегледај датотеку

@@ -1,4 +1,4 @@
<div class="card {% block css %}{% endblock %}" id="{% block id %}{% endblock %}">
<div class="card {% block class %}{% endblock %}" id="{% block id %}{% endblock %}">
{% block header_wrapper %}
<div class="card-header {% block header_class %}{% endblock %}">
{% block header %}

Loading…
Откажи
Сачувај