Sort list of available themes
and add `computed` attr for WholePage; needed by some customizations
This commit is contained in:
parent
adaa39f572
commit
34878f9293
|
@ -1010,6 +1010,7 @@
|
|||
const WholePage = {
|
||||
template: '#whole-page-template',
|
||||
mixins: [SimpleRequestMixin],
|
||||
computed: {},
|
||||
|
||||
mounted() {
|
||||
window.addEventListener('keydown', this.globalKey)
|
||||
|
|
|
@ -377,22 +377,37 @@ def get_theme_template_path(rattail_config, theme=None, session=None):
|
|||
|
||||
|
||||
def get_available_themes(rattail_config, include=None):
|
||||
"""
|
||||
Returns a list of theme names which are available. If config does
|
||||
not specify, some defaults will be assumed.
|
||||
"""
|
||||
# get available list from config, if it has one
|
||||
available = rattail_config.getlist('tailbone', 'themes.keys')
|
||||
if not available:
|
||||
available = rattail_config.getlist('tailbone', 'themes',
|
||||
ignore_ambiguous=True)
|
||||
if available:
|
||||
warnings.warn(f"URGENT: instead of 'tailbone.themes', "
|
||||
f"you should set 'tailbone.themes.keys'",
|
||||
warnings.warn("URGENT: instead of 'tailbone.themes', "
|
||||
"you should set 'tailbone.themes.keys'",
|
||||
DeprecationWarning, stacklevel=2)
|
||||
else:
|
||||
available = []
|
||||
if 'default' not in available:
|
||||
available.insert(0, 'default')
|
||||
|
||||
# include any themes specified by caller
|
||||
if include is not None:
|
||||
for theme in include:
|
||||
if theme not in available:
|
||||
available.append(theme)
|
||||
|
||||
# sort the list by name
|
||||
available.sort()
|
||||
|
||||
# make default theme the first option
|
||||
i = available.index('default')
|
||||
if i >= 0:
|
||||
available.pop(i)
|
||||
available.insert(0, 'default')
|
||||
|
||||
return available
|
||||
|
||||
|
||||
|
@ -427,7 +442,7 @@ def should_use_oruga(request):
|
|||
the default of Buefy + Vue 2.
|
||||
"""
|
||||
theme = request.registry.settings['tailbone.theme']
|
||||
if theme == 'butterball':
|
||||
if 'butterball' in theme:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
|
Loading…
Reference in a new issue