Add config for "global" help URL

This commit is contained in:
Lance Edgar 2020-08-20 17:51:00 -05:00
parent cfa9c95814
commit 9620fc5a83
3 changed files with 13 additions and 1 deletions

View file

@ -53,9 +53,15 @@ class ConfigExtension(BaseExtension):
config.setdefault('tailbone', 'themes.expose_picker', 'true') config.setdefault('tailbone', 'themes.expose_picker', 'true')
def global_help_url(config):
return config.get('tailbone', 'global_help_url')
def legacy_mobile_enabled(config): def legacy_mobile_enabled(config):
return config.getbool('tailbone', 'legacy_mobile.enabled', return config.getbool('tailbone', 'legacy_mobile.enabled',
default=True) default=True)
def protected_usernames(config): def protected_usernames(config):
return config.getlist('tailbone', 'protected_usernames') return config.getlist('tailbone', 'protected_usernames')

View file

@ -44,6 +44,7 @@ from tailbone.forms.common import Feedback
from tailbone.db import Session from tailbone.db import Session
from tailbone.views import View from tailbone.views import View
from tailbone.util import set_app_theme from tailbone.util import set_app_theme
from tailbone.config import global_help_url
class CommonView(View): class CommonView(View):
@ -69,6 +70,7 @@ class CommonView(View):
context = { context = {
'image_url': image_url, 'image_url': image_url,
'use_buefy': self.get_use_buefy(), 'use_buefy': self.get_use_buefy(),
'help_url': global_help_url(self.rattail_config),
} }
if self.expose_quickie_search: if self.expose_quickie_search:

View file

@ -58,6 +58,7 @@ from webhelpers2.html import HTML, tags
from tailbone import forms, grids, diffs from tailbone import forms, grids, diffs
from tailbone.views import View from tailbone.views import View
from tailbone.config import global_help_url
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@ -2318,8 +2319,11 @@ class MasterView(View):
so if you like you can return a different help URL depending on which so if you like you can return a different help URL depending on which
type of CRUD view is in effect, etc. type of CRUD view is in effect, etc.
""" """
if self.help_url:
return self.help_url return self.help_url
return global_help_url(self.rattail_config)
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.