Emit more theme init data using tojson (#2182)

* Emit more theme init data using tojson
* Add `teamId` and `teamName` into admin `base.html`
This commit is contained in:
Kevin Chung
2022-09-07 14:40:42 -04:00
committed by GitHub
parent 328b523b24
commit 4793d95338
2 changed files with 11 additions and 9 deletions

View File

@@ -15,12 +15,14 @@
var init = { var init = {
'urlRoot': "{{ request.script_root }}", 'urlRoot': "{{ request.script_root }}",
'csrfNonce': "{{ Session.nonce }}", 'csrfNonce': "{{ Session.nonce }}",
'userMode': "{{ get_config('user_mode') }}", 'userMode': "{{ Configs.user_mode }}",
'userId': {{ id if (id is defined) else 0 }}, 'userId': {{ Session.id }},
'userName': "{{ User.name }}", 'userName': {{ User.name | tojson }},
'userEmail': "{{ User.email }}", 'userEmail': {{ User.email | tojson }},
'start': {{ get_config("start") | tojson }}, 'teamId': {{ Team.id | tojson }},
'end': {{ get_config("end") | tojson }}, 'teamName': {{ Team.name | tojson }},
'start': {{ Configs.start | tojson }},
'end': {{ Configs.end | tojson }}
} }
</script> </script>
{% block stylesheets %} {% endblock %} {% block stylesheets %} {% endblock %}

View File

@@ -18,10 +18,10 @@
'csrfNonce': "{{ Session.nonce }}", 'csrfNonce': "{{ Session.nonce }}",
'userMode': "{{ Configs.user_mode }}", 'userMode': "{{ Configs.user_mode }}",
'userId': {{ Session.id }}, 'userId': {{ Session.id }},
'userName': "{{ User.name }}", 'userName': {{ User.name | tojson }},
'userEmail': "{{ User.email }}", 'userEmail': {{ User.email | tojson }},
'teamId': {{ Team.id | tojson }}, 'teamId': {{ Team.id | tojson }},
'teamName': "{{ Team.name }}", 'teamName': {{ Team.name | tojson }},
'start': {{ Configs.start | tojson }}, 'start': {{ Configs.start | tojson }},
'end': {{ Configs.end | tojson }}, 'end': {{ Configs.end | tojson }},
'theme_settings': {{ Configs.theme_settings | tojson }} 'theme_settings': {{ Configs.theme_settings | tojson }}