Merge "Provides a mechanism for adding scss for pluggable dashboards"

This commit is contained in:
Jenkins 2015-06-26 21:48:40 +00:00 committed by Gerrit Code Review
commit d8d09d5602
3 changed files with 16 additions and 0 deletions

View File

@ -1209,6 +1209,14 @@ loaded on every page. This is needed for AngularJS modules that are referenced i
A list of javascript spec files to include for integration with the Jasmine spec runner.
Jasmine is a behavior-driven development framework for testing JavaScript code.
``ADD_SCSS_FILES``
----------------------
.. versionadded:: 2015.2(Liberty)
A list of scss files to be included in the compressed set of files that are
loaded on every page. We recommend one scss file per dashboard, use @import if
you need to include additional scss files for panels.
``DISABLED``
------------

View File

@ -15,6 +15,11 @@ css rules getting cut off if one css file to get more than 4k rules inside.
{% compress css %}
<link href='{{ STATIC_URL }}dashboard/dashboard.scss' type='text/scss' media='screen' rel='stylesheet' />
{% for file in HORIZON_CONFIG.scss_files %}
<link href='{{ STATIC_URL }}{{ file }}' type='text/scss' media='screen' rel='stylesheet'/>
{% endfor %}
{% endcompress %}
<link rel="shortcut icon" href="{{ STATIC_URL }}dashboard/img/favicon.ico"/>

View File

@ -103,6 +103,7 @@ def update_dashboards(modules, horizon_config, installed_apps):
angular_modules = []
js_files = []
js_spec_files = []
scss_files = []
panel_customization = []
update_horizon_config = {}
for key, config in import_dashboard_config(modules):
@ -121,6 +122,7 @@ def update_dashboards(modules, horizon_config, installed_apps):
js_files.extend([f for f in config.get('ADD_JS_FILES', [])
if f not in existing])
js_spec_files.extend(config.get('ADD_JS_SPEC_FILES', []))
scss_files.extend(config.get('ADD_SCSS_FILES', []))
update_horizon_config.update(
config.get('UPDATE_HORIZON_CONFIG', {}))
if config.get('DASHBOARD'):
@ -144,4 +146,5 @@ def update_dashboards(modules, horizon_config, installed_apps):
horizon_config.setdefault('angular_modules', []).extend(angular_modules)
horizon_config.setdefault('js_files', []).extend(js_files)
horizon_config.setdefault('js_spec_files', []).extend(js_spec_files)
horizon_config.setdefault('scss_files', []).extend(scss_files)
installed_apps[0:0] = apps