full configurable data columns in all screen sizes (#404)
This commit is contained in:
@@ -26,9 +26,11 @@ $(function() {
|
|||||||
|
|
||||||
$.datatable = {
|
$.datatable = {
|
||||||
saveVisibility: function (modalSelector) {
|
saveVisibility: function (modalSelector) {
|
||||||
|
$(modalSelector).find('form').each(
|
||||||
|
function() {
|
||||||
var settings = {};
|
var settings = {};
|
||||||
var cookieName = $(modalSelector).find('form').attr('name');
|
var cookieName = $(this).attr('name');
|
||||||
$(modalSelector).find('form').find('input:checkbox:not(:checked)').each(
|
$(this).find('input:checkbox:not(:checked)').each(
|
||||||
function () {
|
function () {
|
||||||
settings[$(this).attr('name')] = $(this).is(':checked');
|
settings[$(this).attr('name')] = $(this).is(':checked');
|
||||||
}
|
}
|
||||||
@@ -38,6 +40,8 @@ $(function() {
|
|||||||
} else {
|
} else {
|
||||||
Cookies.set(cookieName, JSON.stringify(settings), {expires: 365});
|
Cookies.set(cookieName, JSON.stringify(settings), {expires: 365});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
$(modalSelector).modal('toggle');
|
$(modalSelector).modal('toggle');
|
||||||
location.reload();
|
location.reload();
|
||||||
},
|
},
|
||||||
@@ -49,12 +53,12 @@ $(function() {
|
|||||||
}
|
}
|
||||||
var header = $(tbl.find('th').get(column));
|
var header = $(tbl.find('th').get(column));
|
||||||
if (header.css("display") === "none") {
|
if (header.css("display") === "none") {
|
||||||
header.show();
|
header.show('ease');
|
||||||
tbl.find('tr').each(function(){
|
tbl.find('tr').each(function(){
|
||||||
$($(this).find('td').get(column)).show('ease');
|
$($(this).find('td').get(column)).show('ease');
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
header.hide();
|
header.hide('ease');
|
||||||
tbl.find('tr').each(function(){
|
tbl.find('tr').each(function(){
|
||||||
$($(this).find('td').get(column)).hide('ease');
|
$($(this).find('td').get(column)).hide('ease');
|
||||||
});
|
});
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"build/app.js": "/build/app.js?07d671a96df83ac52da6",
|
"build/app.js": "/build/app.js?ad0631335484158d704a",
|
||||||
"build/app.css": "/build/app.css?6501689dff217d14b179e3049295343e",
|
"build/app.css": "/build/app.css?6501689dff217d14b179e3049295343e",
|
||||||
"build/fonts/fa-regular-400.woff": "/build/fonts/fa-regular-400.woff?d9e29124",
|
|
||||||
"build/images/blue@2x.png": "/build/images/blue@2x.png?2694acfd",
|
"build/images/blue@2x.png": "/build/images/blue@2x.png?2694acfd",
|
||||||
|
"build/images/blue.png": "/build/images/blue.png?96f8a905",
|
||||||
"build/fonts/fa-solid-900.woff2": "/build/fonts/fa-solid-900.woff2?e8a92a29",
|
"build/fonts/fa-solid-900.woff2": "/build/fonts/fa-solid-900.woff2?e8a92a29",
|
||||||
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.svg?666a82cb",
|
"build/images/fa-solid-900.svg": "/build/images/fa-solid-900.svg?666a82cb",
|
||||||
"build/images/glyphicons-halflings-regular.svg": "/build/images/glyphicons-halflings-regular.svg?89889688",
|
"build/images/glyphicons-halflings-regular.svg": "/build/images/glyphicons-halflings-regular.svg?89889688",
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
"build/fonts/glyphicons-halflings-regular.woff2": "/build/fonts/glyphicons-halflings-regular.woff2?448c34a5",
|
"build/fonts/glyphicons-halflings-regular.woff2": "/build/fonts/glyphicons-halflings-regular.woff2?448c34a5",
|
||||||
"build/fonts/fa-solid-900.eot": "/build/fonts/fa-solid-900.eot?0b93480e",
|
"build/fonts/fa-solid-900.eot": "/build/fonts/fa-solid-900.eot?0b93480e",
|
||||||
"build/fonts/fa-solid-900.woff": "/build/fonts/fa-solid-900.woff?dfc040d5",
|
"build/fonts/fa-solid-900.woff": "/build/fonts/fa-solid-900.woff?dfc040d5",
|
||||||
"build/images/blue.png": "/build/images/blue.png?96f8a905",
|
"build/fonts/fa-regular-400.woff": "/build/fonts/fa-regular-400.woff?d9e29124",
|
||||||
"build/fonts/fa-regular-400.woff2": "/build/fonts/fa-regular-400.woff2?930c1264",
|
"build/fonts/fa-regular-400.woff2": "/build/fonts/fa-regular-400.woff2?930c1264",
|
||||||
"build/images/fa-regular-400.svg": "/build/images/fa-regular-400.svg?4e41caaf",
|
"build/images/fa-regular-400.svg": "/build/images/fa-regular-400.svg?4e41caaf",
|
||||||
"build/fonts/fa-regular-400.ttf": "/build/fonts/fa-regular-400.ttf?cdd8fa76",
|
"build/fonts/fa-regular-400.ttf": "/build/fonts/fa-regular-400.ttf?cdd8fa76",
|
||||||
|
|||||||
@@ -128,12 +128,13 @@ class Extensions extends \Twig_Extension
|
|||||||
*
|
*
|
||||||
* @param string $dataTable
|
* @param string $dataTable
|
||||||
* @param string $column
|
* @param string $column
|
||||||
|
* @param string $size
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function isColumnVisible(string $dataTable, string $column)
|
public function isColumnVisible(string $dataTable, string $column, string $size)
|
||||||
{
|
{
|
||||||
// TODO name handling could be improved, as now this info is spread in datatables.html.twig and here
|
// name handling is spread between here and datatables.html.twig (data_table_column_modal)
|
||||||
$dataTable = $dataTable . '_visibility';
|
$dataTable = $dataTable . '_visibility' . $size;
|
||||||
|
|
||||||
if (!isset($this->cookies[$dataTable])) {
|
if (!isset($this->cookies[$dataTable])) {
|
||||||
$visibility = false;
|
$visibility = false;
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% set columns = {'date': 'alwaysVisible'} %}
|
{% set columns = {'date': ''} %}
|
||||||
|
|
||||||
{% if not duration_only %}
|
{% if not duration_only %}
|
||||||
{% set columns = columns|merge({'starttime': 'hidden-xs', 'endtime': 'hidden-xs'}) %}
|
{% set columns = columns|merge({'starttime': 'hidden-xs', 'endtime': 'hidden-xs'}) %}
|
||||||
@@ -25,6 +25,8 @@
|
|||||||
{% set columns = columns|merge({
|
{% set columns = columns|merge({
|
||||||
'duration': '',
|
'duration': '',
|
||||||
'rate': '',
|
'rate': '',
|
||||||
|
'customer': 'hidden-xs hidden-sm',
|
||||||
|
'project': 'hidden-xs hidden-sm',
|
||||||
'activity': 'hidden-xs hidden-sm',
|
'activity': 'hidden-xs hidden-sm',
|
||||||
'username': 'hidden-xs',
|
'username': 'hidden-xs',
|
||||||
'description': 'hidden-xs hidden-sm',
|
'description': 'hidden-xs hidden-sm',
|
||||||
@@ -37,7 +39,7 @@
|
|||||||
|
|
||||||
{% for entry in entries %}
|
{% for entry in entries %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ entry.begin|date_short }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'date') }}">{{ entry.begin|date_short }}</td>
|
||||||
|
|
||||||
{% if not duration_only %}
|
{% if not duration_only %}
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|date("H:i") }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|date("H:i") }}</td>
|
||||||
@@ -57,6 +59,12 @@
|
|||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'rate') }}">‐</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'rate') }}">‐</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">
|
||||||
|
<a href="{{ path('admin_customer_edit', {'id': entry.project.customer.id}) }}">{{ widgets.label_customer(entry.project.customer) }}</a>
|
||||||
|
</td>
|
||||||
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">
|
||||||
|
<a href="{{ path('admin_project_edit', {'id': entry.project.id}) }}">{{ widgets.label_project(entry.project) }}</a>
|
||||||
|
</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">
|
||||||
<a href="{{ path('admin_activity_edit', {'id': entry.activity.id}) }}">{{ widgets.label_activity(entry.activity) }}</a>
|
<a href="{{ path('admin_activity_edit', {'id': entry.activity.id}) }}">{{ widgets.label_activity(entry.activity) }}</a>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
<form name="{{ name }}_visibility">
|
<form name="{{ name }}_visibility">
|
||||||
{% for title, class in entries %}
|
{% for title, class in entries %}
|
||||||
{% if 'alwaysVisible' not in class %}
|
{% if 'alwaysVisible' not in class %}
|
||||||
<div class="form-group {{ 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, '') %} checked="checked"{% endif %}>
|
||||||
<label class="control-label required" for="column_{{ title }}">{{ ('label.' ~ title)|trans }}</label>
|
<label class="control-label required" for="column_{{ title }}">{{ ('label.' ~ title)|trans }}</label>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -33,15 +33,30 @@
|
|||||||
{% spaceless %}
|
{% spaceless %}
|
||||||
{% set class = '' %}
|
{% set class = '' %}
|
||||||
{% set always = false %}
|
{% set always = false %}
|
||||||
|
|
||||||
{% if entries[column] is defined %}
|
{% if entries[column] is defined %}
|
||||||
{% set class = entries[column] %}
|
{% set classes = entries[column] %}
|
||||||
{% if 'alwaysVisible' in entries[column] %}
|
{% if 'alwaysVisible' in classes %}
|
||||||
{% set always = true %}
|
{# 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' %}
|
||||||
|
{% else %}
|
||||||
|
{% for tmp in classes|split(' ') %}
|
||||||
|
{% if 'hidden' in tmp %}
|
||||||
|
{% set classes = classes|replace({(tmp): ''}) %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
{% set class = classes %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if (always == false) and (not is_visible_column(name, column)) %}
|
|
||||||
{% set class = class ~ ' hidden' %}
|
|
||||||
{% endif %}
|
|
||||||
{% if not class is empty %}
|
{% if not class is empty %}
|
||||||
{{ class }}
|
{{ class }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -17,15 +17,17 @@
|
|||||||
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
{{ widgets.callout('warning', 'error.no_entries_found') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% set columns = {'date': 'alwaysVisible'} %}
|
{% set columns = {'date': ''} %}
|
||||||
|
|
||||||
{% if not duration_only %}
|
{% if not duration_only %}
|
||||||
{% set columns = columns|merge({'starttime': '', 'endtime': ''}) %}
|
{% set columns = columns|merge({'starttime': '', 'endtime': 'hidden-xs'}) %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% set columns = columns|merge({
|
{% set columns = columns|merge({
|
||||||
'duration': 'hidden-xs',
|
'duration': '',
|
||||||
'rate': 'hidden-xs',
|
'rate': 'hidden-xs',
|
||||||
|
'customer': 'hidden-xs hidden-sm',
|
||||||
|
'project': 'hidden-xs hidden-sm',
|
||||||
'activity': 'hidden-xs hidden-sm',
|
'activity': 'hidden-xs hidden-sm',
|
||||||
'description': 'hidden-xs hidden-sm',
|
'description': 'hidden-xs hidden-sm',
|
||||||
'actions': 'alwaysVisible',
|
'actions': 'alwaysVisible',
|
||||||
@@ -37,7 +39,7 @@
|
|||||||
|
|
||||||
{% for entry in entries %}
|
{% for entry in entries %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ entry.begin|date_short }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'date') }}">{{ entry.begin|date_short }}</td>
|
||||||
|
|
||||||
{% if not duration_only %}
|
{% if not duration_only %}
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|date("H:i") }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'starttime') }}">{{ entry.begin|date("H:i") }}</td>
|
||||||
@@ -57,6 +59,8 @@
|
|||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'rate') }}">‐</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'rate') }}">‐</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'customer') }}">{{ widgets.label_customer(entry.project.customer) }}</td>
|
||||||
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'project') }}">{{ widgets.label_project(entry.project) }}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">{{ widgets.label_activity(entry.activity) }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'activity') }}">{{ widgets.label_activity(entry.activity) }}</td>
|
||||||
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }} timesheet-description">{{ entry.description|desc2html }}</td>
|
<td class="{{ tables.data_table_column_class(tableName, columns, 'description') }} timesheet-description">{{ entry.description|desc2html }}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
Reference in New Issue
Block a user