From 4716545b7ea27480a1016158bffa21ce7140ca66 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 31 Jan 2022 16:52:16 -0600 Subject: [PATCH] Show helptext for params when generating new report --- tailbone/templates/forms/util.mako | 3 +++ tailbone/views/reports.py | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tailbone/templates/forms/util.mako b/tailbone/templates/forms/util.mako index cc3a5d2d..0b4f4012 100644 --- a/tailbone/templates/forms/util.mako +++ b/tailbone/templates/forms/util.mako @@ -9,6 +9,9 @@ % if isinstance(field.schema.typ, deform.FileData): class="file" % endif + % if form.has_helptext(field.name): + message="${form.render_helptext(field.name)}" + % endif % if error_messages: type="is-danger" :message='${form.messages_json(error_messages)|n}' diff --git a/tailbone/views/reports.py b/tailbone/views/reports.py index 2839c5b5..c9a14be7 100644 --- a/tailbone/views/reports.py +++ b/tailbone/views/reports.py @@ -401,6 +401,7 @@ class GenerateReport(View): } schema = colander.Schema() + helptext = {} for param in report_params: # make a new node of appropriate schema type @@ -420,10 +421,13 @@ class GenerateReport(View): if hasattr(param, 'default'): node.default = param.default + # set docstring + helptext[param.name] = param.helptext + schema.add(node) form = forms.Form(schema=schema, request=self.request, - use_buefy=use_buefy) + use_buefy=use_buefy, helptext=helptext) form.submit_label = "Generate this Report" form.cancel_url = self.request.route_url('generate_report')