From e99c0016739a346ca3d50623e4b52a0e23ebaf02 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 16 Dec 2021 14:54:09 -0600 Subject: [PATCH] Let config decide which versions of vue.js and buefy to use --- tailbone/subscribers.py | 12 +++++++++++- tailbone/templates/themes/falafel/base.mako | 10 +++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index 6fbced82..6677cf33 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -157,8 +157,18 @@ def before_render(event): renderer_globals['background_color'] = request.rattail_config.get( 'tailbone', 'background_color') - # maybe set custom stylesheet for Buefy themes + # buefy themes get some extra treatment 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 if request.user: css = request.rattail_config.get('tailbone.{}'.format(request.user.uuid), diff --git a/tailbone/templates/themes/falafel/base.mako b/tailbone/templates/themes/falafel/base.mako index 2c2dd2ce..78fcd4d7 100644 --- a/tailbone/templates/themes/falafel/base.mako +++ b/tailbone/templates/themes/falafel/base.mako @@ -110,16 +110,16 @@ <%def name="vuejs()"> - ## Vue.js (last known good @ 2.6.10) - ${h.javascript_link('https://unpkg.com/vue/dist/vue.min.js')} + ${h.javascript_link('https://unpkg.com/vue@{}/dist/vue.js'.format(vue_version))} ## vue-resource ## (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')} <%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 name="fontawesome()"> @@ -160,8 +160,8 @@ ## custom Buefy CSS ${h.stylesheet_link(buefy_css)} % else: - ## Buefy 0.7.4 - ${h.stylesheet_link('https://unpkg.com/buefy@0.7.4/dist/buefy.min.css')} + ## upstream Buefy CSS + ${h.stylesheet_link('https://unpkg.com/buefy@{}/dist/buefy.min.css'.format(buefy_version))} % endif