more extension points for plugins (#1904)

This commit is contained in:
Kevin Papst
2020-08-21 19:38:17 +02:00
committed by GitHub
parent 5c79e68c77
commit ede21fe46a
8 changed files with 26 additions and 14 deletions

View File

@@ -15,7 +15,7 @@
{{ widgets.page_actions(event.payload.actions) }} {{ widgets.page_actions(event.payload.actions) }}
{% endmacro %} {% endmacro %}
{% macro activity(activity, view) %} {% macro activity(activity, view, options) %}
{% import "macros/widgets.html.twig" as widgets %} {% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %} {% set actions = {} %}
@@ -52,7 +52,7 @@
{% endif %} {% endif %}
{% if view != 'index' and view != 'custom' %} {% if view != 'index' and view != 'custom' %}
{% set actions = actions|merge({'back': path('admin_activity')}) %} {% set actions = actions|merge({'back': options.back|default(path('admin_activity'))}) %}
{% endif %} {% endif %}
{% set event = trigger('actions.activity', {'actions': actions, 'view': view, 'activity': activity}) %} {% set event = trigger('actions.activity', {'actions': actions, 'view': view, 'activity': activity}) %}

View File

@@ -15,7 +15,7 @@
{{ widgets.page_actions(event.payload.actions) }} {{ widgets.page_actions(event.payload.actions) }}
{% endmacro %} {% endmacro %}
{% macro customer(customer, view) %} {% macro customer(customer, view, options) %}
{% import "macros/widgets.html.twig" as widgets %} {% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %} {% set actions = {} %}
@@ -58,7 +58,7 @@
{% endif %} {% endif %}
{% if view != 'index' and view != 'custom' %} {% if view != 'index' and view != 'custom' %}
{% set actions = actions|merge({'back': path('admin_customer')}) %} {% set actions = actions|merge({'back': options.back|default(path('admin_customer'))}) %}
{% endif %} {% endif %}
{% set event = trigger('actions.customer', {'actions': actions, 'view': view, 'customer': customer}) %} {% set event = trigger('actions.customer', {'actions': actions, 'view': view, 'customer': customer}) %}

View File

@@ -47,7 +47,7 @@
{{ widgets.page_actions(actions) }} {{ widgets.page_actions(actions) }}
{% endmacro %} {% endmacro %}
{% macro invoice(invoice) %} {% macro invoice(invoice, view, options) %}
{% import "macros/widgets.html.twig" as widgets %} {% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %} {% set actions = {} %}
@@ -63,8 +63,16 @@
{% set actions = actions|merge({'trash': {'url': path('admin_invoice_delete', {'id' : invoice.id}), 'class': 'confirmation-link', 'attr': {'data-question': 'confirm.delete'}}}) %} {% set actions = actions|merge({'trash': {'url': path('admin_invoice_delete', {'id' : invoice.id}), 'class': 'confirmation-link', 'attr': {'data-question': 'confirm.delete'}}}) %}
{% endif %} {% endif %}
{% if options.back is defined %}
{% set actions = actions|merge({'back': options.back}) %}
{% endif %}
{% set event = trigger('actions.invoice', {'actions': actions, 'invoice': invoice}) %} {% set event = trigger('actions.invoice', {'actions': actions, 'invoice': invoice}) %}
{{ widgets.table_actions(actions) }} {% if view == 'index' or view == 'custom' %}
{{ widgets.table_actions(event.payload.actions) }}
{% else %}
{{ widgets.entity_actions(event.payload.actions) }}
{% endif %}
{% endmacro %} {% endmacro %}
{% macro invoice_listing(view) %} {% macro invoice_listing(view) %}

View File

@@ -42,7 +42,7 @@
<td class="{{ tables.data_table_column_class(tableName, columns, 'status') }}">{{ macros.invoice_status(entry) }}</td> <td class="{{ tables.data_table_column_class(tableName, columns, 'status') }}">{{ macros.invoice_status(entry) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'tax') }}">{{ entry.tax|money(entry.currency) }}</td> <td class="{{ tables.data_table_column_class(tableName, columns, 'tax') }}">{{ entry.tax|money(entry.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'total_rate') }}">{{ entry.total|money(entry.currency) }}</td> <td class="{{ tables.data_table_column_class(tableName, columns, 'total_rate') }}">{{ entry.total|money(entry.currency) }}</td>
<td class="{{ tables.data_table_column_class(tableName, columns, 'actions') }}">{{ actions.invoice(entry) }}</td> <td class="{{ tables.data_table_column_class(tableName, columns, 'actions') }}">{{ actions.invoice(entry, 'index') }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{{ tables.data_table_footer(entries, 'admin_invoice_list') }} {{ tables.data_table_footer(entries, 'admin_invoice_list') }}

View File

@@ -15,7 +15,7 @@
{{ widgets.page_actions(event.payload.actions) }} {{ widgets.page_actions(event.payload.actions) }}
{% endmacro %} {% endmacro %}
{% macro project(project, view) %} {% macro project(project, view, options) %}
{% import "macros/widgets.html.twig" as widgets %} {% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %} {% set actions = {} %}
@@ -56,7 +56,7 @@
{% endif %} {% endif %}
{% if view != 'index' and view != 'custom' %} {% if view != 'index' and view != 'custom' %}
{% set actions = actions|merge({'back': path('admin_project')}) %} {% set actions = actions|merge({'back': options.back|default(path('admin_project'))}) %}
{% endif %} {% endif %}
{% set event = trigger('actions.project', {'actions': actions, 'view': view, 'project': project}) %} {% set event = trigger('actions.project', {'actions': actions, 'view': view, 'project': project}) %}

View File

@@ -25,7 +25,7 @@
{{ widgets.page_actions(event.payload.actions) }} {{ widgets.page_actions(event.payload.actions) }}
{% endmacro %} {% endmacro %}
{% macro timesheet_team(timesheet, view) %} {% macro timesheet_team(timesheet, view, options) %}
{% import "macros/widgets.html.twig" as widgets %} {% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %} {% set actions = {} %}
@@ -60,7 +60,7 @@
{% endif %} {% endif %}
{% if view != 'index' %} {% if view != 'index' %}
{% set actions = actions|merge({'back': path('admin_timesheet')}) %} {% set actions = actions|merge({'back': options.back|default(path('admin_timesheet'))}) %}
{% endif %} {% endif %}
{% set event = trigger('actions.timesheet_team', {'actions': actions, 'view': view, 'timesheet': timesheet}) %} {% set event = trigger('actions.timesheet_team', {'actions': actions, 'view': view, 'timesheet': timesheet}) %}

View File

@@ -25,7 +25,7 @@
{{ widgets.page_actions(event.payload.actions) }} {{ widgets.page_actions(event.payload.actions) }}
{% endmacro %} {% endmacro %}
{% macro timesheet(timesheet, view) %} {% macro timesheet(timesheet, view, options) %}
{%- apply spaceless -%} {%- apply spaceless -%}
{% import "macros/widgets.html.twig" as widgets %} {% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %} {% set actions = {} %}
@@ -61,7 +61,7 @@
{% endif %} {% endif %}
{% if view != 'index' %} {% if view != 'index' %}
{% set actions = actions|merge({'back': path('timesheet')}) %} {% set actions = actions|merge({'back': options.back|default(path('timesheet'))}) %}
{% endif %} {% endif %}
{% set event = trigger('actions.timesheet', {'actions': actions, 'view': view, 'timesheet': timesheet}) %} {% set event = trigger('actions.timesheet', {'actions': actions, 'view': view, 'timesheet': timesheet}) %}

View File

@@ -53,7 +53,7 @@
{{ widgets.page_actions(event.payload.actions) }} {{ widgets.page_actions(event.payload.actions) }}
{% endmacro %} {% endmacro %}
{% macro user(user, view) %} {% macro user(user, view, options) %}
{% import "macros/widgets.html.twig" as widgets %} {% import "macros/widgets.html.twig" as widgets %}
{% set actions = {} %} {% set actions = {} %}
@@ -84,6 +84,10 @@
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if options.back is defined %}
{% set actions = actions|merge({'back': options.back}) %}
{% endif %}
{% set event = trigger('actions.user', {'actions': actions, 'view': view, 'user': user}) %} {% set event = trigger('actions.user', {'actions': actions, 'view': view, 'user': user}) %}
{% if view == 'index' %} {% if view == 'index' %}
{{ widgets.table_actions(event.payload.actions) }} {{ widgets.table_actions(event.payload.actions) }}