Skip to content

Commit 7a0855a

Browse files
author
roadiz-ci
committed
Merge branch develop of github.com:roadiz/core-bundle-dev-app into develop
1 parent 6461ceb commit 7a0855a

7 files changed

Lines changed: 196 additions & 65 deletions

File tree

templates/base.html.twig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77
<title>{% block title %}{% trans %}back_office{% endtrans %}: {{ meta.siteName }}{% endblock %}</title>
88
<meta name="description" content="{% block description %}{% trans %}back_office{% endtrans %}{% endblock %}">
99
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
10+
<script>
11+
(function () {
12+
try {
13+
const stored = localStorage.getItem('rz-color-scheme')
14+
if (stored === 'light' || stored === 'dark') {
15+
document.documentElement.setAttribute('data-theme', stored)
16+
}
17+
} catch (error) {
18+
return
19+
}
20+
})()
21+
</script>
1022
{% include '@RoadizRozier/admin/meta-icon.html.twig' %}
1123
{# CSS scripts inclusions / Using webpack #}
1224
{{ manifest_preload_tags('shared') }}

templates/includes/rz_table.html.twig

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -25,41 +25,42 @@
2525
{% set _thead_cells %}{% block thead_cells %}{% endblock %}{% endset %}
2626
{% set _has_thead_cells = _thead_cells|trim is not empty %}
2727
{% set has_thead_content = _has_thead_cells or selection_available %}
28-
<table
29-
is="rz-table"
30-
{{ el_attr.print(_table_attributes|merge({ class: classes|join(' ') })) }}
31-
>
32-
{% block caption %}
33-
{% if caption is defined %}
34-
<caption class="rz-table__caption">{{ caption }}</caption>
35-
{% endif %}
36-
{% endblock %}
37-
{% block thead %}
38-
{% if has_thead_content %}
39-
<thead>
40-
<tr>
41-
{% if selection_available %}
42-
<th>
43-
{{ rz_bulk.select_all_input() }}
44-
</th>
45-
{% endif %}
46-
{{ _thead_cells|raw }}
47-
{% if actions_available %}
48-
<th style="text-align: right;">{% trans %}actions{% endtrans %}</th>
49-
{% endif %}
50-
</tr>
51-
</thead>
52-
{% endif %}
53-
{% endblock %}
54-
55-
<tbody {{ el_attr.print(_tbody_attributes) }}>
56-
{% block tbody_content %}{% endblock %}
57-
</tbody>
58-
<tfoot>
59-
{% block tfoot_content %}{% endblock %}
60-
</tfoot>
61-
</table>
62-
28+
<div class="rz-table-container">
29+
<table
30+
is="rz-table"
31+
{{ el_attr.print(_table_attributes|merge({ class: classes|join(' ') })) }}
32+
>
33+
{% block caption %}
34+
{% if caption is defined %}
35+
<caption class="rz-table__caption">{{ caption }}</caption>
36+
{% endif %}
37+
{% endblock %}
38+
{% block thead %}
39+
{% if has_thead_content %}
40+
<thead>
41+
<tr>
42+
{% if selection_available %}
43+
<th>
44+
{{ rz_bulk.select_all_input() }}
45+
</th>
46+
{% endif %}
47+
{{ _thead_cells|raw }}
48+
{% if actions_available %}
49+
<th style="text-align: right;">{% trans %}actions{% endtrans %}</th>
50+
{% endif %}
51+
</tr>
52+
</thead>
53+
{% endif %}
54+
{% endblock %}
55+
56+
<tbody {{ el_attr.print(_tbody_attributes) }}>
57+
{% block tbody_content %}{% endblock %}
58+
</tbody>
59+
<tfoot>
60+
{% block tfoot_content %}{% endblock %}
61+
</tfoot>
62+
</table>
63+
</div>
6364

6465
{% macro selection_input(selection_available, value, disabled = false) %}
6566
{% set attrs = {} %}

templates/includes/rz_table_actions.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="rz-button-group rz-button-group--sm rz-button-group--end">
1+
<div class="rz-table__actions rz-button-group--sm">
22
{% if save_href %}
33
{{ _self.button({
44
icon: 'rz-icon-ri--save-line',

templates/macros/rz_node_badge.html.twig

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
{% macro item(type = 'unknown', display_label = true, badgeOptions = {}) %}
22
{% set default_options = { size: 'sm'}|merge(badgeOptions) %}
33

4-
{% if type == 'not-published-yet' %}
4+
5+
{% if type == 'home' %}
6+
{% set type_options = {
7+
label: 'node.home'|trans,
8+
icon: 'rz-icon-ri--home-2-fill',
9+
} %}
10+
{% elseif type == 'not-published-yet' %}
511
{% set type_options = {
612
label: 'not_published_yet'|trans,
713
icon: 'rz-icon-ri--history-line',
@@ -123,6 +129,10 @@
123129
{% macro parameters(node, options = { display_label: true }, badgeOptions = {}) %}
124130

125131

132+
{% if node.isHome == true %}
133+
{{ _self.item('home', options.display_label, badgeOptions) }}
134+
{% endif %}
135+
126136
{% if node.isVisible == false %}
127137
{{ _self.item('hidden', options.display_label, badgeOptions) }}
128138
{% endif %}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
{% import '@RoadizRozier/macros/element_attributes.html.twig' as el_attrs %}
2+
{% import '@RoadizRozier/macros/element_attributes.html.twig' as el_attrs %}
3+
{% import '@RoadizRozier/macros/rz_button.html.twig' as rz_button %}
4+
5+
{% set items = items|default([]) %}
6+
{% set visible_count = visibleCount|default(0) %}
7+
{% if visible_count is not null %}
8+
{% set visible_count = visible_count %}
9+
{% else %}
10+
{% set visible_count = 0 %}
11+
{% endif %}
12+
13+
{% set popover = popover|default({}) %}
14+
{% set popover_id = popover.id|default('rz-overflow-' ~ random()) %}
15+
{% set placement = popover.placement|default('bottom-start') %}
16+
{% set offset = popover.offset|default('8') %}
17+
{% set shift = popover.shift|default(null) %}
18+
{% set popover_tag_list = popover.tagList|default('div') %}
19+
{% set popover_attributes = popover.attributes|default({}) %}
20+
{% set popover_class = html_classes(
21+
'rz-overflow-list__popover',
22+
popover.class|default(''),
23+
popover_attributes.class|default('')
24+
) %}
25+
{% set popover_attributes = popover_attributes|merge({
26+
class: popover_class,
27+
}) %}
28+
29+
{% set button = button|default({}) %}
30+
{% set button_attributes = button.attributes|default({})|merge({
31+
type: 'button',
32+
popovertarget: popover_id,
33+
'aria-label': button.ariaLabel|default('more')|trans,
34+
}) %}
35+
36+
{% set wrapper_attributes = wrapperAttributes|default({}) %}
37+
{% set wrapper_class = html_classes(
38+
'rz-overflow-list',
39+
wrapperClass|default(''),
40+
wrapper_attributes.class|default('')
41+
) %}
42+
{% set wrapper_attributes = wrapper_attributes|merge({
43+
class: wrapper_class,
44+
}) %}
45+
46+
{% set overflow_button_class = html_classes(
47+
'rz-overflow-list__button',
48+
button.class|default('')
49+
) %}
50+
51+
{% set visible_items = items|slice(0, visible_count) %}
52+
{% set overflow_items = items|slice(visible_count) %}
53+
{% set item_template = itemTemplate|default(null) %}
54+
{% set item_template_context = itemTemplateContext|default({}) %}
55+
{% set wrapperTag = wrapperTag|default('div') %}
56+
57+
{% block item %}{% endblock %}
58+
59+
<{{ wrapperTag }}
60+
{{ el_attrs.print(wrapper_attributes) }}
61+
>
62+
{% for loop_item in visible_items %}
63+
{% if item_template %}
64+
{{ include(item_template, item_template_context|merge({ item: loop_item })) }}
65+
{% else %}
66+
{% with { item: loop_item } %}
67+
{{ block('item') }}
68+
{% endwith %}
69+
{% endif %}
70+
{% endfor %}
71+
72+
{% if overflow_items|length > 0 %}
73+
<rz-popover
74+
{% if shift is not null %}popover-shift="{{ shift }}"{% endif %}
75+
popover-placement="{{ placement }}"
76+
popover-offset="{{ offset }}"
77+
>
78+
{{ rz_button.root(button|merge({
79+
icon: button.icon|default('rz-icon-ri--more-line'),
80+
size: button.size|default('sm'),
81+
emphasis: button.emphasis|default('tertiary'),
82+
class: overflow_button_class,
83+
attributes: button_attributes,
84+
})) }}
85+
86+
<div
87+
id="{{ popover_id }}"
88+
popover
89+
{{ el_attrs.print(popover_attributes) }}
90+
>
91+
<{{ popover_tag_list }} class="rz-overflow-list__list">
92+
{% for loop_item in overflow_items %}
93+
{% if item_template %}
94+
{{ include(item_template, item_template_context|merge({ item: loop_item })) }}
95+
{% else %}
96+
{% with { item: loop_item } %}
97+
{{ block('item') }}
98+
{% endwith %}
99+
{% endif %}
100+
{% endfor %}
101+
</{{ popover_tag_list }}>
102+
</div>
103+
</rz-popover>
104+
{% endif %}
105+
</{{ wrapperTag }}>

templates/nodes/list_table.html.twig

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
{{ _self.selection_input(selection_available, node.id, node.locked) }}
4141
<td class="rz-table__cell--flex">
4242
<rz-entity-thumbnail
43-
class="mobile-hidden uk-visible-large"
43+
class="mobile-hidden uk-visible-large rz-entity-thumbnail--medium"
4444
entity-class="RZ\Roadiz\CoreBundle\Entity\Node"
4545
entity-id="{{ node.id }}"
4646
>
@@ -55,9 +55,11 @@
5555
}) }}
5656
</td>
5757
<td class="mobile-hidden">{{ getNodeType(node).displayName }}</td>
58-
<td class="mobile-hidden uk-visible-large">
59-
{% import "@RoadizRozier/macros/rz_node_badge.html.twig" as rz_node_badge %}
60-
{{ rz_node_badge.all(node, { display_label: false }) }}
58+
<td class="rz-table__cell">
59+
<div class="rz-button-group rz-button-group--nowrap">
60+
{% import "@RoadizRozier/macros/rz_node_badge.html.twig" as rz_node_badge %}
61+
{{ rz_node_badge.all(node, { display_label: false }) }}
62+
</div>
6163
</td>
6264
<td class="mobile-hidden uk-visible-xlarge">{{ node.updatedAt|format_date('short', locale=app.request.locale) }}</td>
6365
{% if actions_available %}

templates/widgets/nodeTree/singleNode.html.twig

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -108,34 +108,35 @@
108108

109109
{% block before_actions %}
110110
{% set tags = nodeTree.getTags(item) %}
111-
{% if item.isHome or tags|length %}
112-
<div class="rz-tree__item__tags">
113-
{% import "@RoadizRozier/macros/rz_badge.html.twig" as rz_badge %}
114-
{% if item.isHome %}
115-
{{ rz_badge.item({
116-
size: 'xs',
117-
color: 'default',
118-
'icon': 'rz-icon-ri--home-2-fill',
119-
attributes: {
120-
title: 'node.home'|trans,
121-
}
122-
}) }}
123-
{% endif %}
124-
125-
{% if tags|length and nodeTree.isStackTree %}
126-
{% for tag in tags %}
127-
{% set label = tag.name|default(tag.tagName) %}
111+
{% if tags|length and nodeTree.isStackTree %}
112+
{% embed "@RoadizRozier/macros/rz_overflow_list.html.twig" with {
113+
items: tags,
114+
visibleCount: 2,
115+
wrapperTag: 'div',
116+
wrapperClass: 'rz-tree__item__tags',
117+
popover: {
118+
offset: '8',
119+
class: 'rz-tree__item__tags__popover',
120+
},
121+
button: {
122+
icon: 'rz-icon-ri--price-tag-3-line',
123+
size: 'sm',
124+
emphasis: 'secondary',
125+
ariaLabel: 'more.tags'|trans,
126+
}
127+
} %}
128+
{% block item %}
129+
{% set label = item.name|default(item.tagName) %}
130+
{% if item and label %}
131+
{% import "@RoadizRozier/macros/rz_badge.html.twig" as rz_badge %}
128132
{{ rz_badge.item({
129-
label: label|truncate_title(18),
133+
label: label,
130134
size: 'sm',
131135
color: 'default',
132-
attributes: {
133-
title: label,
134-
}
135136
}) }}
136-
{% endfor %}
137-
{% endif %}
138-
</div>
137+
{% endif %}
138+
{% endblock %}
139+
{% endembed %}
139140
{% endif %}
140141
{% endblock %}
141142

0 commit comments

Comments
 (0)