[POC] Load accounting js only on the necessary pages.

This commit is contained in:
Victor Feyens 2021-03-18 18:27:50 +01:00
parent 41937c4016
commit 4d91a3ff27
8 changed files with 33 additions and 25 deletions

20
conf.py
View File

@ -175,21 +175,11 @@ html_favicon = os.path.join(html_theme_path[0], html_theme, 'static', 'img', 'fa
html_static_path = ['static']
html_add_permalinks = '' # Sphinx < 3.5
html_permalinks = True # Sphinx >= 3.5
html_js_files = [
'js/atom.js',
'js/accounts.js',
'js/chart-of-accounts.js',
'js/entries.js',
'js/reconciliation.js',
'js/misc.js',
'js/inventory.js',
'js/coa-valuation-continental.js',
'js/coa-valuation-anglo-saxon.js',
]
html_css_files = [
#'css/accounting.css',
'css/legal.css',
]
# NOTE: only use for global files
# Page-specific css/js files can be defined with
# custom-js/custom-css metadata directives.
html_js_files = []
html_css_files = []
# Monkeypatch PHP lexer to not require <?php
lexers['php'] = PhpLexer(startinline=True)

View File

@ -1,5 +1,6 @@
:code-column:
:custom-css: accounting.css
:custom-js: accounts.js;chart-of-accounts.js;entries.js;misc.js;reconciliation.js
==============================================
Accounting Memento For Entrepreneurs (US GAAP)

View File

@ -1,4 +1,6 @@
:code-column:
:custom-css: accounting.css
:custom-js: coa-valuation-anglo-saxon.js;misc.js
==========================================================
How to do an inventory valuation? (Anglo-Saxon Accounting)

View File

@ -1,4 +1,6 @@
:code-column:
:custom-css: accounting.css
:custom-js: coa-valuation-continental.js;misc.js
==========================================================
How to do an inventory valuation? (Continental Accounting)

View File

@ -1,4 +1,6 @@
:code-column:
:custom-css: accounting.css
:custom-js: inventory.js;misc.js
====================================
Introduction to Inventory Management

View File

@ -11,16 +11,25 @@
{% endblock %}
{% block scripts %}
{# Before the super call to be loaded before custom files using React & Immutable #}
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.min.js"
integrity="sha512-myCdDiGJRYrvRb/VuJ67ljifYTJdc1jdEvL4c4ftX9o3N6EAnmD83c/7l2/91RCINZ7c8w21tiXDT7RDFjdc3g=="
crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/prefixfree@1.0.0/prefixfree.min.js"
{% if 'custom-js' in meta %}
{# Before the custom files using React & Immutable #}
<script src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.2/immutable.min.js"
integrity="sha512-myCdDiGJRYrvRb/VuJ67ljifYTJdc1jdEvL4c4ftX9o3N6EAnmD83c/7l2/91RCINZ7c8w21tiXDT7RDFjdc3g=="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.0/react-with-addons.min.js"
integrity="sha512-wsnDgOxfyn4lhblRMHPMuJh+9CnLcwcisda1zLRGNWKh6OiQynebYTyRZYgH+eWLEdNTKak0OD2GAd/S51UhTw=="
crossorigin="anonymous"></script>
<script src="{{ pathto('_static/js/atom.js', 1) }}"></script>
{% set js_files = meta['custom-js'].split(';') %}
{% for js_file in js_files %}
{% set link = '_static/js/' + js_file %}
<script src="{{ pathto(link, 1) }}"></script>
{% endfor %}
{% endif %}
{# FIXME ANVFEDI Do we really need prefixfree ? It triggers a reload of css files two more times/page #}
<!-- <script src="https://cdn.jsdelivr.net/npm/prefixfree@1.0.0/prefixfree.min.js"
integrity="sha256-a1jYldRqTzpGqk63nmXXjh/zPYp7Sjxp9iUYhNbYPXI="
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.0/react-with-addons.min.js"
integrity="sha512-wsnDgOxfyn4lhblRMHPMuJh+9CnLcwcisda1zLRGNWKh6OiQynebYTyRZYgH+eWLEdNTKak0OD2GAd/S51UhTw=="
crossorigin="anonymous"></script>
crossorigin="anonymous"></script> -->
{{ super() }}
{# TODO EDI boostrap beta cdn ??? Isn't there a stable CDN ? It looks like this cdn won't exist forever :D #}
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta2/dist/js/bootstrap.bundle.min.js" integrity="sha384-b5kHyXgcpbZJO/tY9Ul7kGkf1S0CWuKcCD38l8YkeH8z8QjE0GmW1gYU5S9FOnJ0" crossorigin="anonymous"></script>

View File

@ -1,7 +1,8 @@
/* global Immutable, React */
/* global createAtom */
/* global createAtom, findAncestor */
(function () {
'use strict';
// NOTE VFE: memento.rst
var data = createAtom();
data.addWatch('chart', function (k, m, prev, next) {

View File

@ -1,4 +1,5 @@
(function () {
// NOTE VFE: memento.rst
document.addEventListener('DOMContentLoaded', function () {
var $rec = $('#reconciliation .reconciliation-example');
if (!$rec.length) { return; }