Allow per-user custom styles for butterball

This commit is contained in:
Lance Edgar 2024-06-01 21:37:38 -05:00
parent 1bf28eb286
commit 9258237b85
2 changed files with 10 additions and 13 deletions

View file

@ -89,17 +89,11 @@
</%def>
<%def name="core_styles()">
## ## TODO: eventually, allow custom css per-user
## % if user_css:
## ${h.stylesheet_link(user_css)}
## % else:
## ${h.stylesheet_link(h.get_liburl(request, 'bulma.css'))}
## % endif
## TODO: eventually version / url should be configurable
${h.stylesheet_link(h.get_liburl(request, 'bb_oruga_bulma_css'))}
% if user_css:
${h.stylesheet_link(user_css)}
% else:
${h.stylesheet_link(h.get_liburl(request, 'bb_oruga_bulma_css'))}
% endif
</%def>
<%def name="head_tags()">

View file

@ -601,8 +601,11 @@ class UserView(PrincipalMasterView):
styles = self.rattail_config.getlist('tailbone', 'themes.styles',
default=[])
for name in styles:
css = self.rattail_config.get('tailbone',
'themes.style.{}'.format(name))
css = None
if self.request.use_oruga:
css = self.rattail_config.get(f'tailbone.themes.bb_style.{name}')
if not css:
css = self.rattail_config.get(f'tailbone.themes.style.{name}')
if css:
options.append({'value': css, 'label': name})
context['theme_style_options'] = options