Improve logic used to determine if current theme supports Buefy

let settings define this per theme, but have sane defaults also
This commit is contained in:
Lance Edgar 2019-04-16 15:44:02 -05:00
parent e45dfd7351
commit e1ff4578e9

View file

@ -252,6 +252,22 @@ class MasterView(View):
return labels
def get_use_buefy(self):
"""
Returns a flag indicating whether or not the current theme supports
(and therefore should use) the Buefy JS library.
"""
# first check theme-specific setting, if one has been defined
theme = self.request.registry.settings['tailbone.theme']
buefy = self.rattail_config.getbool('tailbone', 'themes.{}.use_buefy'.format(theme))
if buefy is not None:
return buefy
# TODO: should not hard-code this surely, but works for now...
if theme == 'falafel':
return True
# TODO: probably should not use this fallback? it was the first setting
# i tested with, but is poorly named to say the least
return self.rattail_config.getbool('tailbone', 'grids.use_buefy', default=False)
##############################