update crud templates
This commit is contained in:
parent
6138bed966
commit
4764aefb39
|
@ -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,14 @@
|
|||
{% 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) %}
|
||||
{% set attr = config.options.attr is defined ? config.options.attr : [] %}
|
||||
{% set isSortable = config.options.sort ?? false %}
|
||||
|
||||
|
@ -85,12 +99,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',
|
||||
}) %}
|
||||
|
@ -128,7 +142,7 @@
|
|||
{
|
||||
_token: csrf_token('sort'),
|
||||
page: pager.currentPageNumber,
|
||||
context: 'index',
|
||||
context: context,
|
||||
}
|
||||
) ~ '"' %}
|
||||
{% else %}
|
||||
|
@ -146,15 +160,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 +190,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,7 +220,7 @@
|
|||
|
||||
{% 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 }}
|
||||
</td>
|
||||
|
@ -214,7 +228,7 @@
|
|||
{% 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