-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathdashboard.html.twig
130 lines (108 loc) · 4.45 KB
/
dashboard.html.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
{#
This file is part of the Sonata package.
(c) Thomas Rabaix <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
#}
{% extends base_template %}
{% block title %}{{ 'title_dashboard'|trans({}, 'SonataAdminBundle') }}{% endblock %}
{% block breadcrumb %}{% endblock %}
{% block content %}
{% set has_left = false %}
{% for block in blocks.left %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_left = true %}
{% endif %}
{% endfor %}
{% set has_center = false %}
{% for block in blocks.center %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_center = true %}
{% endif %}
{% endfor %}
{% set has_right = false %}
{% for block in blocks.right %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_right = true %}
{% endif %}
{% endfor %}
{% set has_top = false %}
{% for block in blocks.top %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_top = true %}
{% endif %}
{% endfor %}
{% set has_bottom = false %}
{% for block in blocks.bottom %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{% set has_bottom = true %}
{% endif %}
{% endfor %}
{{ sonata_block_render_event('sonata.admin.dashboard.top', { 'admin_pool': sonata_admin.adminPool }) }}
{% if has_top %}
<div class="row">
{% for block in blocks.top %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
<div class="{{ block.class }}">
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
<div class="row">
{% set width_left = 4 %}
{% set width_right = 4 %}
{% set width_center = 4 %}
{# if center block is not present we make left and right ones wider #}
{% if not has_center %}
{% set width_left = 6 %}
{% set width_right = 6 %}
{% endif %}
{# if there is no right and left block present we make center one full width #}
{% if not has_left and not has_right %}
{% set width_center = 12 %}
{% endif %}
{# don't show left column if only center one is present #}
{% if has_left or has_right %}
<div class="col-md-{{ width_left }}">
{% for block in blocks.left %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if has_center %}
<div class="col-md-{{ width_center }}">
{% for block in blocks.center %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
{% endif %}
{% endfor %}
</div>
{% endif %}
{# don't show right column if only center one is present #}
{% if has_left or has_right %}
<div class="col-md-{{ width_right }}">
{% for block in blocks.right %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
{% endif %}
{% endfor %}
</div>
{% endif %}
</div>
{% if has_bottom %}
<div class="row">
{% for block in blocks.bottom %}
{% if block.roles|length == 0 or is_granted_affirmative(block.roles) %}
<div class="{{ block.class }}">
{{ sonata_block_render({ 'type': block.type, 'settings': block.settings}) }}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{{ sonata_block_render_event('sonata.admin.dashboard.bottom', { 'admin_pool': sonata_admin.adminPool }) }}
{% endblock %}