OMG so many Buefy things...and much to be done yet it seems
these changes are all with Buefy "forms" support in mind. hopefully didn't break any legacy/jquery stuff... and yeah, lots more left to do still for the sake of Buefy forms
This commit is contained in:
parent
eea3f671af
commit
6c3722737d
13 changed files with 192 additions and 73 deletions
|
@ -130,10 +130,51 @@ class CasesUnitsWidget(dfwidget.Widget):
|
|||
return validated
|
||||
|
||||
|
||||
class DynamicCheckboxWidget(dfwidget.CheckboxWidget):
|
||||
"""
|
||||
This checkbox widget can be "dynamic" in the sense that form logic can
|
||||
control its value and state.
|
||||
"""
|
||||
template = 'checkbox_dynamic'
|
||||
|
||||
|
||||
class PlainSelectWidget(dfwidget.SelectWidget):
|
||||
template = 'select_plain'
|
||||
|
||||
|
||||
class CustomSelectWidget(dfwidget.SelectWidget):
|
||||
"""
|
||||
This widget is mostly for convenience. You can set extra kwargs for the
|
||||
:meth:`serialize()` method, e.g.::
|
||||
|
||||
widget.set_template_values(foo='bar')
|
||||
"""
|
||||
|
||||
def set_template_values(self, **kw):
|
||||
if not hasattr(self, 'extra_template_values'):
|
||||
self.extra_template_values = {}
|
||||
self.extra_template_values.update(kw)
|
||||
|
||||
def get_template_values(self, field, cstruct, kw):
|
||||
values = super(CustomSelectWidget, self).get_template_values(field, cstruct, kw)
|
||||
if hasattr(self, 'extra_template_values'):
|
||||
values.update(self.extra_template_values)
|
||||
return values
|
||||
|
||||
|
||||
class DynamicSelectWidget(CustomSelectWidget):
|
||||
"""
|
||||
This is a "normal" select widget, but instead of (or in addition to) its
|
||||
values being set when constructed, they must be assigned dynamically in
|
||||
real-time, e.g. based on other user selections.
|
||||
|
||||
Really all this widget "does" is render some Vue.js-compatible HTML, but
|
||||
the page which contains the widget is ultimately responsible for wiring up
|
||||
the logic for things to work right.
|
||||
"""
|
||||
template = 'select_dynamic'
|
||||
|
||||
|
||||
class JQuerySelectWidget(dfwidget.SelectWidget):
|
||||
template = 'select_jquery'
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue