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>
<%def name="core_styles()"> <%def name="core_styles()">
% if user_css:
## ## TODO: eventually, allow custom css per-user ${h.stylesheet_link(user_css)}
## % if user_css: % else:
## ${h.stylesheet_link(user_css)} ${h.stylesheet_link(h.get_liburl(request, 'bb_oruga_bulma_css'))}
## % else: % endif
## ${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'))}
</%def> </%def>
<%def name="head_tags()"> <%def name="head_tags()">

View file

@ -601,8 +601,11 @@ class UserView(PrincipalMasterView):
styles = self.rattail_config.getlist('tailbone', 'themes.styles', styles = self.rattail_config.getlist('tailbone', 'themes.styles',
default=[]) default=[])
for name in styles: for name in styles:
css = self.rattail_config.get('tailbone', css = None
'themes.style.{}'.format(name)) 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: if css:
options.append({'value': css, 'label': name}) options.append({'value': css, 'label': name})
context['theme_style_options'] = options context['theme_style_options'] = options