diff --git a/tailbone/templates/reports/generated/generate.mako b/tailbone/templates/reports/generated/generate.mako
index 38adfe34..f7b4ab34 100644
--- a/tailbone/templates/reports/generated/generate.mako
+++ b/tailbone/templates/reports/generated/generate.mako
@@ -7,8 +7,19 @@
<%def name="render_buefy_form()">
%def>
diff --git a/tailbone/views/master.py b/tailbone/views/master.py
index 735755f0..dbe4049e 100644
--- a/tailbone/views/master.py
+++ b/tailbone/views/master.py
@@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
-# Copyright © 2010-2022 Lance Edgar
+# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@@ -2643,6 +2643,47 @@ class MasterView(View):
normal.append(button)
return normal
+ def make_buefy_button(self, label, is_primary=False,
+ url=None, is_external=False,
+ **kwargs):
+ """
+ Make and return a HTML ```` literal.
+ """
+ btn_kw = dict(c=label, icon_pack='fas')
+
+ if 'type' in kwargs:
+ btn_kw['type'] = kwargs['type']
+ elif is_primary:
+ btn_kw['type'] = 'is-primary'
+
+ if url:
+ btn_kw['href'] = url
+
+ if 'icon_left' in kwargs:
+ btn_kw['icon_left'] = kwargs['icon_left']
+ elif is_external:
+ btn_kw['icon_left'] = 'external-link-alt'
+ else:
+ btn_kw['icon_left'] = 'eye'
+
+ if 'target' in kwargs:
+ btn_kw['target'] = kwargs['target']
+ elif is_external:
+ btn_kw['target'] = '_blank'
+
+ button = HTML.tag('b-button', **btn_kw)
+
+ if url:
+ # nb. unfortunately HTML.tag() calls its first arg 'tag' and
+ # so we can't pass a kwarg with that name...so instead we
+ # patch that into place manually
+ button = six.text_type(button)
+ button = button.replace('`` literal, for display in
@@ -2655,6 +2696,8 @@ class MasterView(View):
assumed to be external, which affects the icon and causes
button click to open link in a new tab.
"""
+ # TODO: this should call make_buefy_button()
+
# nb. unfortunately HTML.tag() calls its first arg 'tag' and
# so we can't pass a kwarg with that name...so instead we
# patch that into place manually
diff --git a/tailbone/views/reports.py b/tailbone/views/reports.py
index 101c541b..70e4d7e6 100644
--- a/tailbone/views/reports.py
+++ b/tailbone/views/reports.py
@@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
-# Copyright © 2010-2022 Lance Edgar
+# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@@ -267,6 +267,9 @@ class ReportOutputView(ExportMasterView):
def render_report_type(self, output, field):
type_key = getattr(output, field)
+ # just show type key by default
+ rendered = type_key
+
# (try to) show link to poser report if applicable
if type_key and type_key.startswith('poser_'):
app = self.get_rattail_app()
@@ -276,10 +279,20 @@ class ReportOutputView(ExportMasterView):
if not report.get('error'):
url = self.request.route_url('poser_reports.view',
report_key=poser_key)
- return tags.link_to(type_key, url)
+ rendered = tags.link_to(type_key, url)
- # fallback to showing value as-is
- return type_key
+ # add help button if report has a link
+ report = self.report_handler.get_report(type_key)
+ if report and report.help_url:
+ button = self.make_buefy_button("Help for this report",
+ url=report.help_url,
+ is_external=True,
+ icon_left='question-circle')
+ button = HTML.tag('div', class_='level-item', c=[button])
+ rendered = HTML.tag('div', class_='level-item', c=[rendered])
+ rendered = HTML.tag('div', class_='level-left', c=[rendered, button])
+
+ return rendered
def render_params(self, report, field):
params = report.params