Add basic support for per-page help URL

This commit is contained in:
Lance Edgar 2018-01-18 11:47:11 -06:00
parent 80e9a9cf1c
commit 18af33c9bb
2 changed files with 7 additions and 0 deletions

View file

@ -54,6 +54,9 @@
% endif % endif
<div class="feedback"> <div class="feedback">
% if help_url is not Undefined and help_url:
${h.link_to("Help", help_url, target='_blank', class_='button')}
% endif
<button type="button" id="feedback">Feedback</button> <button type="button" id="feedback">Feedback</button>
</div> </div>

View file

@ -1192,6 +1192,9 @@ class MasterView(View):
route_prefix = 'mobile.{}'.format(route_prefix) route_prefix = 'mobile.{}'.format(route_prefix)
return self.request.route_url('{}.{}'.format(route_prefix, action), **kw) 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): def render_to_response(self, template, data, mobile=False):
""" """
Return a response with the given template rendered with the given data. 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), 'index_url': self.get_index_url(mobile=mobile),
'action_url': self.get_action_url, 'action_url': self.get_action_url,
'grid_index': self.grid_index, 'grid_index': self.grid_index,
'help_url': self.get_help_url(),
} }
if self.grid_index: if self.grid_index: