Allow all external dependency URLs to be set in config

so can host all files locally if needed.

we also now assume all themes support buefy unless otherwise
configured
This commit is contained in:
Lance Edgar 2023-01-11 23:29:28 -06:00
parent fa1cf353b8
commit 225e13f43b
2 changed files with 11 additions and 20 deletions

View file

@ -107,25 +107,21 @@
</%def>
<%def name="jquery()">
## jQuery 1.12.4
${h.javascript_link('https://code.jquery.com/jquery-1.12.4.min.js')}
${h.javascript_link(request.rattail_config.get('tailbone', 'liburl.jquery', default='https://code.jquery.com/jquery-1.12.4.min.js'))}
</%def>
<%def name="vuejs()">
${h.javascript_link('https://unpkg.com/vue@{}/dist/vue.min.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')}
${h.javascript_link(request.rattail_config.get('tailbone', 'liburl.vue', default='https://unpkg.com/vue@{}/dist/vue.min.js'.format(vue_version)))}
## TODO: make this version configurable also
${h.javascript_link(request.rattail_config.get('tailbone', 'liburl.vue_resource', default='https://cdn.jsdelivr.net/npm/vue-resource@1.5.1'))}
</%def>
<%def name="buefy()">
${h.javascript_link('https://unpkg.com/buefy@{}/dist/buefy.min.js'.format(buefy_version))}
${h.javascript_link(request.rattail_config.get('tailbone', 'liburl.buefy', default='https://unpkg.com/buefy@{}/dist/buefy.min.js'.format(buefy_version)))}
</%def>
<%def name="fontawesome()">
<script defer src="https://use.fontawesome.com/releases/v5.3.1/js/all.js"></script>
<script defer src="${request.rattail_config.get('tailbone', 'liburl.fontawesome', default='https://use.fontawesome.com/releases/v5.3.1/js/all.js')}"></script>
</%def>
<%def name="extra_javascript()"></%def>
@ -163,14 +159,14 @@
${h.stylesheet_link(buefy_css)}
% else:
## upstream Buefy CSS
${h.stylesheet_link('https://unpkg.com/buefy@{}/dist/buefy.min.css'.format(buefy_version))}
${h.stylesheet_link(request.rattail_config.get('tailbone', 'liburl.buefy.css', default='https://unpkg.com/buefy@{}/dist/buefy.min.css'.format(buefy_version)))}
% endif
</%def>
## TODO: this is only being referenced by the progress template i think?
## (so, should make a Buefy progress page at least)
<%def name="jquery_theme()">
${h.stylesheet_link('https://code.jquery.com/ui/1.11.4/themes/dark-hive/jquery-ui.css')}
${h.stylesheet_link(request.rattail_config.get('tailbone', 'liburl.jquery.css', default='https://code.jquery.com/ui/1.11.4/themes/dark-hive/jquery-ui.css'))}
</%def>
<%def name="extra_styles()"></%def>

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2022 Lance Edgar
# Copyright © 2010-2023 Lance Edgar
#
# This file is part of Rattail.
#
@ -109,14 +109,9 @@ def should_use_buefy(request):
if buefy is not None:
return buefy
# TODO: should not hard-code this surely, but works for now...
if theme == 'falafel':
# otherwise assume buefy is in effect
return True
# TODO: probably should not use this fallback? it was the first setting
# i tested with, but is poorly named to say the least
return request.rattail_config.getbool('tailbone', 'grids.use_buefy', default=False)
def pretty_datetime(config, value):
"""