Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
radix
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
radix
Commits
fe29d4f3
Commit
fe29d4f3
authored
9 months ago
by
Syd
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3436913
by donquixote: Field label inline not working - again
parent
8826d8a9
No related branches found
Branches containing commit
Tags
8.x-1.21
Tags containing commit
No related merge requests found
Pipeline
#140026
passed with warnings
9 months ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/accordion/accordion.twig
+64
-62
64 additions, 62 deletions
components/accordion/accordion.twig
components/field/field.twig
+27
-25
27 additions, 25 deletions
components/field/field.twig
with
91 additions
and
87 deletions
components/accordion/accordion.twig
+
64
−
62
View file @
fe29d4f3
...
...
@@ -30,61 +30,63 @@
*
*/
#}
{%
apply
spaceless
%}
{%
set
title
=
title
|
default
(
''
)
%}
{%
set
title_tag
=
title_tag
|
default
(
'h2'
)
%}
{%
set
title_link
=
title_link
|
default
(
{}
)
%}
{%
set
title_attributes
=
title_attributes
?:
create_attribute
()
%}
{%
set
id
=
id
|
default
(
'accordion-'
~
random
(
1000
))
%}
{%
set
flush
=
flush
??
false
%}
{%
set
items
=
items
|
default
([])
%}
{%
set
open_item_id
=
open_item_id
|
default
(
0
)
%}
{%
set
accordion_classes
=
[
'accordion'
]
|
merge
(
accordion_utility_classes
?
accordion_utility_classes
:
[])
%}
{%
apply
spaceless
%}
{%
set
accordion_item_classes
=
[
{%
set
title
=
title
|
default
(
''
)
%}
{%
set
title_tag
=
title_tag
|
default
(
'h2'
)
%}
{%
set
title_link
=
title_link
|
default
(
{}
)
%}
{%
set
title_attributes
=
title_attributes
?:
create_attribute
()
%}
{%
set
id
=
id
|
default
(
'accordion-'
~
random
(
1000
))
%}
{%
set
flush
=
flush
??
false
%}
{%
set
items
=
items
|
default
([])
%}
{%
set
open_item_id
=
open_item_id
|
default
(
0
)
%}
{%
set
accordion_classes
=
[
'accordion'
]
|
merge
(
accordion_utility_classes
?
accordion_utility_classes
:
[])
%}
{%
set
accordion_item_classes
=
[
'accordion-item'
]
|
merge
(
accordion_item_utility_classes
?
accordion_item_utility_classes
:
[])
%}
{%
if
flush
%}
{%
set
accordion_classes
=
accordion_classes
|
merge
([
'accordion-flush'
])
%}
{%
endif
%}
{%
set
accordion_attributes
=
accordion_attributes
?:
create_attribute
()
%}
{%
set
accordion_item_attributes
=
accordion_item_attributes
?:
create_attribute
()
%}
{%
set
accordion_attributes
=
accordion_attributes.addClass
(
accordion_classes
)
.
setAttribute
(
'id'
,
id
)
%}
{%
if
items
is
not
empty
%}
<div
{{
accordion_attributes.addClass
(
accordion_classes
)
}}
>
{%
if
title
is
not
empty
%}
{%
include
'radix:heading'
with
{
{%
if
flush
%}
{%
set
accordion_classes
=
accordion_classes
|
merge
([
'accordion-flush'
])
%}
{%
endif
%}
{%
set
accordion_attributes
=
accordion_attributes
?:
create_attribute
()
%}
{%
set
accordion_item_attributes
=
accordion_item_attributes
?:
create_attribute
()
%}
{%
set
accordion_attributes
=
accordion_attributes.addClass
(
accordion_classes
)
.
setAttribute
(
'id'
,
id
)
%}
{%
if
items
is
not
empty
%}
<div
{{
accordion_attributes.addClass
(
accordion_classes
)
}}
>
{%
if
title
is
not
empty
%}
{%
include
'radix:heading'
with
{
heading_html_tag
:
'h2'
,
content
:
title
,
heading_attributes
:
title_attributes
,
}
%}
{%
endif
%}
{%
for
item
in
items
%}
{%
set
open_item
=
open_item_id
==
loop.index
%}
{%
set
button_classes
=
[
{%
endif
%}
{%
for
item
in
items
%}
{%
set
open_item
=
open_item_id
==
loop.index
%}
{%
set
button_classes
=
[
'accordion-button'
,
'text-wrap'
,
]
%}
{%
if
not
open_item
%}
{%
set
button_classes
=
button_classes
|
merge
([
'collapsed'
])
%}
{%
endif
%}
<div
{{
accordion_item_attributes.addClass
(
accordion_item_classes
)
}}
>
{%
set
item_title_tag
=
item.title_tag
|
default
(
'h3'
)
%}
<
{{
item_title_tag
}}
class
="
accordion-header
"
id=
"heading-
{{
id
}}
-
{{
loop.index
}}
"
>
{%
set
button_attributes
=
create_attribute
()
{%
if
not
open_item
%}
{%
set
button_classes
=
button_classes
|
merge
([
'collapsed'
])
%}
{%
endif
%}
<div
{{
accordion_item_attributes.addClass
(
accordion_item_classes
)
}}
>
{%
set
item_title_tag
=
item.title_tag
|
default
(
'h3'
)
%}
<
{{
item_title_tag
}}
class
="
accordion-header
"
id=
"heading-
{{
id
}}
-
{{
loop.index
}}
"
>
{%
set
button_attributes
=
create_attribute
()
.
addClass
(
button_classes
)
.
setAttribute
(
'data-bs-toggle'
,
'collapse'
)
.
setAttribute
(
'autocomplete'
,
'off'
)
...
...
@@ -93,24 +95,24 @@
.
setAttribute
(
'aria-expanded'
,
open_item
?
'true'
:
'false'
)
%}
{%
include
'radix:button'
with
{
{%
include
'radix:button'
with
{
content
:
item.title
,
button_attributes
,
}
%}
</
{{
item_title_tag
}}
>
<div
id=
"collapse-
{{
id
}}
-
{{
loop.index
}}
"
class=
"accordion-collapse collapse
{{
open_item
?
' show'
}}
"
aria-labelledby=
"heading-
{{
id
}}
-
{{
loop.index
}}
"
role=
"region"
{%
if
not
item.stay_open
%}
data-bs-parent=
"#accordion-
{{
id
}}
"
{%
endif
%}
>
<div
class=
"accordion-body"
>
{%
set
content
=
item.content
|
default
(
''
)
%}
{%
block
content
%}
{{
content
}}
{%
endblock
%}
</div>
</div>
</div>
{%
endfor
%}
</div>
{%
endif
%}
{%
endapply
%}
\ No newline at end of file
</
{{
item_title_tag
}}
>
<div
id=
"collapse-
{{
id
}}
-
{{
loop.index
}}
"
class=
"accordion-collapse collapse
{{
open_item
?
' show'
}}
"
aria-labelledby=
"heading-
{{
id
}}
-
{{
loop.index
}}
"
role=
"region"
{%
if
not
item.stay_open
%}
data-bs-parent=
"#accordion-
{{
id
}}
"
{%
endif
%}
>
<div
class=
"accordion-body"
>
{%
set
content
=
item.content
|
default
(
''
)
%}
{%
block
content
%}
{{
content
}}
{%
endblock
%}
</div>
</div>
</div>
{%
endfor
%}
</div>
{%
endif
%}
{%
endapply
%}
This diff is collapsed.
Click to expand it.
components/field/field.twig
+
27
−
25
View file @
fe29d4f3
...
...
@@ -38,13 +38,15 @@
*/
#}
{%
set
classes
=
[
set
field_
classes
=
[
'field'
,
'field--name-'
~
field_name
|
clean_class
,
'field--type-'
~
field_type
|
clean_class
,
'field--label-'
~
label_display
,
]
label_display
==
'inline'
?
'd-flex'
,
]
|
merge
(
field_classes_utility_classes
?
field_classes_utility_classes
:
[])
%}
{%
set
title_classes
=
[
'field__label'
,
...
...
@@ -53,28 +55,28 @@
%}
{%
if
label_hidden
%}
{%
if
multiple
%}
<div
{{
attributes.addClass
(
classes
,
'field__items'
)
}}
>
{%
for
item
in
items
%}
<div
{{
item.attributes.addClass
(
'field__item'
)
}}
>
{{
item.content
}}
</div>
{%
endfor
%}
</div>
{%
else
%}
{%
for
item
in
items
%}
<div
{{
attributes.addClass
(
classes
,
'field__item'
)
}}
>
{{
item.content
}}
</div>
{%
endfor
%}
{%
endif
%}
{%
if
multiple
%}
<div
{{
attributes.addClass
(
field_
classes
,
'field__items'
)
}}
>
{%
for
item
in
items
%}
<div
{{
item.attributes.addClass
(
'field__item'
)
}}
>
{{
item.content
}}
</div>
{%
endfor
%}
</div>
{%
else
%}
{%
for
item
in
items
%}
<div
{{
attributes.addClass
(
field_
classes
,
'field__item'
)
}}
>
{{
item.content
}}
</div>
{%
endfor
%}
{%
endif
%}
{%
else
%}
<div
{{
attributes.addClass
(
classes
)
}}
>
<div
{{
title_attributes.addClass
(
title_classes
)
}}
>
{{
label
}}
</div>
{%
if
multiple
%}
<div
class=
"field__items"
>
{%
endif
%}
{%
for
item
in
items
%}
<div
{{
item.attributes.addClass
(
'field__item'
)
}}
>
{{
item.content
}}
</div>
{%
endfor
%}
{%
if
multiple
%}
</div>
{%
endif
%}
</div>
<div
{{
attributes.addClass
(
field_
classes
)
}}
>
<div
{{
title_attributes.addClass
(
title_classes
)
}}
>
{{
label
}}
</div>
{%
if
multiple
%}
<div
class=
"field__items"
>
{%
endif
%}
{%
for
item
in
items
%}
<div
{{
item.attributes.addClass
(
'field__item'
)
}}
>
{{
item.content
}}
</div>
{%
endfor
%}
{%
if
multiple
%}
</div>
{%
endif
%}
</div>
{%
endif
%}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment