Misc. UI improvements for truck dump receiving on desktop

links back and forth between parent/child rows, a little help text etc.
This commit is contained in:
Lance Edgar 2018-09-22 18:33:01 -05:00
parent 255485296c
commit 4a610ba2e6
3 changed files with 42 additions and 6 deletions

View file

@ -731,12 +731,26 @@ class Form(object):
return True
def render_field_readonly(self, field_name, **kwargs):
"""
Render the given field completely, but in read-only fashion.
Note that this method will generate the wrapper div and label, as well
as the field value.
"""
if field_name not in self.fields:
return ''
# TODO: fair bit of duplication here, should merge with deform.mako
label = HTML.tag('label', self.get_label(field_name), for_=field_name)
field = self.render_field_value(field_name) or ''
field_div = HTML.tag('div', class_='field', c=[field])
return HTML.tag('div', class_='field-wrapper {}'.format(field_name), c=[label, field_div])
contents = [label, field_div]
if self.has_helptext(field_name):
contents.append(HTML.tag('span', class_='instructions',
c=[self.render_helptext(field_name)]))
return HTML.tag('div', class_='field-wrapper {}'.format(field_name), c=contents)
def render_field_value(self, field_name):
record = self.model_instance