Filter in hidden toolbar - improved mobile #151 (#155)

* improved toolbar: hide data table form in collapsible + filter button
* added collapsible area for toolbar form #151
This commit is contained in:
Kevin Papst
2018-06-05 21:49:13 +02:00
committed by GitHub
parent 7206d064a5
commit 451cf4cd1d
22 changed files with 87 additions and 101 deletions

View File

@@ -4,7 +4,7 @@
{% block page_title %}{{ 'admin_activity.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'admin_activity.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'plus-square': path('admin_activity_create')}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseActivityAdmin', 'plus-square': path('admin_activity_create')}) }}{% endblock %}
{% block main %}
{% if entries.count == 0 %}
@@ -18,7 +18,7 @@
'label.comment': 'hidden-xs',
'label.visible': 'hidden-xs',
'label.actions': '',
}, toolbarForm) }}
}, toolbarForm, 'collapseActivityAdmin') }}
{% for entry in entries %}
<tr>

View File

@@ -4,7 +4,7 @@
{% block page_title %}{{ 'admin_customer.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'admin_customer.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'plus-square': path('admin_customer_create')}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseCustomerAdmin', 'plus-square': path('admin_customer_create')}) }}{% endblock %}
{% block main %}
{% if entries.count == 0 %}
@@ -20,7 +20,7 @@
'label.currency': 'hidden-xs',
'label.visible': 'hidden-xs',
'label.actions': '',
}, toolbarForm) }}
}, toolbarForm, 'collapseCustomerAdmin') }}
{% for entry in entries %}
<tr>

View File

@@ -4,7 +4,7 @@
{% block page_title %}{{ 'admin_project.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'admin_project.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'plus-square': path('admin_project_create')}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseProjectAdmin', 'plus-square': path('admin_project_create')}) }}{% endblock %}
{% block main %}
{% if entries.count == 0 %}
@@ -18,7 +18,7 @@
'label.budget': 'hidden-xs',
'label.visible': 'hidden-xs',
'label.actions': '',
}, toolbarForm) }}
}, toolbarForm, 'collapseProjectAdmin') }}
{% for entry in entries %}
<tr>

View File

@@ -4,7 +4,7 @@
{% block page_title %}{{ 'admin_timesheet.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'admin_timesheet.subtitle'|trans }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'plus-square': path('admin_timesheet_create')}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseTimesheetAdmin', 'plus-square': path('admin_timesheet_create')}) }}{% endblock %}
{% block main %}
{% if entries.count == 0 %}
@@ -26,7 +26,7 @@
'label.actions': '',
}) %}
{{ tables.data_table_header(columns, toolbarForm) }}
{{ tables.data_table_header(columns, toolbarForm, 'collapseTimesheetAdmin') }}
{% for entry in entries %}
<tr>

View File

@@ -4,7 +4,7 @@
{% block page_title %}{{ 'admin_user.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'admin_user.subtitle'|trans }} {{ 'subtitle.amount'|trans({'%count%': entries.count}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'plus-square': path('admin_user_create')}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseUserAdmin', 'plus-square': path('admin_user_create')}) }}{% endblock %}
{% block main %}
{% if entries.count == 0 %}
@@ -20,7 +20,7 @@
'label.active': '',
'label.roles': '',
'label.actions': '',
}, toolbarForm) }}
}, toolbarForm, 'collapseUserAdmin') }}
{% for entry in entries %}
<tr>

View File

@@ -23,3 +23,5 @@
})|raw }}
{% endif %}
{% endblock %}
{#% block form_label %}{% endblock %#}

View File

@@ -4,12 +4,12 @@
{% block page_title %}{{ 'invoice.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'invoice.subtitle'|trans }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'plus-square': path('admin_invoice_template_create'), 'list': path('admin_invoice_template')}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseInvoice', 'plus-square': path('admin_invoice_template_create'), 'list': path('admin_invoice_template')}) }}{% endblock %}
{% block main_content_class %}invoice{% endblock %}
{% block main_before %}
{{ macro.toolbar(form) }}
{{ macro.toolbar(form, 'collapseInvoice', true) }}
{% endblock %}
{% block main_after %}

View File

@@ -1,9 +1,9 @@
{% macro data_table_header(entries, form, tools, toolsRight) %}
{% macro data_table_header(entries, form, collapseClass) %}
<div class="box data_table">
{% if form or tools or toolsRight %}
{% if form %}
{% import "macros/toolbar.html.twig" as macro %}
{{ macro.toolbar(form, tools, toolsRight) }}
{{ macro.toolbar(form, collapseClass) }}
{% endif %}
<div class="box-body no-padding">
<div class="dataTables_wrapper form-inline dt-bootstrap">

View File

@@ -1,31 +1,11 @@
{% macro toolbar(form, tools, toolsRight) %}
<div class="box-header">
{% if tools %}
<div class="btn-group tools-left no-print">
{% for icon,url in tools %}
<a class="btn btn-default" href="{{ url }}"><i class="fa fa-{{ icon }}"></i></a>
{% endfor %}
</div>
{% endif %}
{% if form %}
<div class="box-title toolbar no-print">
{% macro toolbar(form, collapsible, displayInitial) %}
<div class="toolbar no-print">
{% if collapsible %}<div class="collapse{% if displayInitial %} collapse.show in{% endif %}" id="{{ collapsible }}">{% endif %}
{% form_theme form 'form/toolbar-theme.html.twig' %}
{{ form_start(form) }}
{{ form_start(form, { 'attr': {'class': 'navbar-form navbar-left'}}) }}
{{ form_widget(form) }}
{{ form_end(form) }}
</div>
{% endif %}
{% if toolsRight %}
<div class="box-tools">
<div class="btn-group">
{% for icon,url in tools %}
<a class="btn btn-default" href="{{ url }}"><i class="fa fa-{{ icon }}"></i></a>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% if collapsible %}</div>{% endif %}
</div>
{% endmacro %}

View File

@@ -4,7 +4,7 @@
<div class="box-tools">
<div class="btn-group">
{% for icon,url in tools %}
<a class="btn btn-default" href="{{ url }}"><i class="fa fa-{{ icon }}"></i></a>
<a class="btn btn-default" href="{{ url }}"{% if '#collapse' in url %} data-toggle="collapse" {% endif %}><i class="fa fa-{{ icon }}"></i></a>
{% endfor %}
</div>
</div>

View File

@@ -1,10 +1,11 @@
{% extends 'base.html.twig' %}
{% import "macros/widgets.html.twig" as widgets %}
{% import "macros/datatables.html.twig" as tables %}
{% import "macros/toolbar.html.twig" as toolbar %}
{% block page_title %}{{ 'timesheet.title'|trans }}{% endblock %}
{% block page_subtitle %}{{ 'timesheet.subtitle'|trans }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'plus-square': path('timesheet_create')}) }}{% endblock %}
{% block page_actions %}{{ widgets.page_actions({'filter': '#collapseTimesheet', 'plus-square': path('timesheet_create')}) }}{% endblock %}
{% block main %}
@@ -26,7 +27,7 @@
'label.actions': '',
}) %}
{{ tables.data_table_header(columns, toolbarForm) }}
{{ tables.data_table_header(columns, toolbarForm, 'collapseTimesheet') }}
{% for entry in entries %}
<tr>