refactored page actions to event subscriber (#2420)
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
{% macro reporting() %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
{% set actions = {} %}
|
||||
{% set children = {} %}
|
||||
{% for id, report in available_reports(app.user) %}
|
||||
{% set children = children|merge({(report.id): {'title': report.label|trans({}, 'reporting'), 'url': path(report.route), 'class': 'toolbar-action report-' ~ report.id}}) %}
|
||||
{% endfor %}
|
||||
{% set actions = actions|merge({'reporting': {'children': children}}) %}
|
||||
{% set actions = actions|merge({'help': {'url': 'reporting.html'|docu_link, 'target': '_blank'}}) %}
|
||||
{% set event = trigger('actions.reporting', {'actions': actions}) %}
|
||||
{{ widgets.page_actions(event.payload.actions) }}
|
||||
{% endmacro %}
|
||||
@@ -1,9 +1,12 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
{% import "reporting/actions.html.twig" as actions %}
|
||||
{% import "macros/widgets.html.twig" as widgets %}
|
||||
|
||||
{% block page_title %}{{ 'menu.reporting'|trans }}{% endblock %}
|
||||
{% block page_subtitle %}{% block report_title %}{% endblock %}{% endblock %}
|
||||
{% block page_actions %}{{ actions.reporting() }}{% endblock %}
|
||||
{% block page_actions %}
|
||||
{% set event = actions(app.user, 'reporting', 'index') %}
|
||||
{{ widgets.page_actions(event.actions) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user