Allow per-user stylesheet for Buefy themes
there is not yet a way for user to select from available options though
This commit is contained in:
parent
a933fc836f
commit
241747b967
|
@ -44,6 +44,7 @@ from tailbone import helpers
|
||||||
from tailbone.db import Session
|
from tailbone.db import Session
|
||||||
from tailbone.config import csrf_header_name
|
from tailbone.config import csrf_header_name
|
||||||
from tailbone.menus import make_simple_menus
|
from tailbone.menus import make_simple_menus
|
||||||
|
from tailbone.util import should_use_buefy
|
||||||
|
|
||||||
|
|
||||||
def new_request(event):
|
def new_request(event):
|
||||||
|
@ -145,6 +146,16 @@ def before_render(event):
|
||||||
renderer_globals['background_color'] = request.rattail_config.get(
|
renderer_globals['background_color'] = request.rattail_config.get(
|
||||||
'tailbone', 'background_color')
|
'tailbone', 'background_color')
|
||||||
|
|
||||||
|
# maybe set custom stylesheet for Buefy themes
|
||||||
|
if should_use_buefy(request):
|
||||||
|
css = None
|
||||||
|
if request.user:
|
||||||
|
css = request.rattail_config.get('tailbone.{}'.format(request.user.uuid),
|
||||||
|
'buefy_css')
|
||||||
|
if not css:
|
||||||
|
css = request.rattail_config.get('tailbone', 'theme.falafel.buefy_css')
|
||||||
|
renderer_globals['buefy_css'] = css
|
||||||
|
|
||||||
# here we globally declare widths for grid filter pseudo-columns
|
# here we globally declare widths for grid filter pseudo-columns
|
||||||
widths = request.rattail_config.get('tailbone', 'grids.filters.column_widths')
|
widths = request.rattail_config.get('tailbone', 'grids.filters.column_widths')
|
||||||
if widths:
|
if widths:
|
||||||
|
|
|
@ -151,7 +151,6 @@
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="buefy_styles()">
|
<%def name="buefy_styles()">
|
||||||
<% buefy_css = request.rattail_config.get('tailbone', 'theme.falafel.buefy_css') %>
|
|
||||||
% if buefy_css:
|
% if buefy_css:
|
||||||
## custom Buefy CSS
|
## custom Buefy CSS
|
||||||
${h.stylesheet_link(buefy_css)}
|
${h.stylesheet_link(buefy_css)}
|
||||||
|
|
Loading…
Reference in a new issue