improve list views (#1191)

This commit is contained in:
Kevin Papst
2019-10-25 16:21:30 +02:00
committed by GitHub
parent 1114538f41
commit 949c59230f
6 changed files with 106 additions and 41 deletions

View File

@@ -8,7 +8,7 @@
'name': 'alwaysVisible',
'customer': 'hidden-xs',
'project': 'hidden-xs',
'comment': 'hidden-xs',
'comment': 'hidden-xs hidden-sm',
} %}
{% for field in metaColumns %}
{% set columns = columns|merge({
@@ -16,7 +16,7 @@
}) %}
{% endfor %}
{% set columns = columns|merge({
'visible': {'class': '', 'orderBy': false},
'visible': {'class': 'text-center', 'orderBy': false},
'actions': 'actions alwaysVisible',
}) %}

View File

@@ -16,8 +16,12 @@
}) %}
{% endfor %}
{% set columns = columns|merge({
'team': {'class': '', 'orderBy': false},
'visible': {'class': 'hidden-xs', 'orderBy': false},
'email': {'class': 'text-center hidden hidden-xs', 'orderBy': false},
'homepage': {'class': 'text-center hidden hidden-xs', 'orderBy': false},
'mobile': {'class': 'text-center hidden hidden-xs', 'orderBy': false},
'phone': {'class': 'text-center hidden hidden-xs', 'orderBy': false},
'team': {'class': 'text-center', 'orderBy': false},
'visible': {'class': 'text-center', 'orderBy': false},
'actions': 'actions alwaysVisible',
}) %}
@@ -49,6 +53,34 @@
{{ tables.datatable_meta_column(entry, field) }}
</td>
{% endfor %}
<td class="{{ tables.data_table_column_class(tableName, columns, 'email') }}">
{% if entry.email is not empty %}
<a href="mailto:{{ entry.email }}"><i class="{{ 'mail'|icon }}"></i></a>
{% else %}
&ndash;
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'homepage') }}">
{% if entry.homepage is not empty %}
<a href="{{ entry.homepage }}" target="_blank"><i class="{{ 'home'|icon }}"></i></a>
{% else %}
&ndash;
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'mobile') }}">
{% if entry.mobile is not empty %}
<a href="tel:{{ entry.mobile }}"><i class="{{ 'mobile'|icon }}"></i></a>
{% else %}
&ndash;
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'phone') }}">
{% if entry.phone is not empty %}
<a href="tel:{{ entry.phone }}"><i class="{{ 'phone'|icon }}"></i></a>
{% else %}
&ndash;
{% endif %}
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'team') }}">
{% if entry.teams|length > 0 %}
{{ widgets.badge_counter(entry.teams|length) }}

View File

@@ -20,7 +20,7 @@
{% endif %}
{% if 'alwaysVisible' not in headerOptions.class %}
<div class="form-group">
<input type="checkbox" id="column_{{ title }}" name="{{ title }}"{% if is_visible_column(name, title) %} checked="checked"{% endif %}>
<input type="checkbox" id="column_{{ title }}" name="{{ title }}"{% if is_visible_column(name, title, columns) %} checked="checked"{% endif %}>
<label class="control-label" for="column_{{ title }}">{{ headerTitle }}</label>
</div>
{% endif %}
@@ -105,15 +105,17 @@
{% endif %}
{% endfor %}
{% else %}
{% if not is_visible_column(name, column) %}
{% if not is_visible_column(name, column, columns) %}
{% set classes = classes ~ ' hidden' %}
{% elseif not is_datatable_configured(name) %}
{# needs to be a foreach, as classes like "hidden-xs" would match in: if 'hidden' in classes #}
{% for tmp in classes|split(' ') %}
{% if 'hidden' == tmp %}
{% set classes = classes|replace({(tmp): ''}) %}
{% endif %}
{% endfor %}
{% else %}
{# needs to be a foreach, as classes like "hidden-xs" would match in: if 'hidden' in classes #}
{% for tmp in classes|split(' ') %}
{% if 'hidden' in tmp %}
{% set classes = classes|replace({(tmp): ''}) %}

View File

@@ -9,6 +9,7 @@
'customer': 'hidden-xs',
'comment': 'hidden-xs hidden-sm',
'orderNumber': 'hidden-xs hidden-sm',
'orderDate': 'hidden-xs hidden-sm',
} %}
{% for field in metaColumns %}
{% set columns = columns|merge({
@@ -16,8 +17,8 @@
}) %}
{% endfor %}
{% set columns = columns|merge({
'team': {'class': '', 'orderBy': false},
'visible': {'class': '', 'orderBy': false},
'team': {'class': 'text-center', 'orderBy': false},
'visible': {'class': 'text-center', 'orderBy': false},
'actions': 'actions alwaysVisible',
}) %}
@@ -46,6 +47,11 @@
</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'comment') }}">{{ entry.comment|comment2html }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'orderNumber') }}">{{ entry.orderNumber }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'orderDate') }}">
{% if entry.orderDate is not empty %}
{{ entry.orderDate|date_short }}
{% endif %}
</td>
{% for field in metaColumns %}
<td class="text-nowrap {{ tables.data_table_column_class(tableName, columns, 'mf_' ~ field.name) }}">
{{ tables.datatable_meta_column(entry, field) }}