Skip to content

Commit 35f848e

Browse files
committed
additional options for bs5 theme for file blueprint
1 parent ccb0d20 commit 35f848e

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/yafowil/file.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def input_file_display_renderer(widget, data):
158158
)
159159

160160

161-
@managedprops('vocabulary', *css_managed_props)
161+
@managedprops('vocabulary', 'radio_class', 'radio_input_class', *css_managed_props)
162162
def file_options_renderer(widget, data):
163163
if data.value in [None, UNSET, '']:
164164
return data.rendered
@@ -169,6 +169,8 @@ def file_options_renderer(widget, data):
169169
]
170170
else:
171171
value = ['keep']
172+
radio_class = attr_value('radio_class', widget, data)
173+
radio_input_class = attr_value('radio_input_class', widget, data)
172174
tags = []
173175
vocab = attr_value('vocabulary', widget, data, [])
174176
for key, term in vocabulary(vocab):
@@ -178,15 +180,16 @@ def file_options_renderer(widget, data):
178180
'checked': (key in value) and 'checked' or None,
179181
'name_': '{0}-action'.format(widget.dottedpath),
180182
'id': cssid(widget, 'input', key),
181-
'class_': cssclasses(widget, data),
183+
'class_': radio_input_class
184+
# 'class_': cssclasses(widget, data), # XXX: is this necessary?
182185
}
183186
taginput = tag('input', **attrs)
184187
text = tag('span', term)
185188
tags.append(tag(
186189
'div',
187190
taginput,
188191
text,
189-
**{'id': cssid(widget, 'radio', key)}
192+
**{'id': cssid(widget, 'radio', key), 'class': radio_class}
190193
))
191194
return data.rendered + u''.join(tags)
192195

@@ -226,3 +229,13 @@ def file_options_renderer(widget, data):
226229
factory.doc['props']['file.vocabulary'] = """\
227230
Vocabulary with available actions for existing files.
228231
"""
232+
233+
factory.defaults['file.radio_class'] = ''
234+
factory.doc['props']['file.radio_class'] = """\
235+
CSS class for the wrapper div of radio options.
236+
"""
237+
238+
factory.defaults['file.radio_input_class'] = ''
239+
factory.doc['props']['file.radio_input_class'] = """\
240+
CSS class for radio options.
241+
"""

0 commit comments

Comments
 (0)