backports murph-skeleton
This commit is contained in:
parent
68cf917168
commit
825a31f671
|
@ -86,6 +86,7 @@ class <?= $class_name; ?> extends CrudController
|
|||
->setPageRoute('new', 'admin_<?= $route; ?>_new')
|
||||
->setPageRoute('edit', 'admin_<?= $route; ?>_edit')
|
||||
->setPageRoute('show', 'admin_<?= $route; ?>_show')
|
||||
->setPageRoute('sort', 'admin_<?= $route; ?>_sort')
|
||||
->setPageRoute('delete', 'admin_<?= $route; ?>_delete')
|
||||
->setPageRoute('filter', 'admin_<?= $route; ?>_filter')
|
||||
|
||||
|
@ -95,6 +96,9 @@ class <?= $class_name; ?> extends CrudController
|
|||
|
||||
// ->setMaxPerPage('index', 20)
|
||||
|
||||
// ->setIsSortableCollection('index', false)
|
||||
// ->setSortableCollectionProperty('sortOrder')
|
||||
|
||||
// ->setAction('index', 'new', true)
|
||||
// ->setAction('index', 'show', true)
|
||||
// ->setAction('index', 'edit', true)
|
||||
|
|
|
@ -157,4 +157,4 @@
|
|||
"Tasks": "Tâches"
|
||||
"Results": "Résultats"
|
||||
"Clean all cache": "Nettoyer tout le cache"
|
||||
"You can sort items by drag & drop": "Vous pouvez trier les élements via un glisser/déposer"
|
||||
"You can sort items with drag & drop": "Vous pouvez trier les élements via un glisser/déposer"
|
||||
|
|
|
@ -1,45 +1,47 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ configuration.pageTitle('edit')|trans|build_string(entity) }} - {{ parent() }}{% endblock %}
|
||||
{% set context = context ?? 'edit' %}
|
||||
|
||||
{% block title %}{{ configuration.pageTitle(context)|trans|build_string(entity) }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block header %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
|
||||
<div class="crud-header">
|
||||
{% block header_title %}
|
||||
<h1 class="crud-header-title">{{ configuration.pageTitle('edit')|trans|build_string(entity) }}</h1>
|
||||
<h1 class="crud-header-title">{{ configuration.pageTitle(context)|trans|build_string(entity) }}</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block header_actions %}
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
{% if configuration.action('edit', 'back', true) %}
|
||||
{% if configuration.action(context, 'back', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('index')) }}" class="btn btn-light">
|
||||
<span class="fa fa-list pr-1"></span>
|
||||
{{ configuration.actionTitle('edit', 'back', 'Back to the list')|trans }}
|
||||
{{ configuration.actionTitle(context, 'back', 'Back to the list')|trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if configuration.action('edit', 'show', true) %}
|
||||
{% if configuration.action(context, 'show', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('show'), {entity: entity.id}) }}" class="btn btn-secondary">
|
||||
<span class="fa fa-eye pr-1"></span>
|
||||
{{ configuration.actionTitle('edit', 'show', 'Show')|trans|build_string(entity) }}
|
||||
{{ configuration.actionTitle(context, 'show', 'Show')|trans|build_string(entity) }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<button type="submit" form="form-main" class="btn btn-primary">
|
||||
<span class="fa fa-save pr-1"></span>
|
||||
{{ configuration.actionTitle('edit', 'save', 'Save')|trans|build_string(entity) }}
|
||||
{{ configuration.actionTitle(context, 'save', 'Save')|trans|build_string(entity) }}
|
||||
</button>
|
||||
|
||||
{% if header_actions_dropdown_menu is not defined %}
|
||||
{% set header_actions_dropdown_menu = '' %}
|
||||
{% endif %}
|
||||
|
||||
{% if configuration.action('edit', 'delete', true) %}
|
||||
{% if configuration.action(context, 'delete', true) %}
|
||||
{% set item %}
|
||||
<button type="submit" form="form-delete" class="dropdown-item">
|
||||
{{ configuration.actionTitle('edit', 'delete', 'Delete')|trans|build_string(entity) }}
|
||||
{{ configuration.actionTitle(context, 'delete', 'Delete')|trans|build_string(entity) }}
|
||||
</button>
|
||||
{% endset %}
|
||||
|
||||
|
@ -82,7 +84,7 @@
|
|||
</form>
|
||||
{% endblock %}
|
||||
|
||||
{% if configuration.action('edit', 'delete', true) %}
|
||||
{% if configuration.action(context, 'delete', true) %}
|
||||
<form method="post" action="{{ path(configuration.pageRoute('delete'), {entity: entity.id}) }}" id="form-delete" data-form-confirm>
|
||||
<input type="hidden" name="_method" value="DELETE">
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('delete' ~ entity.id) }}">
|
||||
|
|
|
@ -1,22 +1,36 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ configuration.pageTitle('index')|trans }} - {{ parent() }}{% endblock %}
|
||||
{% set context = context ?? 'index' %}
|
||||
|
||||
{% block title %}{{ configuration.pageTitle(context)|trans }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block header %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5 {% if pager.paginationData.pageCount < 2 %}{% if filters.show %}pb-3{% else %}pb-5{% endif %}{% endif %}">
|
||||
{%- set pb -%}
|
||||
{% if pager.paginationData.pageCount < 2 %}
|
||||
{% if filters.show %}
|
||||
pb-3
|
||||
{% else %}
|
||||
pb-5
|
||||
{% endif %}
|
||||
{% else %}
|
||||
pb-3
|
||||
{% endif %}
|
||||
{%- endset -%}
|
||||
|
||||
<div class="bg-light pl-5 pr-4 pt-5 {{ pb }}">
|
||||
<div class="crud-header">
|
||||
{% block header_title %}
|
||||
<h1 class="crud-header-title">{{ configuration.pageTitle('index')|trans }}</h1>
|
||||
<h1 class="crud-header-title">{{ configuration.pageTitle(context)|trans }}</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block header_actions %}
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
{% if configuration.action('index', 'new', true) %}
|
||||
{% if configuration.action(context, 'new', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('new')) }}" class="btn btn-primary">
|
||||
<span class="fa fa-plus pr-1"></span>
|
||||
{{ configuration.actionTitle('index', 'new', 'New')|trans }}
|
||||
{{ configuration.actionTitle(context, 'new', 'New')|trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
|
@ -62,14 +76,15 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block list %}
|
||||
{% set isSortable = configuration.isSortableCollection('index') %}
|
||||
{% set isSortable = configuration.isSortableCollection(context) %}
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
{% block list_header %}
|
||||
<thead class="thead-light">
|
||||
<tr>
|
||||
{% for label, config in configuration.fields('index') %}
|
||||
{% for label, config in configuration.fields(context) %}
|
||||
{% block list_header_item %}
|
||||
{% set attr = config.options.attr is defined ? config.options.attr : [] %}
|
||||
{% set isSortable = config.options.sort ?? false %}
|
||||
|
||||
|
@ -85,12 +100,12 @@
|
|||
{% set icon = 'fa fa-sort-amount-up-alt' %}
|
||||
{% endif %}
|
||||
|
||||
{% set url = path(configuration.getPageRoute('index'), {
|
||||
{% set url = path(configuration.getPageRoute(context), {
|
||||
_sort: config.options.sort[0],
|
||||
_sort_direction: newDirection,
|
||||
}) %}
|
||||
{% else %}
|
||||
{% set url = path(configuration.getPageRoute('index'), {
|
||||
{% set url = path(configuration.getPageRoute(context), {
|
||||
_sort: config.options.sort[0],
|
||||
_sort_direction: 'asc',
|
||||
}) %}
|
||||
|
@ -112,6 +127,7 @@
|
|||
{{ label|trans }}
|
||||
{% endif %}
|
||||
</th>
|
||||
{% endblock %}
|
||||
{% endfor %}
|
||||
<th class="col-2 miw-100 text-right">
|
||||
{{ 'Actions'|trans }}
|
||||
|
@ -128,7 +144,7 @@
|
|||
{
|
||||
_token: csrf_token('sort'),
|
||||
page: pager.currentPageNumber,
|
||||
context: 'index',
|
||||
context: context,
|
||||
}
|
||||
) ~ '"' %}
|
||||
{% else %}
|
||||
|
@ -146,15 +162,15 @@
|
|||
|
||||
{% block list_item %}
|
||||
{%- set dbClick %}
|
||||
{% if configuration.action('index', 'show', true) %}
|
||||
{% if configuration.action(context, 'show', true) %}
|
||||
{{ path(configuration.pageRoute('show'), {entity: item.id}) }}
|
||||
{% elseif configuration.action('index', 'edit', true) %}
|
||||
{% elseif configuration.action(context, 'edit', true) %}
|
||||
{{ path(configuration.pageRoute('edit'), {entity: item.id}) }}
|
||||
{% endif %}
|
||||
{% endset -%}
|
||||
|
||||
<tr {{ dataSortableItem|raw }} data-dblclick="{{ dbClick }}" class="{{ loop.index is odd ? 'is-odd' : 'is-even' }}">
|
||||
{% for config in configuration.fields('index') %}
|
||||
{% for config in configuration.fields(context) %}
|
||||
{% set attr = config.options.attr is defined ? config.options.attr : [] %}
|
||||
{% set action = config.options.action is defined ? config.options.action : null %}
|
||||
|
||||
|
@ -176,19 +192,19 @@
|
|||
<td class="col-2 miw-200 text-right">
|
||||
{% block list_item_actions_before %}{% endblock %}
|
||||
|
||||
{% if configuration.action('index', 'show', true) %}
|
||||
{% if configuration.action(context, 'show', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('show'), {entity: item.id}) }}" class="btn btn-sm btn-secondary mr-1">
|
||||
<span class="fa fa-eye"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if configuration.action('index', 'edit', true) %}
|
||||
{% if configuration.action(context, 'edit', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('edit'), {entity: item.id}) }}" class="btn btn-sm btn-primary mr-1">
|
||||
<span class="fa fa-edit"></span>
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if configuration.action('index', 'delete', true) %}
|
||||
{% if configuration.action(context, 'delete', true) %}
|
||||
<button type="submit" form="form-delete-{{ item.id }}" class="btn btn-sm btn-danger">
|
||||
<span class="fa fa-trash"></span>
|
||||
</button>
|
||||
|
@ -206,15 +222,15 @@
|
|||
|
||||
{% if loop.last and isSortable %}
|
||||
<tr>
|
||||
<td class="col-12 text-black-50 border-0" colspan="{{ configuration.fields('index')|length + 1 }}">
|
||||
<td class="col-12 text-black-50 border-0" colspan="{{ configuration.fields(context)|length + 1 }}">
|
||||
<span class="fa fa-hand-pointer"></span>
|
||||
{{ 'You can sort items by drag & drop'|trans }}
|
||||
{{ 'You can sort items with drag & drop'|trans }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<tr>
|
||||
<td class="col-12 text-center p-4 text-black-50" colspan="{{ configuration.fields('index')|length + 1 }}">
|
||||
<td class="col-12 text-center p-4 text-black-50" colspan="{{ configuration.fields(context)|length + 1 }}">
|
||||
<div class="display-1">
|
||||
<span class="fa fa-search"></span>
|
||||
</div>
|
||||
|
|
|
@ -1,28 +1,30 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ configuration.pageTitle('new')|trans|build_string(entity) }} - {{ parent() }}{% endblock %}
|
||||
{% set context = context ?? 'new' %}
|
||||
|
||||
{% block title %}{{ configuration.pageTitle(context)|trans|build_string(entity) }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block header %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
|
||||
<div class="crud-header">
|
||||
{% block header_title %}
|
||||
<h1 class="crud-header-title">{{ configuration.pageTitle('new')|trans|build_string(entity) }}</h1>
|
||||
<h1 class="crud-header-title">{{ configuration.pageTitle(context)|trans|build_string(entity) }}</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block header_actions %}
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
{% if configuration.action('new', 'back', true) %}
|
||||
{% if configuration.action(context, 'back', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('index')) }}" class="btn btn-light">
|
||||
<span class="fa fa-list pr-1"></span>
|
||||
{{ configuration.actionTitle('new', 'back', 'Back to the list')|trans }}
|
||||
{{ configuration.actionTitle(context, 'back', 'Back to the list')|trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
<button type="submit" form="form-main" class="btn btn-primary">
|
||||
<span class="fa fa-save pr-1"></span>
|
||||
{{ configuration.actionTitle('new', 'save', 'Save')|trans|build_string(entity) }}
|
||||
{{ configuration.actionTitle(context, 'save', 'Save')|trans|build_string(entity) }}
|
||||
</button>
|
||||
|
||||
{% if header_actions_dropdown_menu is not defined %}
|
||||
|
|
|
@ -1,30 +1,32 @@
|
|||
{% extends '@Core/admin/layout.html.twig' %}
|
||||
|
||||
{% block title %}{{ configuration.pageTitle('show')|trans|build_string(entity) }} - {{ parent() }}{% endblock %}
|
||||
{% set context = context ?? 'show' %}
|
||||
|
||||
{% block title %}{{ configuration.pageTitle(context)|trans|build_string(entity) }} - {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
{% block header %}
|
||||
<div class="bg-light pl-5 pr-4 pt-5 pb-5">
|
||||
<div class="crud-header">
|
||||
{% block header_title %}
|
||||
<h1 class="crud-header-title">{{ configuration.pageTitle('show')|trans|build_string(entity) }}</h1>
|
||||
<h1 class="crud-header-title">{{ configuration.pageTitle(context)|trans|build_string(entity) }}</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block header_actions %}
|
||||
<div class="crud-header-actions">
|
||||
<div class="btn-group">
|
||||
{% if configuration.action('show', 'back', true) %}
|
||||
{% if configuration.action(context, 'back', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('index')) }}" class="btn btn-light">
|
||||
<span class="fa fa-list pr-1"></span>
|
||||
{{ configuration.actionTitle('show', 'back', 'Back to the list')|trans }}
|
||||
{{ configuration.actionTitle(context, 'back', 'Back to the list')|trans }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if configuration.action('show', 'edit', true) %}
|
||||
{% if configuration.action(context, 'edit', true) %}
|
||||
<a href="{{ path(configuration.pageRoute('edit'), {entity: entity.id}) }}" class="btn btn-primary">
|
||||
<span class="fa fa-edit pr-1"></span>
|
||||
|
||||
{{ configuration.actionTitle('show', 'edit', 'Edit')|trans|build_string(entity) }}
|
||||
{{ configuration.actionTitle(context, 'edit', 'Edit')|trans|build_string(entity) }}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
|
|
Loading…
Reference in a new issue