Provides a mechanism for adding scss for pluggable dashboards

Users can add custom scss via the ADD_SCSS_FILES in enabled file.
Keeping the dashboard.scss for now, will remove in later patches.

Tests provided in a follow-on patch:
https://review.openstack.org/#/c/195781/

Co-Authored-By: Shaoquan Chen <sean.chen2@hp.com>
Implements: blueprint pluggable-scss
Change-Id: I34c7dd2a69eb194a0b28275baba49bdea3348f70
This commit is contained in:
Thai Tran 2015-06-25 16:36:56 -07:00
parent 3917d8e196
commit 60294f6aa6
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