admin: add possibility for a theme to provide a supplementary css (#2429)

This commit is contained in:
Frédéric Péters 2013-02-05 14:29:49 +01:00 committed by Thomas NOEL
parent 56dfd14339
commit 56371c4ccb
1 changed files with 12 additions and 0 deletions

View File

@ -159,6 +159,9 @@ ADMIN_TEMPLATE_EZT = """<!DOCTYPE html>
<head>
<title>[page_title]</title>
<link rel="stylesheet" type="text/css" href="[css]"/>
[if-any extra_css]
<link rel="stylesheet" type="text/css" href="[extra_css]"/>
[end]
[script]
</head>
<body>
@ -339,6 +342,15 @@ def decorate(body, response):
css = root_url + get_publisher().qommon_static_dir + get_publisher().qommon_admin_css
generate_breadcrumb = True
template = admin_template
app_dir_filename = os.path.join(get_publisher().app_dir, 'themes',
current_theme, 'admin.css')
data_dir_filename = os.path.join(get_publisher().data_dir, 'themes',
current_theme, 'admin.css')
for filename in (app_dir_filename, data_dir_filename):
if os.path.exists(filename):
extra_css = root_url + 'themes/%s/admin.css' % current_theme
break
else:
if current_theme == 'default':
css = root_url + 'css/%s.css' % get_publisher().APP_NAME