Let config decide which versions of vue.js and buefy to use

This commit is contained in:
Lance Edgar 2021-12-16 14:54:09 -06:00
parent c7d587b4cb
commit e99c001673
2 changed files with 16 additions and 6 deletions

View file

@ -157,8 +157,18 @@ 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 # buefy themes get some extra treatment
if should_use_buefy(request): if should_use_buefy(request):
# declare vue.js and buefy versions to use. the default
# values here are "quite conservative" as of this writing,
# perhaps too much so, but at least they should work fine.
renderer_globals['vue_version'] = request.rattail_config.get(
'tailbone', 'vue_version', default='2.6.10')
renderer_globals['buefy_version'] = request.rattail_config.get(
'tailbone', 'buefy_version', default='0.8.6')
# maybe set custom stylesheet
css = None css = None
if request.user: if request.user:
css = request.rattail_config.get('tailbone.{}'.format(request.user.uuid), css = request.rattail_config.get('tailbone.{}'.format(request.user.uuid),

View file

@ -110,16 +110,16 @@
</%def> </%def>
<%def name="vuejs()"> <%def name="vuejs()">
## Vue.js (last known good @ 2.6.10) ${h.javascript_link('https://unpkg.com/vue@{}/dist/vue.js'.format(vue_version))}
${h.javascript_link('https://unpkg.com/vue/dist/vue.min.js')}
## vue-resource ## vue-resource
## (needed for e.g. this.$http.get() calls, used by grid at least) ## (needed for e.g. this.$http.get() calls, used by grid at least)
## TODO: make this configurable also
${h.javascript_link('https://cdn.jsdelivr.net/npm/vue-resource@1.5.1')} ${h.javascript_link('https://cdn.jsdelivr.net/npm/vue-resource@1.5.1')}
</%def> </%def>
<%def name="buefy()"> <%def name="buefy()">
${h.javascript_link('https://unpkg.com/buefy@0.8.6/dist/buefy.min.js')} ${h.javascript_link('https://unpkg.com/buefy@{}/dist/buefy.min.js'.format(buefy_version))}
</%def> </%def>
<%def name="fontawesome()"> <%def name="fontawesome()">
@ -160,8 +160,8 @@
## custom Buefy CSS ## custom Buefy CSS
${h.stylesheet_link(buefy_css)} ${h.stylesheet_link(buefy_css)}
% else: % else:
## Buefy 0.7.4 ## upstream Buefy CSS
${h.stylesheet_link('https://unpkg.com/buefy@0.7.4/dist/buefy.min.css')} ${h.stylesheet_link('https://unpkg.com/buefy@{}/dist/buefy.min.css'.format(buefy_version))}
% endif % endif
</%def> </%def>