diff --git a/templates/activity/actions.html.twig b/templates/activity/actions.html.twig index cd3d8874..1b6c6323 100644 --- a/templates/activity/actions.html.twig +++ b/templates/activity/actions.html.twig @@ -15,7 +15,7 @@ {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} -{% macro activity(activity, view) %} +{% macro activity(activity, view, options) %} {% import "macros/widgets.html.twig" as widgets %} {% set actions = {} %} @@ -52,7 +52,7 @@ {% endif %} {% 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 %} {% set event = trigger('actions.activity', {'actions': actions, 'view': view, 'activity': activity}) %} diff --git a/templates/customer/actions.html.twig b/templates/customer/actions.html.twig index b6a4e9c3..a0d9d4b9 100644 --- a/templates/customer/actions.html.twig +++ b/templates/customer/actions.html.twig @@ -15,7 +15,7 @@ {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} -{% macro customer(customer, view) %} +{% macro customer(customer, view, options) %} {% import "macros/widgets.html.twig" as widgets %} {% set actions = {} %} @@ -58,7 +58,7 @@ {% endif %} {% 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 %} {% set event = trigger('actions.customer', {'actions': actions, 'view': view, 'customer': customer}) %} diff --git a/templates/invoice/actions.html.twig b/templates/invoice/actions.html.twig index 8339ba78..a12a3a3a 100644 --- a/templates/invoice/actions.html.twig +++ b/templates/invoice/actions.html.twig @@ -47,7 +47,7 @@ {{ widgets.page_actions(actions) }} {% endmacro %} -{% macro invoice(invoice) %} +{% macro invoice(invoice, view, options) %} {% import "macros/widgets.html.twig" as widgets %} {% 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'}}}) %} {% endif %} + {% if options.back is defined %} + {% set actions = actions|merge({'back': options.back}) %} + {% endif %} + {% 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 %} {% macro invoice_listing(view) %} diff --git a/templates/invoice/listing.html.twig b/templates/invoice/listing.html.twig index 1158531f..977a778c 100644 --- a/templates/invoice/listing.html.twig +++ b/templates/invoice/listing.html.twig @@ -42,7 +42,7 @@ {{ macros.invoice_status(entry) }} {{ entry.tax|money(entry.currency) }} {{ entry.total|money(entry.currency) }} - {{ actions.invoice(entry) }} + {{ actions.invoice(entry, 'index') }} {% endfor %} {{ tables.data_table_footer(entries, 'admin_invoice_list') }} diff --git a/templates/project/actions.html.twig b/templates/project/actions.html.twig index 080f89e2..ede7ea09 100644 --- a/templates/project/actions.html.twig +++ b/templates/project/actions.html.twig @@ -15,7 +15,7 @@ {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} -{% macro project(project, view) %} +{% macro project(project, view, options) %} {% import "macros/widgets.html.twig" as widgets %} {% set actions = {} %} @@ -56,7 +56,7 @@ {% endif %} {% 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 %} {% set event = trigger('actions.project', {'actions': actions, 'view': view, 'project': project}) %} diff --git a/templates/timesheet-team/actions.html.twig b/templates/timesheet-team/actions.html.twig index 4ed9248e..fa5d7c47 100644 --- a/templates/timesheet-team/actions.html.twig +++ b/templates/timesheet-team/actions.html.twig @@ -25,7 +25,7 @@ {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} -{% macro timesheet_team(timesheet, view) %} +{% macro timesheet_team(timesheet, view, options) %} {% import "macros/widgets.html.twig" as widgets %} {% set actions = {} %} @@ -60,7 +60,7 @@ {% endif %} {% if view != 'index' %} - {% set actions = actions|merge({'back': path('admin_timesheet')}) %} + {% set actions = actions|merge({'back': options.back|default(path('admin_timesheet'))}) %} {% endif %} {% set event = trigger('actions.timesheet_team', {'actions': actions, 'view': view, 'timesheet': timesheet}) %} diff --git a/templates/timesheet/actions.html.twig b/templates/timesheet/actions.html.twig index c40bb0c5..af379a4d 100644 --- a/templates/timesheet/actions.html.twig +++ b/templates/timesheet/actions.html.twig @@ -25,7 +25,7 @@ {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} -{% macro timesheet(timesheet, view) %} +{% macro timesheet(timesheet, view, options) %} {%- apply spaceless -%} {% import "macros/widgets.html.twig" as widgets %} {% set actions = {} %} @@ -61,7 +61,7 @@ {% endif %} {% if view != 'index' %} - {% set actions = actions|merge({'back': path('timesheet')}) %} + {% set actions = actions|merge({'back': options.back|default(path('timesheet'))}) %} {% endif %} {% set event = trigger('actions.timesheet', {'actions': actions, 'view': view, 'timesheet': timesheet}) %} diff --git a/templates/user/actions.html.twig b/templates/user/actions.html.twig index 016b64ca..d339369d 100644 --- a/templates/user/actions.html.twig +++ b/templates/user/actions.html.twig @@ -53,7 +53,7 @@ {{ widgets.page_actions(event.payload.actions) }} {% endmacro %} -{% macro user(user, view) %} +{% macro user(user, view, options) %} {% import "macros/widgets.html.twig" as widgets %} {% set actions = {} %} @@ -84,6 +84,10 @@ {% 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}) %} {% if view == 'index' %} {{ widgets.table_actions(event.payload.actions) }}