Files
kimai2/templates/macros/actions.html.twig

57 lines
2.2 KiB
Twig

{% macro calendar(view) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %}
{% if is_granted('create_own_timesheet') %}
{% set actions = actions|merge({'create': {'url': path('timesheet_create'), 'class': 'modal-ajax-form'}}) %}
{% endif %}
{% set event = trigger('actions.calendar', {'actions': actions, 'view': view}) %}
{{ widgets.page_actions(event.payload.actions) }}
{% endmacro %}
{% macro plugins(view) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set actions = {'shop': {'url': constant('App\\Constants::HOMEPAGE') ~ '/store/', 'target': '_blank'}} %}
{% set actions = actions|merge({'help': {'url': 'plugins.html'|docu_link, 'target': '_blank'}}) %}
{% set event = trigger('actions.plugins', {'actions': actions, 'view': view}) %}
{{ widgets.page_actions(event.payload.actions) }}
{% endmacro %}
{% macro plugin(plugin, view) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set actions = {'home': {'url': plugin.metadata.homepage, 'target': '_blank'}} %}
{% set event = trigger('actions.plugin', {'actions': actions, 'view': view, 'plugin': plugin}) %}
{% if view == 'index' %}
{{ widgets.table_actions(event.payload.actions) }}
{% else %}
{{ widgets.entity_actions(event.payload.actions) }}
{% endif %}
{% endmacro %}
{% macro about(view) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set actions = {'about': {'url': path('about')}} %}
{% if is_granted('system_information') %}
{% set actions = actions|merge({'debug': path('about_debug')}) %}
{% endif %}
{% set event = trigger('actions.about', {'actions': actions, 'view': view}) %}
{{ widgets.page_actions(event.payload.actions) }}
{% endmacro %}
{% macro system_configuration(view) %}
{% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %}
{% set actions = actions|merge({'help': {'url': 'configurations.html'|docu_link, 'target': '_blank'}}) %}
{% set event = trigger('actions.system_configuration', {'actions': actions, 'view': view}) %}
{{ widgets.page_actions(event.payload.actions) }}
{% endmacro %}