From 18af33c9bb3f285279618c449916e604a93d5956 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 18 Jan 2018 11:47:11 -0600 Subject: [PATCH] Add basic support for per-page help URL --- tailbone/templates/base.mako | 3 +++ tailbone/views/master.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/tailbone/templates/base.mako b/tailbone/templates/base.mako index 37ab3dd5..15d5974d 100644 --- a/tailbone/templates/base.mako +++ b/tailbone/templates/base.mako @@ -54,6 +54,9 @@ % endif
+ % if help_url is not Undefined and help_url: + ${h.link_to("Help", help_url, target='_blank', class_='button')} + % endif
diff --git a/tailbone/views/master.py b/tailbone/views/master.py index 826b693c..a21188df 100644 --- a/tailbone/views/master.py +++ b/tailbone/views/master.py @@ -1192,6 +1192,9 @@ class MasterView(View): route_prefix = 'mobile.{}'.format(route_prefix) return self.request.route_url('{}.{}'.format(route_prefix, action), **kw) + def get_help_url(self): + return getattr(self, 'help_url', None) + def render_to_response(self, template, data, mobile=False): """ Return a response with the given template rendered with the given data. @@ -1210,6 +1213,7 @@ class MasterView(View): 'index_url': self.get_index_url(mobile=mobile), 'action_url': self.get_action_url, 'grid_index': self.grid_index, + 'help_url': self.get_help_url(), } if self.grid_index: