general: add support for theme specific backoffice extra css (#49139)

This commit is contained in:
Frédéric Péters 2020-12-04 16:18:32 +01:00
parent af82f1474a
commit 4073f27d14
4 changed files with 12 additions and 5 deletions

View File

@ -28,6 +28,11 @@ for dirname in sorted(os.listdir('static')):
theme['variables']['no_extra_js'] = False
else:
theme['variables']['no_extra_js'] = True
if (os.path.exists(os.path.join('static', dirname, 'backoffice.scss')) or
os.path.exists(os.path.join('static', dirname, 'backoffice.css'))):
theme['variables']['portal_agent_extra_css'] = '/static/%s/backoffice.css' % dirname
else:
theme['variables']['portal_agent_extra_css'] = None
if 'included_js_libraries' not in theme['variables']:
theme['variables']['included_js_libraries'] = ['jquery.js']
if args.overlay:

View File

@ -7,3 +7,5 @@ for dirname in sorted(os.listdir('static')):
if not os.path.exists(config):
continue
print('static/%s/style.css' % dirname)
if os.path.exists(os.path.join('static', dirname, 'backoffice.scss')):
print('static/%s/backoffice.css' % dirname)

View File

@ -7,11 +7,6 @@ $(function() {
$('body').attr('data-environment-label', PUBLIK_ENVIRONMENT_LABEL);
}
if (PUBLIK_PORTAL_AGENT_EXTRA_CSS) {
$('<link rel="stylesheet" type="text/css" media="all" href="' +
PUBLIK_PORTAL_AGENT_EXTRA_CSS + '"/>').appendTo('head');
}
function update_publik_menu() {
window.sessionStorage.hobo_environment = JSON.stringify(COMBO_KNOWN_SERVICES);
window.sessionStorage.hobo_environment_timestamp = Date.now();

View File

@ -12,6 +12,11 @@
{% block extrascripts %}
<link rel="stylesheet" type="text/css" href="{{site_base}}{% static "" %}includes/gadjo-extra.css">
{% if portal_agent_extra_css|first == '/' %}
<link rel="stylesheet" type="text/css" href="{{ portal_url }}{{ portal_agent_extra_css }}">
{% elif portal_agent_extra_css %}
<link rel="stylesheet" type="text/css" href="{{ portal_agent_extra_css }}">
{% endif %}
{% if manager_homepage_url %}
<script src="{{manager_homepage_url}}__services.js"></script>
<script src="{{manager_homepage_url}}static/portal-agent/js/publik.js?{% start_timestamp %}"></script>