105 lines
4.6 KiB
Twig
105 lines
4.6 KiB
Twig
|
|
{% macro data_table_column_modal(name, columns) %}
|
|
<div class="modal fade" id="modal_{{ name }}" data-column-visibility="{{ name }}" tabindex="-1" role="dialog" aria-labelledby="data_table_modal_label">
|
|
<div class="modal-dialog" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="{{ 'action.close'|trans }}"><span aria-hidden="true">×</span></button>
|
|
<h4 class="modal-title" id="data_table_modal_label">{{ 'modal.columns.title'|trans }}</h4>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form name="{{ name }}_visibility">
|
|
{% for title, class in columns %}
|
|
{% if 'alwaysVisible' not in class %}
|
|
<div class="form-group">
|
|
<input type="checkbox" id="column_{{ title }}" name="{{ title }}"{% if is_visible_column(name, title) %} checked="checked"{% endif %}>
|
|
<label class="control-label" for="column_{{ title }}">{{ ('label.' ~ title)|trans }}</label>
|
|
</div>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</form>
|
|
<p>{{ 'modal.columns.description'|trans }}</p>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-primary pull-left" data-type="save">{{ 'action.save'|trans }}</button>
|
|
<button type="button" class="btn btn-warning pull-left" data-type="reset">{{ 'action.delete'|trans }}</button>
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">{{ 'action.close'|trans }}</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endmacro %}
|
|
|
|
{% macro data_table_column_class(name, columns, column) %}
|
|
{% spaceless %}
|
|
{% set class = '' %}
|
|
{% set always = false %}
|
|
|
|
{% if columns[column] is defined %}
|
|
{% set classes = columns[column] %}
|
|
{% if 'alwaysVisible' in classes %}
|
|
{# as this column should always be visible, we remove every class that includes hidden #}
|
|
{% for tmp in classes|split(' ') %}
|
|
{% if 'hidden' not in tmp %}
|
|
{% set class = class ~ ' ' ~ tmp %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% else %}
|
|
{% if not is_visible_column(name, column) %}
|
|
{% set classes = classes ~ ' hidden' %}
|
|
{% elseif not is_datatable_configured(name) %}
|
|
{% for tmp in classes|split(' ') %}
|
|
{% if 'hidden' == tmp %}
|
|
{% set classes = classes|replace({(tmp): ''}) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% else %}
|
|
{% for tmp in classes|split(' ') %}
|
|
{% if 'hidden' in tmp %}
|
|
{% set classes = classes|replace({(tmp): ''}) %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% set class = classes %}
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if not class is empty %}
|
|
{{ class }}
|
|
{% endif %}
|
|
{% endspaceless %}
|
|
{% endmacro %}
|
|
|
|
{% macro data_table_header(name, columns, skipStripped, reloadEvent) %}
|
|
{% import _self as macro %}
|
|
<div class="box data_table" id="datatable_{{ name }}">
|
|
<div class="box-body no-padding">
|
|
<div class="dataTables_wrapper form-inline dt-bootstrap">
|
|
<div class="row">
|
|
<div class="col-sm-12">
|
|
<table class="table {% if not skipStripped %}table-striped {% endif %}table-hover dataTable" role="grid" data-reload-event="{{ reloadEvent }}">
|
|
<thead>
|
|
<tr>
|
|
{%- for title, class in columns -%}
|
|
<th data-field="{{ title }}" class="{{ macro.data_table_column_class(name, columns, title) }}">{% if title is not empty and title != 'actions' %}{{ ('label.' ~ title)|trans }}{% endif %}</th>
|
|
{%- endfor -%}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% endmacro %}
|
|
|
|
{% macro data_table_footer(columns, route) %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% if route is not empty and columns is not null%}
|
|
<div class="navigation text-center no-print">
|
|
{{ pagerfanta(columns, 'twitter_bootstrap3_translated', { proximity: 1, routeName: route }) }}
|
|
</div>
|
|
{% endif %}
|
|
{% endmacro %}
|