Rename setting for custom user css (remove "buefy")
but have to keep support for older setting name for now
This commit is contained in:
parent
49da9776e7
commit
8781e34c98
|
@ -27,6 +27,7 @@ Event Subscribers
|
|||
import six
|
||||
import json
|
||||
import datetime
|
||||
import warnings
|
||||
|
||||
import rattail
|
||||
|
||||
|
@ -181,8 +182,13 @@ def before_render(event):
|
|||
# maybe set custom stylesheet
|
||||
css = None
|
||||
if request.user:
|
||||
css = request.rattail_config.get('tailbone.{}'.format(request.user.uuid),
|
||||
'buefy_css')
|
||||
css = rattail_config.get(f'tailbone.{request.user.uuid}', 'user_css')
|
||||
if not css:
|
||||
css = rattail_config.get(f'tailbone.{request.user.uuid}', 'buefy_css')
|
||||
if css:
|
||||
warnings.warn(f"setting 'tailbone.{request.user.uuid}.buefy_css' should be"
|
||||
f"changed to 'tailbone.{request.user.uuid}.user_css'",
|
||||
DeprecationWarning)
|
||||
renderer_globals['user_css'] = css
|
||||
|
||||
# add global search data for quick access
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
<div class="block" style="padding-left: 2rem;">
|
||||
|
||||
<b-field label="Theme Style">
|
||||
<b-select name="tailbone.${user.uuid}.buefy_css"
|
||||
v-model="simpleSettings['tailbone.${user.uuid}.buefy_css']"
|
||||
<b-select name="tailbone.${user.uuid}.user_css"
|
||||
v-model="simpleSettings['tailbone.${user.uuid}.user_css']"
|
||||
@input="settingsNeedSaved = true">
|
||||
<option v-for="option in themeStyleOptions"
|
||||
:key="option.value"
|
||||
|
|
|
@ -601,11 +601,18 @@ class UserView(PrincipalMasterView):
|
|||
The only difference here is that we are given a user account,
|
||||
so the settings involved should only pertain to that user.
|
||||
"""
|
||||
# TODO: can stop pre-fetching this value only once we are
|
||||
# confident all settings have been updated in the wild
|
||||
user_css = self.rattail_config.get(f'tailbone.{user.uuid}', 'user_css')
|
||||
if not user_css:
|
||||
user_css = self.rattail_config.get(f'tailbone.{user.uuid}', 'buefy_css')
|
||||
|
||||
return [
|
||||
|
||||
# display
|
||||
{'section': 'tailbone.{}'.format(user.uuid),
|
||||
'option': 'buefy_css'},
|
||||
{'section': f'tailbone.{user.uuid}',
|
||||
'option': 'user_css',
|
||||
'value': user_css},
|
||||
]
|
||||
|
||||
def preferences_gather_settings(self, data, user):
|
||||
|
@ -614,9 +621,11 @@ class UserView(PrincipalMasterView):
|
|||
data, simple_settings=simple_settings, input_file_templates=False)
|
||||
|
||||
def preferences_remove_settings(self, user):
|
||||
app = self.get_rattail_app()
|
||||
simple_settings = self.preferences_get_simple_settings(user)
|
||||
self.configure_remove_settings(simple_settings=simple_settings,
|
||||
input_file_templates=False)
|
||||
app.delete_setting(self.Session(), f'tailbone.{user.uuid}.buefy_css')
|
||||
|
||||
@classmethod
|
||||
def defaults(cls, config):
|
||||
|
|
Loading…
Reference in a new issue