added tags for timesheets (#604)

This commit is contained in:
Mathias
2019-05-12 01:40:04 +02:00
committed by Kevin Papst
parent f31118292c
commit e29e183e84
84 changed files with 2132 additions and 158 deletions

View File

@@ -316,7 +316,7 @@
{% set actions = {'home': {'url': plugin.metadata.homepage, 'target': '_blank'}} %}
{% set event = trigger('actions.plugin', {'actions': actions, 'view': view}) %}
{% set event = trigger('actions.plugin', {'actions': actions, 'view': view, 'plugin': plugin}) %}
{% if view == 'index' %}
{{ widgets.table_actions(event.payload.actions) }}
{% else %}
@@ -335,3 +335,28 @@
{% set event = trigger('actions.about', {'actions': actions, 'view': view}) %}
{{ widgets.page_actions(event.payload.actions) }}
{% endmacro %}
{% macro tags(view) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set actions = {'filter': '#collapseTags'} %}
{% set event = trigger('actions.tags', {'actions': actions, 'view': view}) %}
{{ widgets.page_actions(event.payload.actions) }}
{% endmacro %}
{% macro tag(tag, view) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %}
{% if is_granted('view_other_timesheet') %}
{% set actions = actions|merge({'timesheet': path('admin_timesheet', {'tags': tag.name})}) %}
{% endif %}
{% if is_granted('delete_tag') %}
{% set actions = actions|merge({'trash': {'url': path('delete_tag', {'id' : tag.id}), 'class': 'api-link', 'attr': {'data-event': 'kimai.tagDelete kimai.tagUpdate', 'data-method': 'DELETE', 'data-question': 'confirm.delete', 'data-msg-error': 'action.delete.error', 'data-msg-success': 'action.delete.success'}}}) %}
{% endif %}
{% set event = trigger('actions.tag', {'actions': actions, 'view': view, 'tag': tag}) %}
{{ widgets.table_actions(event.payload.actions) }}
{% endmacro %}

View File

@@ -88,7 +88,7 @@
<tbody>
{% endmacro %}
{% macro data_table_footer(columns, route) %}
{% macro data_table_footer(entries, route) %}
</tbody>
</table>
</div>
@@ -96,9 +96,9 @@
</div>
</div>
</div>
{% if route is not empty and columns is not null%}
{% if route is not empty and entries is not null%}
<div class="navigation text-center no-print">
{{ pagerfanta(columns, 'twitter_bootstrap3_translated', { proximity: 1, routeName: route }) }}
{{ pagerfanta(entries, 'twitter_bootstrap3_translated', { proximity: 1, routeName: route }) }}
</div>
{% endif %}
{% endmacro %}

View File

@@ -165,7 +165,9 @@
{% set class = '' %}
{% if icon == 'trash' %}
{% set class = 'delete' %}
{% if actions|length > 1 %}
<li class="divider"></li>
{% endif %}
{% endif %}
<li class="{{ class }}">
{% if values is iterable %}
@@ -275,3 +277,10 @@
{{ macro.icon(icon) }}
</a>
{% endmacro %}
{% macro tag_list(taglist) %}
{% import _self as macro %}
{% for tag in taglist %}
{{ macro.badge(tag.name , 'green') }}
{% endfor %}
{% endmacro %}