Commit 9f861a60 authored by Ludwig Ruderstaller's avatar Ludwig Ruderstaller

finetuning

parent e2ce23f9
{% extends "@AdminLTE/layout/form-theme.html.twig" %}
{% block _group_roles_widget %}
{% spaceless %}
{% apply spaceless %}
{% set attr = attr|merge({'class': (attr.class|default('') ~ ' row')|trim}) %}
<div {{ block('widget_container_attributes') }}>
{% for child in form %}
......@@ -10,13 +10,11 @@
</div>
{% endfor %}
</div>
{% endspaceless %}
{% endapply %}
{% endblock %}
{% block collection_widget %}
{% spaceless %}
{% apply spaceless %}
{% if prototype is defined %}
{% set attr = attr|merge({'data-prototype': form_row(prototype)}) %}
{% set attr = attr|merge({'data-prototype-name': prototype.vars.name}) %}
......@@ -25,70 +23,5 @@
{% set attr = attr|merge({'data-allow-remove': allow_delete ? 1 : 0 }) %}
{% set attr = attr|merge({'data-name-prefix': full_name}) %}
{{ block('form_widget') }}
{% endspaceless %}
{% endapply %}
{% endblock collection_widget %}
{% block EntryType_widget %}
<div class="row">
<div class="col-md-3">
{{ form_widget(form.name) }}
{{ form_errors(form.name) }}
</div>
<div class="col-md-1">
{{ form_widget(form.type) }}
{{ form_errors(form.type) }}
</div>
<div class="col-md-1">
{{ form_widget(form.priority) }}
{{ form_errors(form.priority) }}
</div>
<div class="col-md-3">
{{ form_widget(form.content) }}
{{ form_errors(form.content) }}
</div>
<div class="col-md-1">
{{ form_widget(form.ttl) }}
{{ form_errors(form.ttl) }}
</div>
<div class="col-md-1">
<a href="#" class="collection-up btn btn-default" title="{{ "generic.move_up"|trans }}"><span class="fas fa-arrow-up"></span></a>
<a href="#" class="collection-down btn btn-default" title="{{ "generic.move_down"|trans }}"><span class="fas fa-arrow-down"></span></a>
</div>
<div class="col-md-2">
<a href="#" class="collection-remove btn btn-default" title="{{ "generic.remove"|trans }}"><span class="far fa-trash-alt"></span></a>
<a href="#" class="collection-add btn btn-default" title="{{ "generic.add"|trans }}"><span class="fas fa-plus"></span></a>
<a href="#" class="collection-duplicate btn btn-default" title="{{ "generic.duplicate"|trans }}"><span class="far fa-clone"></span></a>
</div>
</div>
{% endblock %}
{% block ResourceRecordSetType_widget %}
<div class="row">
<div class="col-md-3">
{{ form_widget(form.name) }}
{{ form_errors(form.name) }}
</div>
<div class="col-md-1">
{{ form_widget(form.type) }}
{{ form_errors(form.type) }}
</div>
{#<div class="col-md-3">
{{ form_widget(form.content) }}
{{ form_errors(form.content) }}
</div>#}
<div class="col-md-1">
{{ form_widget(form.ttl) }}
{{ form_errors(form.ttl) }}
</div>
<div class="col-md-1">
<a href="#" class="collection-up btn btn-default" title="{{ "generic.move_up"|trans }}"><span class="fas fa-arrow-up"></span></a>
<a href="#" class="collection-down btn btn-default" title="{{ "generic.move_down"|trans }}"><span class="fas fa-arrow-down"></span></a>
</div>
<div class="col-md-2">
<a href="#" class="collection-remove btn btn-default" title="{{ "generic.remove"|trans }}"><span class="far fa-trash-alt"></span></a>
<a href="#" class="collection-add btn btn-default" title="{{ "generic.add"|trans }}"><span class="fas fa-plus"></span></a>
<a href="#" class="collection-duplicate btn btn-default" title="{{ "generic.duplicate"|trans }}"><span class="far fa-clone"></span></a>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% set data = grid.data() %}
<table id="{{ grid.id }}" class="table grid table-striped table-bordered table-condensed">
<thead>
<tr>
{%- for column in grid if column.options.visible -%}
{% spaceless %}
{% set class = [column.options.attr.class|default('')] %}
{% if column.options.sortable %}{% set class = class|merge(['sortable']) %}{% endif %}
{% if column.isSorted() %}{% set class = class|merge(['sorted '~column.getSortDir()]) %}{% endif %}
<th class="{{- class|join(' ') -}}"
style="{%- for key,value in column.getHeaderStyleOptions() -%}{{ key }}:{{ value }};{%- endfor -%}"
data-field="{{ column.name }}"
{%- for key,value in column.options.attr if key != 'class' -%}{{ key }}="{{ value }}" {% endfor %}>{{ column.options.label|trans }}</th>
{% endspaceless %}
{%- endfor -%}
</tr>
<tr>
{% for column in grid if column.options.visible %}
{% if column.options.searchable %}
{% set value = "" %}
<th>{{ column.renderFilter(grid.twig)|raw }}</th>
{% else %}
<th></th>
{% endif %}
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in data.data %}
<tr>
{% for column in grid if column.options.visible %}
<td class="{% if column.options.ellipsis %}ellipsis{% endif %}" style="text-align:{{ column.options.cellAlign }}">{{ attribute(row, column.name)|raw }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
<tfoot class="pagerfanta">
<td colspan="{{ grid.all|length }}">
<div class="col-md-10">{{ pagerfanta(data.pager, 'twitter_bootstrap3', grid.options.pagerfantaOptions) }}</div>
<div class="col-md-2">
<select class="form-control listLengthSelector" style="margin-top: 20px;margin-bottom:20px">
{% for length in grid.options.listLength %}
<option {% if length == grid.options.limit %}selected{% endif %}>{{ length }}</option>
{% endfor %}
</select>
</div>
</td>
</tfoot>
</table>
\ No newline at end of file
{% extends "@CwdGrid/grid.html.twig" %}
\ No newline at end of file
......@@ -40,96 +40,6 @@
$(document).ready(function(){
$('.bootstrap-switch').unbind('switchChange.bootstrapSwitch');
$('.bootstrap-switch').on('switchChange.bootstrapSwitch', function(event, state) {
var $id = $(this).data('id');
var $url = $(this).data('uri');
var $state = state;
$.get($url, function(response) {
// handle error
});
});
var $grid = $('table.grid');
var $headers = $grid.find('th');
var $params = new URLSearchParams(window.location.search);
// Filter state
var getFilters = function() {
var $filters = [];
$params.delete('filter');
$grid.find(".filter").each(function (){
value = $(this).val();
if (value === '') {
return;
}
$filters.push({
'operator': $(this).data('operator'),
'value': value,
'property': $(this).data('field')
});
});
if ($filters.length > 0) {
$params.set('filter', encodeURIComponent(JSON.stringify($filters)));
}
};
getFilters();
// Sorting
$headers.each(function(idx) {
if (!$(this).hasClass('sortable')) {
return;
}
if ($(this).hasClass('sorted')) {
if ($(this).hasClass('ASC')) {
$(this).append('<i class="fas fa-sort-alpha-down pull-right"></i>');
} else if ($(this).hasClass('DESC')) {
$(this).append('<i class="fas fa-sort-alpha-up pull-right"></i>');
}
}
$(this).on('click', function(e){
$params.set('sortDir', 'ASC');
if ($(this).hasClass('sorted')) {
if ($(this).hasClass('ASC')) {
$params.set('sortDir', 'DESC');
}
}
$params.set('sortField', $(this).data('field'));
$params.set('page', 1);
document.location.href = '?' + $params.toString();
});
$(this).css('cursor', 'pointer');
});
// List length
$grid.find('select.listLengthSelector').on('change', function(){
$params.set('limit', $(this).val());
$params.set('page', 1);
document.location.href = '?' + $params.toString();
});
// Filter trigger
var filterTimeout;
var filterPage = function() {
clearTimeout(filterTimeout);
filterTimeout = setTimeout(function(){
getFilters();
$params.set('page', 1);
document.location.href = '?' + $params.toString();
}, 500);
};
$grid.find(".filter").on('change', function(){
filterPage();
});
$grid.find(".filter").on('keyup', function(){
filterPage();
});
});
</script>
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment