Add initial support for Vue 3 + Oruga, via "butterball" theme

just a savepoint, still have lots to do and test before this really works
This commit is contained in:
Lance Edgar 2024-04-24 16:13:14 -05:00
parent 5aa8d1f9a3
commit 2eaeb1891d
29 changed files with 3212 additions and 315 deletions

View file

@ -1103,18 +1103,22 @@ class Form(object):
# only declare label template if it's complex
html = [html]
if len(label_contents) > 1:
# nb. must apply hack to get <template #label> as final result
label_template = HTML.tag('template', c=label_contents,
**{'#label': 1})
label_template = label_template.replace(
HTML.literal('<template #label="1"'),
HTML.literal('<template #label'))
html.insert(0, label_template)
else: # simple label
# TODO: figure out why complex label does not work for oruga
if self.request.use_oruga:
attrs['label'] = label
else:
if len(label_contents) > 1:
# nb. must apply hack to get <template #label> as final result
label_template = HTML.tag('template', c=label_contents,
**{'#label': 1})
label_template = label_template.replace(
HTML.literal('<template #label="1"'),
HTML.literal('<template #label'))
html.insert(0, label_template)
else: # simple label
attrs['label'] = label
# and finally wrap it all in a <b-field>
return HTML.tag('b-field', c=html, **attrs)